Preprocessor: Implement skipping of macros that evaluate to nothing while evaluating expressions. They had been causing early termination of an expression's evaluation.

Also includes some unrelated updates of documentation.


git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24420 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich
2013-12-10 00:25:14 +00:00
parent c719481d43
commit 2d2f31625d
10 changed files with 120 additions and 50 deletions

View File

@@ -67,12 +67,15 @@ 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:10003: '' : missing #endif
ERROR: 72 compilation errors. No code generated.
ERROR: 75 compilation errors. No code generated.
ERROR: node is still EOpNull!

View File

@@ -251,11 +251,18 @@ double f = f1;
#define F2 7
#line L1 + L2
#error line should be 14014, string 7
#line L1 + L2 F1 + F2
#line L1 + L2 F1 + F2 // antoeuh sat comment
#error line should be 14014, string 12
#line L1 + L2 + F1 + F2
#error line should be 14026, string 12
#line 1234 F1 + F2 extra
#define empty_extra
#line 1235 F1 + F2 empty_extra
#define moreEmpty empty_extra
#line 1236 F1 + F2 moreEmpty empty_extra // okay, lots of nothin
#line 1237 F1 + F2 moreEmpty empty_extra extra // ERROR, 'extra'
#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
#line (20000+10)
@@ -288,6 +295,17 @@ void foo234()
#define SPACE_IN_MIDDLE(a,b) space +in middle
#define SPACE_IN_MIDDLE(a,b) space + in middle
#define FIRSTPART 17
#define SECONDPART + 5
#if FIRSTPART SECONDPART == 22
#error good evaluation 1
#endif
#if moreEmpty FIRSTPART moreEmpty SECONDPART moreEmpty == moreEmpty 22 moreEmpty
#error good evaluation 2
#endif
#line 10000
#if 1
#else