diff --git a/Test/baseResults/cppSimple.vert.out b/Test/baseResults/cppSimple.vert.out index f28e1730..a8cd543e 100644 --- a/Test/baseResults/cppSimple.vert.out +++ b/Test/baseResults/cppSimple.vert.out @@ -82,8 +82,17 @@ ERROR: 12:9014: '=' : cannot convert from 'temp float' to 'global int' ERROR: 12:9015: 'macro expansion' : expected '(' following FOOOM ERROR: 12:9016: 'preprocessor evaluation' : can't evaluate expression ERROR: 12:9016: 'preprocessor evaluation' : bad expression +ERROR: 12:9500: 'preprocessor evaluation' : bad expression +ERROR: 12:9500: '#if' : unexpected tokens following directive +ERROR: 12:9502: 'preprocessor evaluation' : bad expression +ERROR: 12:9502: '#if' : unexpected tokens following directive +ERROR: 12:9504: 'preprocessor evaluation' : bad expression +ERROR: 12:9504: '#if' : unexpected tokens following directive +ERROR: 12:9506: '#error' : \ 377 +ERROR: 12:9507: '#error' : \ 376 +ERROR: 12:9508: '#error' : \ 377 ERROR: 12:10002: '' : missing #endif -ERROR: 79 compilation errors. No code generated. +ERROR: 88 compilation errors. No code generated. Shader version: 400 diff --git a/Test/cppSimple.vert b/Test/cppSimple.vert index 52d3cf77..198203a6 100644 --- a/Test/cppSimple.vert +++ b/Test/cppSimple.vert @@ -326,6 +326,17 @@ int aoeua = FOOOM; #if FOOOM #endif +#line 9500 +#if\376 +#endif +#if \376 +#endif +#if \377 +#endif +#error\377 +#error \ 376 +#error \377 + #line 10000 #if 1 #else diff --git a/glslang/MachineIndependent/preprocessor/Pp.cpp b/glslang/MachineIndependent/preprocessor/Pp.cpp index 80f9d683..39684621 100644 --- a/glslang/MachineIndependent/preprocessor/Pp.cpp +++ b/glslang/MachineIndependent/preprocessor/Pp.cpp @@ -462,8 +462,8 @@ int TPpContext::eval(int token, int precedence, bool shortCircuit, int& res, boo token = scanToken(ppToken); } } else { - int op; - for (op = NUM_ELEMENTS(unop) - 1; op >= 0; op--) { + int op = NUM_ELEMENTS(unop) - 1; + for (; op >= 0; op--) { if (unop[op].token == token) break; } diff --git a/glslang/MachineIndependent/preprocessor/PpAtom.cpp b/glslang/MachineIndependent/preprocessor/PpAtom.cpp index 58f65152..1ce3f495 100644 --- a/glslang/MachineIndependent/preprocessor/PpAtom.cpp +++ b/glslang/MachineIndependent/preprocessor/PpAtom.cpp @@ -175,7 +175,7 @@ void TPpContext::AddAtomFixed(const char* s, int atom) void TPpContext::InitAtomTable() { // Add single character tokens to the atom table: - const char* s = "~!%^&*()-+=|,.<>/?;:[]{}#"; + const char* s = "~!%^&*()-+=|,.<>/?;:[]{}#\\"; char t[2]; t[1] = '\0';