improved error-handling on conditionally excluded #-lines
This commit is contained in:
parent
0810c19168
commit
4986206ca0
@ -190,6 +190,9 @@ int to_endif;
|
|||||||
toknum = GetToken(&tk);
|
toknum = GetToken(&tk);
|
||||||
ReplaceMacros = 1;
|
ReplaceMacros = 1;
|
||||||
if (toknum != IDENTIFIER) {
|
if (toknum != IDENTIFIER) {
|
||||||
|
if (toknum != INTEGER) {
|
||||||
|
lexerror("illegal # line");
|
||||||
|
}
|
||||||
SkipToNewLine();
|
SkipToNewLine();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -202,7 +205,7 @@ int to_endif;
|
|||||||
default:
|
default:
|
||||||
case K_UNKNOWN:
|
case K_UNKNOWN:
|
||||||
/* invalid word seen after the '#' */
|
/* invalid word seen after the '#' */
|
||||||
lexerror("%s: unknown control", tk.tk_idf->id_text);
|
lexwarning("%s: unknown control", tk.tk_idf->id_text);
|
||||||
/* fallthrough */
|
/* fallthrough */
|
||||||
case K_DEFINE:
|
case K_DEFINE:
|
||||||
case K_ERROR:
|
case K_ERROR:
|
||||||
|
|||||||
@ -26,7 +26,7 @@
|
|||||||
#include "static.h"
|
#include "static.h"
|
||||||
#include "declar.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
|
* yielded strings are written to yield a pointer to a transient piece
|
||||||
* of memory, containing the string, since this is the only reasonable
|
* of memory, containing the string, since this is the only reasonable
|
||||||
* thing to do in C. `Transient' means that the result may soon
|
* thing to do in C. `Transient' means that the result may soon
|
||||||
|
|||||||
@ -194,6 +194,9 @@ int to_endif;
|
|||||||
toknum = GetToken(&tk);
|
toknum = GetToken(&tk);
|
||||||
ReplaceMacros = 1;
|
ReplaceMacros = 1;
|
||||||
if (toknum != IDENTIFIER) {
|
if (toknum != IDENTIFIER) {
|
||||||
|
if (toknum != INTEGER) {
|
||||||
|
error("illegal # line");
|
||||||
|
}
|
||||||
SkipToNewLine();
|
SkipToNewLine();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -205,7 +208,7 @@ int to_endif;
|
|||||||
id = findidf(tk.tk_str);
|
id = findidf(tk.tk_str);
|
||||||
if (id == (struct idf *)0) {
|
if (id == (struct idf *)0) {
|
||||||
/* invalid word seen after the '#' */
|
/* invalid word seen after the '#' */
|
||||||
error("%s: unknown control", tk.tk_str);
|
warning("%s: unknown control", tk.tk_str);
|
||||||
}
|
}
|
||||||
free(tk.tk_str);
|
free(tk.tk_str);
|
||||||
if (id == (struct idf *)0) continue;
|
if (id == (struct idf *)0) continue;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user