PP: Report an error when a # is not the first thing on a line

According to the GLSL spec
Each number sign (#) can be preceded in its line only by spaces or horizontal tabs.
It may also be followed by spaces and horizontal tabs, preceding the directive.
This commit is contained in:
“jimihe” 2023-11-23 14:19:58 +08:00 committed by arcady-lunarg
parent 530a6266b2
commit feb5437942
3 changed files with 34 additions and 5 deletions

View file

@ -1,5 +1,7 @@
cppBad.vert
WARNING: 0:1: '#define' : missing space after macro name
ERROR: 0:1: '#' : (#) can be preceded in its line only by spaces or horizontal tabs
ERROR: 0:2: '#' : (#) can be preceded in its line only by spaces or horizontal tabs
ERROR: 0:3: 'preprocessor evaluation' : bad expression
ERROR: 0:3: '#if' : unexpected tokens following directive
ERROR: 0:6: 'string' : End of line in string
@ -7,7 +9,7 @@ ERROR: 0:6: 'string literal' : required extension not requested: Possible extens
GL_EXT_debug_printf
GL_EXT_spirv_intrinsics
ERROR: 0:6: '' : syntax error, unexpected INT, expecting COMMA or SEMICOLON
ERROR: 5 compilation errors. No code generated.
ERROR: 7 compilation errors. No code generated.
Shader version: 100