Signed-off-by: Taylor Simpson <tsimp...@quicinc.com> --- tests/tcg/multiarch/float_helpers.c | 13 ++++++++++++- tests/tcg/multiarch/linux-test.c | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/tests/tcg/multiarch/float_helpers.c b/tests/tcg/multiarch/float_helpers.c index 8ee7903..437247c 100644 --- a/tests/tcg/multiarch/float_helpers.c +++ b/tests/tcg/multiarch/float_helpers.c @@ -26,6 +26,17 @@ #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) +/*---------------------------------------------------------------------------- +| The macro QEMU_GNUC_PREREQ tests for minimum version of the GNU C compiler. +| The code is a copy of SOFTFLOAT_GNUC_PREREQ, see softfloat-macros.h. +*----------------------------------------------------------------------------*/ +#if defined(__GNUC__) && defined(__GNUC_MINOR__) +# define QEMU_GNUC_PREREQ(maj, min) \ + ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) +#else +# define QEMU_GNUC_PREREQ(maj, min) 0 +#endif + /* * Half Precision Numbers * @@ -79,7 +90,7 @@ char *fmt_16(uint16_t num) #ifndef SNANF /* Signaling NaN macros, if supported. */ -# if __GNUC_PREREQ(3, 3) +# if defined(__clang__) || QEMU_GNUC_PREREQ(3, 3) # define SNANF (__builtin_nansf ("")) # define SNAN (__builtin_nans ("")) # define SNANL (__builtin_nansl ("")) diff --git a/tests/tcg/multiarch/linux-test.c b/tests/tcg/multiarch/linux-test.c index 673d7c8..edfc02c 100644 --- a/tests/tcg/multiarch/linux-test.c +++ b/tests/tcg/multiarch/linux-test.c @@ -485,7 +485,7 @@ static void test_signal(void) act.sa_flags = SA_SIGINFO; chk_error(sigaction(SIGSEGV, &act, NULL)); if (setjmp(jmp_env) == 0) { - *(uint8_t *)0 = 0; + *(volatile uint8_t *)0 = 0; } act.sa_handler = SIG_DFL; -- 2.7.4