Preprocessor: Fixed that some comments incorrectly substituted a new line instead of space. Also generally cleaned up the space-related coding.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24387 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich
2013-12-06 16:13:47 +00:00
parent 8e789e8d62
commit e28beee891
7 changed files with 72 additions and 37 deletions

View File

@@ -70,8 +70,9 @@ ERROR: 12:1234: '#line' : unexpected tokens following directive
ERROR: 12:20001: '#error' : line should be 20001
ERROR: 12:20011: '#error' : line should be 20011
ERROR: 12:20021: '#error' : line should be 20021
ERROR: 12:20046: '#define' : Macro redefined; different substitutions: SPACE_IN_MIDDLE
ERROR: 12:10003: '' : missing #endif
ERROR: 71 compilation errors. No code generated.
ERROR: 72 compilation errors. No code generated.
ERROR: node is still EOpNull!
@@ -148,6 +149,19 @@ ERROR: node is still EOpNull!
0:202 'f' (double)
0:202 Constant:
0:202 0.000800
12:20032 Function Definition: foo234( (void)
12:20032 Function Parameters:
12:20034 Sequence
12:20034 move second child to first child (4-component vector of float)
12:20034 gl_Position: direct index for structure (gl_Position 4-component vector of float)
12:20034 '__anon__1' (out block{gl_Position,gl_PointSize,gl_ClipDistance,gl_ClipVertex,gl_FrontColor,gl_BackColor,gl_FrontSecondaryColor,gl_BackSecondaryColor,gl_TexCoord,gl_FogFragCoord})
12:20034 Constant:
12:20034 0 (const uint)
12:20034 Constant:
12:20034 6.000000
12:20034 6.000000
12:20034 6.000000
12:20034 6.000000
0:? Linker Objects
0:? 'sum' (float)
0:? 'linenumber' (int)

View File

@@ -263,6 +263,31 @@ double f = f1;
#line +20020
#error line should be 20021
#define VAL1 1.0
#define VAL2 2.0
#define RES2 /* test a multiline
comment in a macro definition */ (RES1 * VAL2)
#define RES1 (VAL2 / VAL1)
#define RES2 /* comment */(RES1 * VAL2)
#define /* */SUM_VALUES (RES2 + RES1)
void foo234()
{
gl_Position = vec4(SUM_VALUES);
}
// more whitespace recording tests
#define SPACE_AT_END(a,b) spaceAtEndIsOkay
#define SPACE_AT_END(a,b) spaceAtEndIsOkay // space at end
#define SPACE_AT_BEGIN(a,b)spaceAtBeginIsOkay
#define SPACE_AT_BEGIN(a,b) spaceAtBeginIsOkay
// space in middle is an error
#define SPACE_IN_MIDDLE(a,b) space +in middle
#define SPACE_IN_MIDDLE(a,b) space + in middle
#line 10000
#if 1
#else