qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] Remove the CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE switch


From: Peter Maydell
Subject: Re: [PATCH v2] Remove the CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE switch
Date: Fri, 10 Jul 2020 14:25:28 +0100

On Fri, 10 Jul 2020 at 05:56, Thomas Huth <thuth@redhat.com> wrote:
>
> GCC supports "#pragma GCC diagnostic" since version 4.6, and
> Clang seems to support it, too, since its early versions 3.x.
> That means that our minimum required compiler versions all support
> this pragma already and we can remove the test from configure and
> all the related #ifdefs in the code.
>
> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  v2: Keep the !defined(__clang__) in coroutine-ucontext.c

If we're going to mandate "at least gcc 4.6 or clang", perhaps
we should have a sanity check for it, something like

#if !defined __clang__
# if !QEMU_GNUC_PREREQ(4, 6)
#  error QEMU requires at least GCC 4.6
# endif
#endif

(maybe also check clang version, though that is more awkward
because upstream clang and Apple's compiler set the version
number defines differently.)

We could put that in compiler.h. Checking in configure would be
more userfriendly but maybe a little more effort.
The other advantage of this check is we have effectively
some internal documentation of our current minimum
compiler requirement.

There is also some tidying up that can then be done:
several places in the code use QEMU_GNU_PREREQ() to insist
on "at least gcc 4.4" or "at least gcc 4.6", and that
ifdeffery can probably be removed (though some caution
is required as I think even modern clang may advertise
itself as gcc 4.2. In some cases __has_whatever feature
tests may be usable instead.)

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]