[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Modify tests to work with clang
From: |
Thomas Huth |
Subject: |
Re: [PATCH] Modify tests to work with clang |
Date: |
Fri, 15 Nov 2019 08:23:36 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 |
On 15/11/2019 05.38, Taylor Simpson wrote:
> Signed-off-by: Taylor Simpson <address@hidden>
> ---
> 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)
IIRC clearly, Clang reports itself as GCC 4.2, so you certainly don't
need the defined(__clang__) here.
But additionally, we require at least GCC 4.8 to compile QEMU these days
(see the check in the configure script), so you can even remove this #if
statement completely, so that the following #defines are simply always used.
Thomas