From 007151ef1da6a67c31930421ed8e20e9ce4f2098 Mon Sep 17 00:00:00 2001 From: eck Date: Mon, 10 Dec 1990 11:17:34 +0000 Subject: [PATCH] improved error-handling on conditionally excluded #-lines --- lang/cem/cemcom.ansi/domacro.c | 5 ++++- lang/cem/cemcom.ansi/dumpidf.c | 2 +- lang/cem/cpp.ansi/domacro.c | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lang/cem/cemcom.ansi/domacro.c b/lang/cem/cemcom.ansi/domacro.c index 2cee0e299..351c59148 100644 --- a/lang/cem/cemcom.ansi/domacro.c +++ b/lang/cem/cemcom.ansi/domacro.c @@ -190,6 +190,9 @@ int to_endif; toknum = GetToken(&tk); ReplaceMacros = 1; if (toknum != IDENTIFIER) { + if (toknum != INTEGER) { + lexerror("illegal # line"); + } SkipToNewLine(); continue; } @@ -202,7 +205,7 @@ int to_endif; default: case K_UNKNOWN: /* invalid word seen after the '#' */ - lexerror("%s: unknown control", tk.tk_idf->id_text); + lexwarning("%s: unknown control", tk.tk_idf->id_text); /* fallthrough */ case K_DEFINE: case K_ERROR: diff --git a/lang/cem/cemcom.ansi/dumpidf.c b/lang/cem/cemcom.ansi/dumpidf.c index 2b185c1f0..eb04f2fc4 100644 --- a/lang/cem/cemcom.ansi/dumpidf.c +++ b/lang/cem/cemcom.ansi/dumpidf.c @@ -26,7 +26,7 @@ #include "static.h" #include "declar.h" -/* Some routines (symbol2str, token2str, type2str) which should have +/* Some routines (symbol2str, type2str, qual2str) which should have * yielded strings are written to yield a pointer to a transient piece * of memory, containing the string, since this is the only reasonable * thing to do in C. `Transient' means that the result may soon diff --git a/lang/cem/cpp.ansi/domacro.c b/lang/cem/cpp.ansi/domacro.c index 4447394b3..2dd3170e1 100644 --- a/lang/cem/cpp.ansi/domacro.c +++ b/lang/cem/cpp.ansi/domacro.c @@ -194,6 +194,9 @@ int to_endif; toknum = GetToken(&tk); ReplaceMacros = 1; if (toknum != IDENTIFIER) { + if (toknum != INTEGER) { + error("illegal # line"); + } SkipToNewLine(); continue; } @@ -205,7 +208,7 @@ int to_endif; id = findidf(tk.tk_str); if (id == (struct idf *)0) { /* invalid word seen after the '#' */ - error("%s: unknown control", tk.tk_str); + warning("%s: unknown control", tk.tk_str); } free(tk.tk_str); if (id == (struct idf *)0) continue; -- 2.34.1