Fix several issues in the preprocessor:

- macro expansion of hexidecimal numbers 
 - give errors instead of warnings/silence on extra tokens after #endif, #else, etc.
 - give errors on reserved macro name use, reuse of argument, and redefinition with different whitespace presence
 - detect and give error for all cases of #elif and #else after #else



git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23982 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich
2013-11-10 23:07:36 +00:00
parent cfe3ba5a18
commit 4d6570a1b3
14 changed files with 403 additions and 339 deletions

View File

@@ -1,6 +1,7 @@
ERROR: 0:46: 'xyxwx' : illegal vector field selection
ERROR: 0:46: 'xyxwx' : illegal vector field selection
ERROR: 2 compilation errors. No code generated.
ERROR: 0:51: '' : missing #endif
ERROR: 3 compilation errors. No code generated.
ERROR: node is still EOpNull!
0:4 Sequence

View File

@@ -1,3 +1,4 @@
Warning, version 400 is not yet complete; some version-specific features are present, but many are missing.
ERROR: 0:77: '#error' : good1
ERROR: 0:81: '#error' : good2
ERROR: 0:85: '#error' : good3
@@ -6,20 +7,42 @@ ERROR: 0:93: '#error' : good5
ERROR: 0:97: '#error' : good6
ERROR: 0:101: 'preprocessor' : expected ')'
ERROR: 0:101: '#error' : bad1
WARNING: 0:104: '#if' : unexpected tokens following #if directive - expected a newline
ERROR: 0:104: '#if' : unexpected tokens following directive
ERROR: 0:105: '#error' : bad2
ERROR: 0:109: 'preprocessor' : expected ')'
ERROR: 0:109: '#error' : bad3
WARNING: 0:112: '#if' : unexpected tokens following #if directive - expected a newline
ERROR: 0:112: '#if' : unexpected tokens following directive
ERROR: 0:113: '#error' : bad4
ERROR: 0:117: 'preprocessor' : expected ')'
ERROR: 0:117: '#error' : bad5
WARNING: 0:120: '#if' : unexpected tokens following #if directive - expected a newline
ERROR: 0:120: '#if' : unexpected tokens following directive
ERROR: 0:121: '#error' : bad6
ERROR: 0:133: '#' : preprocessor directive cannot be preceded by another token
INTERNAL ERROR: 0:133: Unknown PP token
ERROR: 0:133: '' : syntax error
ERROR: 17 compilation errors. No code generated.
ERROR: 0:122: '#endif' : unexpected tokens following directive
ERROR: 0:135: '""' : string literals not supported
ERROR: 0:136: '""' : string literals not supported
ERROR: 0:136: 'length' : no matching overloaded function found
ERROR: 0:136: '=' : cannot convert from 'const float' to 'int'
ERROR: 0:138: ''' : character literals not supported
ERROR: 0:138: ''' : character literals not supported
ERROR: 0:141: '#define' : reserved built-in name prefix: GL_
ERROR: 0:142: '#define' : reserved built-in name prefix: GL_
ERROR: 0:143: '#define' : names containing consecutive underscores are reserved
ERROR: 0:144: '#define' : names containing consecutive underscores are reserved
ERROR: 0:145: '#define' : names containing consecutive underscores are reserved
ERROR: 0:148: '#else' : unexpected tokens following directive
ERROR: 0:149: '#else' : #elif after #else
ERROR: 0:155: '#else' : unexpected tokens following directive
ERROR: 0:158: '#else' : #else after #else
ERROR: 0:160: '#endif' : unexpected tokens following directive
ERROR: 0:164: '#define' : duplicate macro parameter
ERROR: 0:173: '#define' : Macro redefined; different number of arguments: m4
ERROR: 0:178: '#define' : Macro redefined; different number of arguments: m5
ERROR: 0:182: '#define' : Macro redefined; different number of arguments: m6
ERROR: 0:185: '#define' : Macro redefined; different substitutions: m7
ERROR: 0:192: '#define' : Macro redefined; different substitutions: m8
ERROR: 0:196: '#define' : Macro redefined; different argument names: m9
ERROR: 0:206: '' : missing #endif
ERROR: 43 compilation errors. No code generated.
ERROR: node is still EOpNull!
0:5 Sequence
@@ -59,7 +82,10 @@ ERROR: node is still EOpNull!
0:65 Constant:
0:65 0.050000
0:69 move second child to first child (4-component vector of float)
0:69 'gl_Position' (gl_Position 4-component vector of float)
0:69 gl_Position: direct index for structure (gl_Position 4-component vector of float)
0:69 '__anon__1' (out block{gl_Position,gl_PointSize,gl_ClipDistance,gl_ClipVertex,gl_FrontColor,gl_BackColor,gl_FrontSecondaryColor,gl_BackSecondaryColor,gl_TexCoord,gl_FogFragCoord})
0:69 Constant:
0:69 0 (const uint)
0:69 Construct vec4 (4-component vector of float)
0:69 'sum' (float)
0:124 Sequence
@@ -76,17 +102,31 @@ ERROR: node is still EOpNull!
0:126 move second child to first child (int)
0:126 'version' (int)
0:126 Constant:
0:126 110 (const int)
0:126 400 (const int)
0:130 Sequence
0:130 move second child to first child (float)
0:130 'twoPi' (float)
0:130 Constant:
0:130 6.280000
0:199 Sequence
0:199 move second child to first child (int)
0:199 'n' (int)
0:199 Constant:
0:199 15 (const int)
0:202 Sequence
0:202 move second child to first child (double)
0:202 'f' (double)
0:202 Constant:
0:202 0.000800
0:? Linker Objects
0:? 'sum' (float)
0:? 'linenumber' (int)
0:? 'filenumber' (int)
0:? 'version' (int)
0:? 'twoPi' (float)
0:? 'tod' (float)
0:? 'a' (int)
0:? 'n' (int)
0:? 'f' (double)
0:? 'gl_VertexID' (gl_VertexId int)
0:? 'gl_InstanceID' (gl_InstanceId int)