summaryrefslogtreecommitdiffstats
path: root/src/glsl/glcpp/glcpp-lex.l
diff options
context:
space:
mode:
Diffstat (limited to 'src/glsl/glcpp/glcpp-lex.l')
-rw-r--r--src/glsl/glcpp/glcpp-lex.l7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l
index 5f0bb324990..44547fde0e9 100644
--- a/src/glsl/glcpp/glcpp-lex.l
+++ b/src/glsl/glcpp/glcpp-lex.l
@@ -398,8 +398,11 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
return NEWLINE;
}
- /* Handle missing newline at EOF. */
-<INITIAL><<EOF>> {
+<INITIAL,COMMENT,DEFINE><<EOF>> {
+ if (YY_START == COMMENT)
+ glcpp_error(yylloc, yyextra, "Unterminated comment");
+ if (YY_START == DEFINE)
+ glcpp_error(yylloc, yyextra, "#define without macro name");
BEGIN DONE; /* Don't keep matching this rule forever. */
yyextra->lexing_directive = 0;
return NEWLINE;