sim: cgen: workaround Windows VOID define

Message ID
State New
Headers show
  • sim: cgen: workaround Windows VOID define
Related show

Commit Message

Tom de Vries via Gdb-patches Sept. 9, 2021, 5:23 a.m.
The cgen framework provides a "VOID" type for code to use, but this
defines ends up conflicting with the standard Windows VOID define.
Since they actually define to the same thing ("void"), undef it here
to fix the Windows build.

We might want to reconsider the need for "VOID" in cgen, but that
will take larger discussion & coordination with the cgen project.
 sim/common/cgen-types.h | 2 ++
 1 file changed, 2 insertions(+)



diff --git a/sim/common/cgen-types.h b/sim/common/cgen-types.h
index cb71b6bdda12..059f31a8b1b6 100644
--- a/sim/common/cgen-types.h
+++ b/sim/common/cgen-types.h
@@ -57,6 +57,8 @@  typedef enum mode_type {
 extern const char * const cgen_mode_names[];
 #define MODE_NAME(m) (cgen_mode_names[m])
+/* Some system headers define VOID already, so undo it.  */
+#undef VOID
 typedef void VOID;
 typedef unsigned char BI;
 typedef signed8 QI;