[Mesa-dev] [PATCH] mesa/st/st_glsl_to_tgsi_temprename.cpp: Fix compilation with MSVC
Gert Wollny
gw.fossdev at gmail.com
Wed Sep 6 12:21:25 UTC 2017
If <windows.h> is included then max is a macro that clashes
with std::numeric_limits::max, hence undefine it.
For some reason the struct access_record is not recognizes
outside the anonymouse namespace, make it a class.
The patch successfully was tested on AppVeyor.
---
src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp
index d984184e70..00ec7e749b 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp
@@ -43,6 +43,13 @@ using std::cerr;
using std::setw;
#endif
+/* If <windows.h> is included this is defined and clashes with
+ * std::numeric_limits<>::max()
+ */
+#ifdef max
+#undef max
+#endif
+
using std::numeric_limits;
/* Without c++11 define the nullptr for forward-compatibility
@@ -592,7 +599,8 @@ lifetime temp_comp_access::get_required_lifetime()
/* Helper class for sorting and searching the registers based
* on life times. */
-struct access_record {
+class access_record {
+public:
int begin;
int end;
int reg;
--
2.13.5
More information about the mesa-dev
mailing list