We were already correctly supporting single-line comments in case like:

        #define FOO bar // comment here...

The new support added here is simply for the none-too-useful:

        #define // comment instead of macro name

With this commit, this line will now give the expected "#define without
macro name" error message instead of the lexer just going off into the
weeds.
---
 src/glsl/glcpp/glcpp-lex.l | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l
index 8b4be64..09dba35 100644
--- a/src/glsl/glcpp/glcpp-lex.l
+++ b/src/glsl/glcpp/glcpp-lex.l
@@ -251,7 +251,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
        }
 
        /* Single-line comments */
-"//"[^\r\n]* {
+<INITIAL,DEFINE>"//"[^\r\n]* {
 }
 
        /* Multi-line comments */
-- 
2.0.0

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to