[Mesa-dev] [PATCH] glsl: try again to fix PRIx64 / MinGW build problem

Brian Paul brianp at vmware.com
Fri Nov 11 15:48:51 UTC 2016


inttypes.h doesn't always define the PRIx64 macro when compiling C++
code with MinGW.  For that case, simply define PRIx64 to be "lx".
This generates a format/argument type mismatch warning.  And using
"llx" generates other warnings.  Just live with it.

https://bugs.freedesktop.org/show_bug.cgi?id=98681
---
 src/compiler/glsl/ir_builder_print_visitor.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/compiler/glsl/ir_builder_print_visitor.cpp b/src/compiler/glsl/ir_builder_print_visitor.cpp
index 529466c..9b9169c 100644
--- a/src/compiler/glsl/ir_builder_print_visitor.cpp
+++ b/src/compiler/glsl/ir_builder_print_visitor.cpp
@@ -30,6 +30,15 @@
 #include "main/macros.h"
 #include "util/hash_table.h"
 
+/* This work-around is needed for MinGW.
+ * Note that there's still a warning about the format string and argument
+ * type not agreeing.  And "llx" just generates a different warning.  Oh well.
+ */
+#ifndef PRIx64
+#define PRIx64 "lx"
+#endif
+
+
 class ir_builder_print_visitor : public ir_hierarchical_visitor {
 public:
    ir_builder_print_visitor(FILE *f);
-- 
1.9.1



More information about the mesa-dev mailing list