From c5a4c264508d3b36663779b89ec0dbaf7653df96 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 1 Nov 2018 13:50:14 -0700 Subject: 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 Reviewed-by: Matt Turner --- src/compiler/glsl/glsl_parser_extras.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/compiler/glsl/glsl_parser_extras.h') diff --git a/src/compiler/glsl/glsl_parser_extras.h b/src/compiler/glsl/glsl_parser_extras.h index 985200ecab5..da8b2fa3ab5 100644 --- a/src/compiler/glsl/glsl_parser_extras.h +++ b/src/compiler/glsl/glsl_parser_extras.h @@ -614,6 +614,13 @@ struct _mesa_glsl_parse_state { char *info_log; + /** + * Are warnings enabled? + * + * Emission of warngins is controlled by '#pragma warning(...)'. + */ + bool warnings_enabled; + /** * \name Enable bits for GLSL extensions */ -- cgit v1.2.3