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/glsl_parser_extras.cpp | |
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/glsl_parser_extras.cpp')
-rw-r--r-- | src/compiler/glsl/glsl_parser_extras.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index 2a58908c226..21ed34d79d0 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -62,7 +62,7 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx, gl_shader_stage stage, void *mem_ctx) : ctx(_ctx), cs_input_local_size_specified(false), cs_input_local_size(), - switch_state() + switch_state(), warnings_enabled(true) { assert(stage < MESA_SHADER_STAGES); this->stage = stage; @@ -527,11 +527,13 @@ void _mesa_glsl_warning(const YYLTYPE *locp, _mesa_glsl_parse_state *state, const char *fmt, ...) { - va_list ap; + if (state->warnings_enabled) { + va_list ap; - va_start(ap, fmt); - _mesa_glsl_msg(locp, state, MESA_DEBUG_TYPE_OTHER, fmt, ap); - va_end(ap); + va_start(ap, fmt); + _mesa_glsl_msg(locp, state, MESA_DEBUG_TYPE_OTHER, fmt, ap); + va_end(ap); + } } |