diff options
author | Ian Romanick <[email protected]> | 2018-11-01 13:50:14 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2018-11-08 11:00:00 -0800 |
commit | c5a4c264508d3b36663779b89ec0dbaf7653df96 (patch) | |
tree | 0e27e48dc1617316c2312a271963ff36bc0befe4 /src/compiler/glsl/tests | |
parent | 011abfc963a734953a0edd9c7a4fa01570627050 (diff) |
glsl: Add pragma to disable all warnings
Use #pragma warning(off) and #pragma warning(on) to disable or enable
all warnings. This is a big hammer. If we ever need a smaller hammer,
we can enhance this functionality.
There is one lame thing about this. Because we parse everything, create
an AST, then convert the AST to GLSL IR, we have to treat the #pragma
like a statment. This means that you can't do something like
' void
' #pragma warning(off)
' __foo
' #pragma warning(on)
' (float param0);
Fixing that would, as far as I can tell, require a huge amount of work.
I did try just handling the #pragma during parsing (like we do for
state for the whole shader.
v2: Fix the #pragma lines in the commit message that git-commit ate.
Signed-off-by: Ian Romanick <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/compiler/glsl/tests')
-rw-r--r-- | src/compiler/glsl/tests/warnings/032-__-in-function-name-pragma-disable.vert | 24 | ||||
-rw-r--r-- | src/compiler/glsl/tests/warnings/032-__-in-function-name-pragma-disable.vert.expected | 2 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/compiler/glsl/tests/warnings/032-__-in-function-name-pragma-disable.vert b/src/compiler/glsl/tests/warnings/032-__-in-function-name-pragma-disable.vert new file mode 100644 index 00000000000..d0d8d915a40 --- /dev/null +++ b/src/compiler/glsl/tests/warnings/032-__-in-function-name-pragma-disable.vert @@ -0,0 +1,24 @@ +#version 130 + +float __foo(float x) +{ + return 6.0 * x; +} + +#pragma warning(off) +float __bar(float x) +{ + return 3.0 * x; +} +#pragma warning(on) + +float __blat(float x) +{ + return 2.0 * x; +} + +void main() +{ + gl_Position = vec4(__foo(gl_Vertex.x), __bar(gl_Vertex.y), __blat(gl_Vertex.z), 1.0); +} + diff --git a/src/compiler/glsl/tests/warnings/032-__-in-function-name-pragma-disable.vert.expected b/src/compiler/glsl/tests/warnings/032-__-in-function-name-pragma-disable.vert.expected new file mode 100644 index 00000000000..4b490a9c879 --- /dev/null +++ b/src/compiler/glsl/tests/warnings/032-__-in-function-name-pragma-disable.vert.expected @@ -0,0 +1,2 @@ +0:3(7): warning: identifier `__foo' uses reserved `__' string +0:15(7): warning: identifier `__blat' uses reserved `__' string |