Fix public bug 1277: #line L sets the next line to L+1 or just L, based on the version of the language.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@29277 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2014-12-20 07:03:18 +00:00
parent 560df75970
commit 2b20dcb64d
9 changed files with 91 additions and 68 deletions

View File

@ -196,4 +196,7 @@ void badswizzle()
#pragma STDGL invariant(all)
#line 3000
#error line of this error should be 3000
uniform samplerExternalOES badExt; // syntax ERROR

View File

@ -20,3 +20,6 @@ uniform foob {
int a[];
};
int a[5]; // ERROR, resizing user-block member
#line 3000
#error line of this error should be 3001

View File

@ -82,8 +82,9 @@ ERROR: 0:192: '.' : cannot apply to an array: nothing
ERROR: 0:193: '.length' : not supported for this version or the enabled extensions
ERROR: 0:194: '.' : cannot apply to an array: method
ERROR: 0:194: 'a' : can't use function syntax on variable
ERROR: 0:199: '' : syntax error
ERROR: 75 compilation errors. No code generated.
ERROR: 0:3000: '#error' : line of this error should be 3000
ERROR: 0:3002: '' : syntax error
ERROR: 76 compilation errors. No code generated.
Shader version: 100

View File

@ -1,6 +1,7 @@
150.vert
ERROR: 0:22: 'a' : cannot redeclare a user-block member array
ERROR: 1 compilation errors. No code generated.
ERROR: 0:3001: '#error' : line of this error should be 3001
ERROR: 2 compilation errors. No code generated.
Shader version: 150

View File

@ -33,8 +33,9 @@ ERROR: 0:144: 'preprocessor evaluation' : undefined macro in expression not allo
ERROR: 0:153: 'preprocessor evaluation' : undefined macro in expression not allowed in es profile UNDEF
ERROR: 0:156: 'preprocessor evaluation' : undefined macro in expression not allowed in es profile UNDEF2
ERROR: 0:159: 'preprocessor evaluation' : undefined macro in expression not allowed in es profile UNDEF2
ERROR: 0:10002: '' : missing #endif
ERROR: 35 compilation errors. No code generated.
ERROR: 0:3000: '#error' : line of this error should be 3000
ERROR: 0:10001: '' : missing #endif
ERROR: 36 compilation errors. No code generated.
Shader version: 300

View File

@ -61,28 +61,28 @@ ERROR: 0:235: 'line continuation' : not supported for this version or the enable
ERROR: 0:236: '#error' : good continuation
ERROR: 0:238: '#' : invalid directive: flizbit
ERROR: 0:242: '#' : invalid directive: directive
ERROR: 0:12001: '#error' : line should be 12001
ERROR: 7:13001: '#error' : line should be 13001 , string 7
ERROR: 7:14014: '#error' : line should be 14014 , string 7
ERROR: 12:14014: '#error' : line should be 14014 , string 12
ERROR: 12:14026: '#error' : line should be 14026 , string 12
ERROR: 12:1234: '#line' : unexpected tokens following directive
ERROR: 12:1237: '#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:20052: '#error' : good evaluation 1
ERROR: 12:20056: '#error' : good evaluation 2
ERROR: 12:9001: 'preprocessor evaluation' : expected ')'
ERROR: 12:9003: '#if' : unexpected tokens following directive
ERROR: 0:12000: '#error' : line should be 12000
ERROR: 7:13000: '#error' : line should be 13000 , string 7
ERROR: 7:14013: '#error' : line should be 14013 , string 7
ERROR: 12:14013: '#error' : line should be 14013 , string 12
ERROR: 12:14025: '#error' : line should be 14025 , string 12
ERROR: 12:1233: '#line' : unexpected tokens following directive
ERROR: 12:1236: '#line' : unexpected tokens following directive
ERROR: 12:20000: '#error' : line should be 20000
ERROR: 12:20010: '#error' : line should be 20010
ERROR: 12:20020: '#error' : line should be 20020
ERROR: 12:20045: '#define' : Macro redefined; different substitutions: SPACE_IN_MIDDLE
ERROR: 12:20051: '#error' : good evaluation 1
ERROR: 12:20055: '#error' : good evaluation 2
ERROR: 12:9000: 'preprocessor evaluation' : expected ')'
ERROR: 12:9002: '#if' : unexpected tokens following directive
ERROR: 12:9014: 'macro expansion' : expected '(' following FOOOM
ERROR: 12:9014: 'FOOOM' : undeclared identifier
ERROR: 12:9014: '=' : cannot convert from 'float' to 'int'
ERROR: 12:9015: 'macro expansion' : expected '(' following FOOOM
ERROR: 12:9015: 'FOOOM' : undeclared identifier
ERROR: 12:9015: '=' : cannot convert from 'float' to 'int'
ERROR: 12:9016: 'macro expansion' : expected '(' following FOOOM
ERROR: 12:9017: 'preprocessor evaluation' : can't evaluate expression
ERROR: 12:9017: 'preprocessor evaluation' : bad expression
ERROR: 12:10003: '' : missing #endif
ERROR: 12:9016: 'preprocessor evaluation' : can't evaluate expression
ERROR: 12:9016: 'preprocessor evaluation' : bad expression
ERROR: 12:10002: '' : missing #endif
ERROR: 79 compilation errors. No code generated.
@ -161,23 +161,23 @@ 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@0' (out block{gl_Position 4-component vector of float gl_Position, gl_PointSize float gl_PointSize, out implicitly-sized array of float gl_ClipDistance, gl_ClipVertex 4-component vector of float gl_ClipVertex, out 4-component vector of float gl_FrontColor, out 4-component vector of float gl_BackColor, out 4-component vector of float gl_FrontSecondaryColor, out 4-component vector of float gl_BackSecondaryColor, out implicitly-sized array of 4-component vector of float gl_TexCoord, out float 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
12:9012 Sequence
12:9012 move second child to first child (int)
12:9012 'R1' (int)
12:9012 'RECURSE' (int)
12:20031 Function Definition: foo234( (void)
12:20031 Function Parameters:
12:20033 Sequence
12:20033 move second child to first child (4-component vector of float)
12:20033 gl_Position: direct index for structure (gl_Position 4-component vector of float)
12:20033 'anon@0' (out block{gl_Position 4-component vector of float gl_Position, gl_PointSize float gl_PointSize, out implicitly-sized array of float gl_ClipDistance, gl_ClipVertex 4-component vector of float gl_ClipVertex, out 4-component vector of float gl_FrontColor, out 4-component vector of float gl_BackColor, out 4-component vector of float gl_FrontSecondaryColor, out 4-component vector of float gl_BackSecondaryColor, out implicitly-sized array of 4-component vector of float gl_TexCoord, out float gl_FogFragCoord})
12:20033 Constant:
12:20033 0 (const uint)
12:20033 Constant:
12:20033 6.000000
12:20033 6.000000
12:20033 6.000000
12:20033 6.000000
12:9011 Sequence
12:9011 move second child to first child (int)
12:9011 'R1' (int)
12:9011 'RECURSE' (int)
0:? Linker Objects
0:? 'sum' (float)
0:? 'anon@0' (out block{gl_Position 4-component vector of float gl_Position, gl_PointSize float gl_PointSize, out implicitly-sized array of float gl_ClipDistance, gl_ClipVertex 4-component vector of float gl_ClipVertex, out 4-component vector of float gl_FrontColor, out 4-component vector of float gl_BackColor, out 4-component vector of float gl_FrontSecondaryColor, out 4-component vector of float gl_BackSecondaryColor, out implicitly-sized array of 4-component vector of float gl_TexCoord, out float gl_FogFragCoord})
@ -273,23 +273,23 @@ 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@0' (out block{gl_Position 4-component vector of float gl_Position, gl_PointSize float gl_PointSize, out 1-element array of float gl_ClipDistance, gl_ClipVertex 4-component vector of float gl_ClipVertex, out 4-component vector of float gl_FrontColor, out 4-component vector of float gl_BackColor, out 4-component vector of float gl_FrontSecondaryColor, out 4-component vector of float gl_BackSecondaryColor, out 1-element array of 4-component vector of float gl_TexCoord, out float 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
12:9012 Sequence
12:9012 move second child to first child (int)
12:9012 'R1' (int)
12:9012 'RECURSE' (int)
12:20031 Function Definition: foo234( (void)
12:20031 Function Parameters:
12:20033 Sequence
12:20033 move second child to first child (4-component vector of float)
12:20033 gl_Position: direct index for structure (gl_Position 4-component vector of float)
12:20033 'anon@0' (out block{gl_Position 4-component vector of float gl_Position, gl_PointSize float gl_PointSize, out 1-element array of float gl_ClipDistance, gl_ClipVertex 4-component vector of float gl_ClipVertex, out 4-component vector of float gl_FrontColor, out 4-component vector of float gl_BackColor, out 4-component vector of float gl_FrontSecondaryColor, out 4-component vector of float gl_BackSecondaryColor, out 1-element array of 4-component vector of float gl_TexCoord, out float gl_FogFragCoord})
12:20033 Constant:
12:20033 0 (const uint)
12:20033 Constant:
12:20033 6.000000
12:20033 6.000000
12:20033 6.000000
12:20033 6.000000
12:9011 Sequence
12:9011 move second child to first child (int)
12:9011 'R1' (int)
12:9011 'RECURSE' (int)
0:? Linker Objects
0:? 'sum' (float)
0:? 'anon@0' (out block{gl_Position 4-component vector of float gl_Position, gl_PointSize float gl_PointSize, out 1-element array of float gl_ClipDistance, gl_ClipVertex 4-component vector of float gl_ClipVertex, out 4-component vector of float gl_FrontColor, out 4-component vector of float gl_BackColor, out 4-component vector of float gl_FrontSecondaryColor, out 4-component vector of float gl_BackSecondaryColor, out 1-element array of 4-component vector of float gl_TexCoord, out float gl_FogFragCoord})

View File

@ -159,6 +159,9 @@ float c = foobar(1.1, 2.2
#if (VAL0 && UNDEF) || UNDEF2 // UNDEF2 ERROR
#endif
#line 3000
#error line of this error should be 3000
#line 10000
#if 0
// ERROR, EOF

View File

@ -242,19 +242,19 @@ double f = f1;
#directive directive was expanded
#line 12000
#error line should be 12001
#error line should be 12000
#line 13000 7
#error line should be 13001, string 7
#error line should be 13000, string 7
#define L1 14000
#define L2 13
#define F1 5
#define F2 7
#line L1 + L2
#error line should be 14014, string 7
#error line should be 14013, string 7
#line L1 + L2 F1 + F2 // antoeuh sat comment
#error line should be 14014, string 12
#error line should be 14013, string 12
#line L1 + L2 + F1 + F2
#error line should be 14026, string 12
#error line should be 14025, string 12
#line 1234 F1 + F2 extra
#define empty_extra
#line 1235 F1 + F2 empty_extra
@ -264,11 +264,11 @@ double f = f1;
#line 1238 F1 + F2 moreEmpty empty_extra
#line 1239 empty_extra F1 empty_extra + empty_extra F2 empty_extra moreEmpty empty_extra
#line (20000)
#error line should be 20001
#error line should be 20000
#line (20000+10)
#error line should be 20011
#error line should be 20010
#line +20020
#error line should be 20021
#error line should be 20020
#define VAL1 1.0
#define VAL2 2.0

View File

@ -635,7 +635,18 @@ int TPpContext::CPPline(TPpToken* ppToken)
if (! lineErr) {
if (token == '\n')
++lineRes;
// Desktop, pre-version 3.30: "After processing this directive
// (including its new-line), the implementation will behave as if it is compiling at line number line+1 and
// source string number source-string-number."
//
// Desktop, version 3.30 and later, and ES: "After processing this directive
// (including its new-line), the implementation will behave as if it is compiling at line number line and
// source string number source-string-number.
if (parseContext.profile == EEsProfile || parseContext.version >= 330)
--lineRes;
parseContext.setCurrentLine(lineRes);
if (token != '\n') {
int fileRes = 0;
bool fileErr = false;