Preprocessor: Add short-circuit logic so ES errors are not given on undefined variables that are short circuited in && and || preprocessing expressions.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24390 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich
2013-12-06 18:19:22 +00:00
parent e28beee891
commit 7fc3669195
5 changed files with 117 additions and 38 deletions

View File

@@ -11,11 +11,22 @@ ERROR: 0:94: 'macro expansion' : unexpected '#' foobar
ERROR: 0:95: 'preprocessor evaluation' : bad expression
ERROR: 0:100: 'preprocessor evaluation' : bad expression
ERROR: 0:100: '#if' : unexpected tokens following directive
ERROR: 0:103: 'macro expansion' : unexpected '#' foobar
ERROR: 0:103: 'preprocessor evaluation' : undefined macro in expression
ERROR: 0:103: '#if' : unexpected tokens following directive
ERROR: 0:104: '' : missing #endif
ERROR: 16 compilation errors. No code generated.
ERROR: 0:102: 'macro expansion' : unexpected '#' foobar
ERROR: 0:102: 'preprocessor evaluation' : undefined macro in expression not allowed in es profile endif
ERROR: 0:108: 'preprocessor evaluation' : undefined macro in expression not allowed in es profile UNDEF
ERROR: 0:111: '#error' : good 0
ERROR: 0:115: '#error' : good 1
ERROR: 0:120: 'preprocessor evaluation' : undefined macro in expression not allowed in es profile UNDEF
ERROR: 0:123: 'preprocessor evaluation' : undefined macro in expression not allowed in es profile UNDEF
ERROR: 0:129: '#error' : good 1
ERROR: 0:133: '#error' : good 3
ERROR: 0:139: '#error' : good 4
ERROR: 0:144: 'preprocessor evaluation' : undefined macro in expression not allowed in es profile UNDEF
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: 27 compilation errors. No code generated.
ERROR: node is still EOpNull!

View File

@@ -99,6 +99,66 @@ float c = foobar(1.1, 2.2
#if foobar(1.1, 2.2
)
#if foobar(1.1, 2.2
#endif
#endif
#define VAL0 0
#define VAL1 1
#if UNDEF
#error bad 0
#else
#error good 0
#endif
#if VAL1 || UNDEF
#error good 1
#else
#error bad 1
#endif
#if VAL1 && UNDEF // UNDEF ERROR
#endif
#if VAL0 || UNDEF // UNDEF ERROR
#endif
#if VAL0 && UNDEF
#error bad 2
#else
#error good 1
#endif
#if VAL1 || (VAL1 && UNDEF)
#error good 3
#else
#error bad 3
#endif
#if VAL1 && (VAL1 || UNDEF)
#error good 4
#else
#error bad 4
#endif
#if VAL1 < VAL1 || VAL1 > VAL1 || UNDEF // UNDEF ERROR
#endif
#if VAL1 < VAL1 || VAL1 > VAL1 && UNDEF
#endif
#if VAL1 || UNDEF && UNDEF2
#endif
#if VAL0 || UNDEF && UNDEF2 // UNDEF ERROR
#endif
#if (VAL1 || UNDEF) && UNDEF2 // UNDEF2 ERROR
#endif
#if (VAL0 && UNDEF) || UNDEF2 // UNDEF2 ERROR
#endif
#line 10000
#if 0
// ERROR, EOF