commit beac8a2f180a7bb9941b20f39339d12d2b5582c9
parent ec024fa76037859d683d2befaee81b93e586fea1
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Tue, 12 May 2015 08:02:49 +0200
Allow empty preprocessor directives
C standard allows it, I don't knwo why.
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/cc1/cpp.c b/cc1/cpp.c
@@ -273,9 +273,12 @@ preprocessor(char *p)
return p;
for (++p; isspace(*p); ++p)
/* nothing */;
+ if (*p == '\0')
+ return NULL;
for (q = p; isalpha(*q); ++q)
/* nothing */;
- n = q - p;
+ if ((n = q - p) == 0)
+ goto incorrect;
while (isspace(*q))
++q;
for (bp = cmds; bp->name; ++bp) {
@@ -288,5 +291,6 @@ preprocessor(char *p)
error("trailing characters after preprocessor directive");
return NULL;
}
+incorrect:
error("incorrect preprocessor directive");
}