From ae760389ae4c3b7f71e2f205d43c4ba97eb54785 Mon Sep 17 00:00:00 2001 From: sezero Date: Sat, 4 Aug 2018 17:14:20 +0300 Subject: [PATCH] glide2x/h3 (linhwc.c/minihwc.c): fix fenceVar with newer gcc versions. from glide3x tree. --- glide2x/h3/minihwc/linhwc.c | 10 +++++++++- glide2x/h3/minihwc/minihwc.c | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/glide2x/h3/minihwc/linhwc.c b/glide2x/h3/minihwc/linhwc.c index 8193999..75242c9 100644 --- a/glide2x/h3/minihwc/linhwc.c +++ b/glide2x/h3/minihwc/linhwc.c @@ -63,7 +63,15 @@ hwcCheckMemSize(hwcBoardInfo *bInfo, FxU32 xres, FxU32 yres, FxU32 nColBuffers, #include #include -static FxU32 fenceVar; +#if defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))) +# define __attribute_used __attribute__((__used__)) +#elif defined(__GNUC__) && (__GNUC__ >= 2) +# define __attribute_used __attribute__((__unused__)) +#else +# define __attribute_used +#endif + +static FxU32 __attribute_used fenceVar; #define P6FENCE asm("xchg %%eax, %0" : : "m" (fenceVar) : "eax"); #define MAXFIFOSIZE 0x40000 diff --git a/glide2x/h3/minihwc/minihwc.c b/glide2x/h3/minihwc/minihwc.c index 007b137..08cc06d 100644 --- a/glide2x/h3/minihwc/minihwc.c +++ b/glide2x/h3/minihwc/minihwc.c @@ -441,10 +441,18 @@ #define MAXFIFOSIZE 0x40000 +#if defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))) +# define __attribute_used __attribute__((__used__)) +#elif defined(__GNUC__) && (__GNUC__ >= 2) +# define __attribute_used __attribute__((__unused__)) +#else +# define __attribute_used +#endif + static hwcInfo hInfo; static char errorString[1024]; static int num_monitor = 0; -static FxU32 fenceVar; +static FxU32 __attribute_used fenceVar; #if defined(__WATCOMC__)