From c4c154d18ef42dc550f2675a9ee88e07b1ca6bed Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Thu, 7 Nov 2013 21:05:33 -0800 Subject: [PATCH] Avoid conflicts with Solaris defines that clash with our names When building on Solaris with _XOPEN_SOURCE set to a recent XPG release, and other core headers start including , which has a bunch of unfortunately named macros such as "CS", "ES", etc. for x86 & x64 registers which clash with existing variable & struct member names in Xorg - so #undef these so they don't interfere with our use. (Yes, have filed a bug against the system headers for exposing these, but this solves the problem for building on existing releases.) Signed-off-by: Alan Coopersmith Reviewed-by: Adam Jackson --- hw/xfree86/x86emu/decode.c | 10 ++++++++++ hw/xfree86/x86emu/x86emu/regs.h | 9 +++++++++ hw/xfree86/x86emu/x86emu/x86emui.h | 12 +++++++++++- record/record.c | 4 ++++ 4 files changed, 34 insertions(+), 1 deletion(-) diff --git a/hw/xfree86/x86emu/decode.c b/hw/xfree86/x86emu/decode.c index 12f8fb84b..08a07b1bb 100644 --- a/hw/xfree86/x86emu/decode.c +++ b/hw/xfree86/x86emu/decode.c @@ -38,6 +38,16 @@ ****************************************************************************/ #include + +#if defined(__sun) && defined(CS) /* avoid conflicts with Solaris sys/regset.h */ +# undef CS +# undef DS +# undef SS +# undef ES +# undef FS +# undef GS +#endif + #include "x86emu/x86emui.h" /*----------------------------- Implementation ----------------------------*/ diff --git a/hw/xfree86/x86emu/x86emu/regs.h b/hw/xfree86/x86emu/x86emu/regs.h index 6bd061166..2ecafa047 100644 --- a/hw/xfree86/x86emu/x86emu/regs.h +++ b/hw/xfree86/x86emu/x86emu/regs.h @@ -112,6 +112,15 @@ struct i386_special_regs { * CS, DS, ES, SS. */ +#if defined(__sun) && defined(CS) /* avoid conflicts with Solaris sys/regset.h */ +# undef CS +# undef DS +# undef SS +# undef ES +# undef FS +# undef GS +#endif + struct i386_segment_regs { u16 CS, DS, SS, ES, FS, GS; }; diff --git a/hw/xfree86/x86emu/x86emu/x86emui.h b/hw/xfree86/x86emu/x86emu/x86emui.h index f11dc102f..5e20d9705 100644 --- a/hw/xfree86/x86emu/x86emu/x86emui.h +++ b/hw/xfree86/x86emu/x86emu/x86emui.h @@ -73,7 +73,17 @@ #include #include #include -#endif +/* avoid conflicts with Solaris sys/regset.h */ +# if defined(__sun) && defined(CS) +# undef CS +# undef DS +# undef SS +# undef ES +# undef FS +# undef GS +# endif +#endif /* NO_SYS_HEADERS */ + /*--------------------------- Inline Functions ----------------------------*/ #ifdef __cplusplus diff --git a/record/record.c b/record/record.c index f3a26a732..2c70460e8 100644 --- a/record/record.c +++ b/record/record.c @@ -1393,6 +1393,10 @@ typedef struct { short first, last; /* if for extension, major opcode interval */ } SetInfoRec, *SetInfoPtr; +#if defined(ERR) && defined(__sun) +#undef ERR /* Avoid conflict with Solaris */ +#endif + /* These constant are used to index into an array of SetInfoRec. */ enum { REQ, /* set info for requests */ REP, /* set info for replies */