Repository navigation
Fix recursive GLSL macro rescanning - #3751
Merged
Merged
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2635.
The supplementary preprocessor currently forgets which macro occurrences were disabled during an earlier expansion. Rescanning
#define foo bar foothrough an alias therefore expands the trailingfoorepeatedly.Carry disabled-macro ranges with tokens through rescans and argument substitution, so recursive occurrences stay suppressed while separate invocations still expand. Preserve the existing argument/directive rescan and borrowed-buffer handling. Evaluate expanded conditional-expression text with the same metadata so a suppressed identifier has the usual value of zero.
Add ten regression tests for the reported alias, repeated expansions, mutual recursion, function wrappers, recursive arguments, higher-order arguments and conditional expressions. Four passing controls cover argument-name isolation, concatenation, repeated allocated arguments, and strings/comments. On the unchanged base, each regression exceeds a three-second external timeout; all existing tests and new controls pass.
Validation on Linux / GCC 12:
Test_Ogre: 186 passed, 2 skipped.glslangValidator -S vertaccepts four shaders using the realOgreUnifiedShader.handGLSL_GL3Support.glsl: GLSL 330 and GLES 300, each withFOOdefined as0or undefined.git diff --checkpasses.The native CMake build enables tests and sample resource configuration; tools, language bindings, ImGui and the GLES2 render-system build are disabled. Windows/macOS and GPU visual tests were not run locally.
Related draft #1314 changes extension-conditional passthrough for #614 and shares these three files. At its unchanged head
f77b471, its hunks in all three shared files apply cleanly to both the audited base and this candidate. Its goal and production methods differ; compatibility needs rechecking if it changes or lands.