[Mesa-dev] [PATCH 3/3] glsl: #undef THIS macro to fix MSVC build

Charmaine Lee charmainel at vmware.com
Fri Apr 13 16:07:01 UTC 2018


For the series, Reviewed-by: Charmaine Lee <charmainel at vmware.com>

________________________________________
From: Brian Paul <brianp at vmware.com>
Sent: Friday, April 13, 2018 9:03:41 AM
To: mesa-dev at lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH 3/3] glsl: #undef THIS macro to fix MSVC build

THIS is a macro in one of the MSVC header files.  It's also a token
in the GLSL lexer.  This causes a compilation failure with MSVC.
This issue seems to be newly exposed after the recent mtypes.h removal
patches.
---
 src/compiler/glsl/glsl_parser_extras.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/compiler/glsl/glsl_parser_extras.h b/src/compiler/glsl/glsl_parser_extras.h
index 66bd1a3..5b9b6cc 100644
--- a/src/compiler/glsl/glsl_parser_extras.h
+++ b/src/compiler/glsl/glsl_parser_extras.h
@@ -33,6 +33,11 @@
 #include <stdlib.h>
 #include "glsl_symbol_table.h"

+/* THIS is a macro defined somewhere deep in the Windows MSVC header files.
+ * Undefine it here to avoid collision with the lexer's THIS token.
+ */
+#undef THIS
+
 struct gl_context;

 struct glsl_switch_state {
--
2.7.4



More information about the mesa-dev mailing list