summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/glsl_to_nir.cpp
diff options
context:
space:
mode:
authorJose Fonseca <[email protected]>2016-04-28 12:25:15 +0100
committerJose Fonseca <[email protected]>2016-04-28 16:48:13 +0100
commit99474dc29b0f45413d0e538d7321da9ad4c9f6f5 (patch)
treed3053fc83203559dd5bdfc40bcc0cd7b77018333 /src/compiler/nir/glsl_to_nir.cpp
parente7438009afe5d0372fa1c89c2d3407234662521b (diff)
nir: Try to warn when C99 extensions are used in nir headers.
Ideally we'd have nir.h being included with -Wpedantic too, but it fails with: src/compiler/nir/nir.h:754:20: warning: ISO C++ forbids zero-size array ‘src’ [-Wpedantic] nir_alu_src src[]; ^ In file included from src/compiler/nir/glsl_to_nir.cpp:42:0: src/compiler/nir/nir.h:919:16: warning: ISO C++ forbids zero-size array ‘src’ [-Wpedantic] nir_src src[]; Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/compiler/nir/glsl_to_nir.cpp')
-rw-r--r--src/compiler/nir/glsl_to_nir.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/compiler/nir/glsl_to_nir.cpp b/src/compiler/nir/glsl_to_nir.cpp
index e3fa623ba04..c8954ceeeb1 100644
--- a/src/compiler/nir/glsl_to_nir.cpp
+++ b/src/compiler/nir/glsl_to_nir.cpp
@@ -25,9 +25,30 @@
*
*/
-#include "glsl_to_nir.h"
+#include "nir.h"
+
+/*
+ * Have GCC/Clang warn when NIR headers use C99 extensions that are not
+ * supported in C++, as they are not portable. In particular MSVC does not
+ * support C99 structure field initializers.
+ */
+#if defined(__GNUC__)
+# pragma GCC diagnostic push
+# if defined(__clang__)
+# pragma GCC diagnostic warning "-Wc99-extensions"
+# else
+# pragma GCC diagnostic warning "-Wpedantic"
+# endif
+#endif
+
#include "nir_control_flow.h"
#include "nir_builder.h"
+
+#if defined(__GNUC__)
+# pragma GCC diagnostic pop
+#endif
+
+#include "glsl_to_nir.h"
#include "compiler/glsl/ir_visitor.h"
#include "compiler/glsl/ir_hierarchical_visitor.h"
#include "compiler/glsl/ir.h"