KhronosGroup / glslang

Khronos-reference front end for GLSL/ESSL, partial front end for HLSL, and a SPIR-V generator.
Other
2.9k stars 816 forks source link

Conditional compilation is not handled correctly #3582

Open TheMostDiligent opened 2 months ago

TheMostDiligent commented 2 months ago

Compiling the following shader:

#version 430 core

void main()
{
#if 0
#   define MACROS(S) #S
#endif
}

fails with the following error :

ERROR: 0:6: '#' : (#) can be preceded in its line only by spaces or horizontal tabs 
ERROR: 0:7: '' : missing #endif 
ERROR: 0:7: '' : compilation terminated 
ERROR: 3 compilation errors.  No code generated.

This is a regression that was introduced by https://github.com/KhronosGroup/glslang/commit/feb54379427093dca566cbea996e7a57b80d73eb