forked from KhronosGroup/glslang
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PP: Don't report certain error about '#' when #if'd out
Don't report the following error when scanning inactive code (e.g. code inside #if 0): "error: '#' : (#) can be preceded in its line only by spaces or horizontal tab" Adds a variable to PpContext to say whether we're currently skipping over an inactive #if/#ifdef/#elif/#else, and don't report the error inside scanToken if true. fixes 3704
- Loading branch information
1 parent
45f2b11
commit 9cd7ca2
Showing
7 changed files
with
68 additions
and
4 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#version 460 | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
void main() | ||
{ | ||
gl_Position = vec4(1.0); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#version 460 | ||
|
||
// This tests that the preprocessor error | ||
// "error: '#' : (#) can be preceded in its line only by spaces or horizontal tab" | ||
// isn't enforced when inactive (e.g. inside #if 0) | ||
|
||
#if 0 | ||
#define STRINGIFY(X) #X | ||
#endif | ||
|
||
#define C 0 | ||
|
||
#if 1 | ||
#ifdef A | ||
#elif defined B | ||
#elif C | ||
// OK, since preprocessor evaluates to inactive | ||
#define STRINGIFY(X) #X | ||
#endif | ||
#endif | ||
|
||
// OK in comments | ||
// #define STRINGIFY(X) #X | ||
|
||
void main() | ||
{ | ||
gl_Position = vec4(1.0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters