[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 01/13] compiler.h: replace QEMU_GNUC_PREREQ macro
|
From: |
Marc-André Lureau |
|
Subject: |
Re: [PATCH v2 01/13] compiler.h: replace QEMU_GNUC_PREREQ macro |
|
Date: |
Thu, 26 Nov 2020 15:55:30 +0400 |
Hi
On Thu, Nov 26, 2020 at 3:48 PM Peter Maydell <peter.maydell@linaro.org> wrote:
>
> On Thu, 26 Nov 2020 at 11:29, <marcandre.lureau@redhat.com> wrote:
> >
> > From: Marc-André Lureau <marcandre.lureau@redhat.com>
> >
> > Replace it with glib G_GNUC_CHECK_VERSION.
> >
> > Available since 2.42, the macro received a small correction in
> > 2.55.1 (glib d44afbadda8a "macros: make G_GNUC_CHECK_VERSION()
> > portable" which was apparently harmless).
> >
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> > include/qemu/atomic.h | 2 +-
> > include/qemu/compiler.h | 15 +++------------
> > scripts/cocci-macro-file.h | 1 -
> > accel/tcg/cpu-exec.c | 2 +-
> > 4 files changed, 5 insertions(+), 15 deletions(-)
> >
> > diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h
> > index c1d211a351..c409257c11 100644
> > --- a/include/qemu/atomic.h
> > +++ b/include/qemu/atomic.h
> > @@ -248,7 +248,7 @@
> > * 4.3 (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36793).
> > */
> > #if defined(__i386__) || defined(__x86_64__)
> > -#if !QEMU_GNUC_PREREQ(4, 4)
> > +#if !G_GNUC_CHECK_VERSION(4, 4)
> > #if defined __x86_64__
> > #define smp_mb() ({ asm volatile("mfence" ::: "memory"); (void)0; })
> > #else
> > diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h
> > index c76281f354..cf044bab4a 100644
> > --- a/include/qemu/compiler.h
> > +++ b/include/qemu/compiler.h
> > @@ -7,21 +7,12 @@
> > #ifndef COMPILER_H
> > #define COMPILER_H
> >
> > +#include "glib-compat.h"
>
> osdep.h already includes glib-compat.h, so if it's safe to
> include it this early we should just move that #include line
> in osdep.h up above compiler.h. But I don't think it's going
> to be quite that simple, because some parts of osdep.h
> need to happen before we include any system headers, and
> glib-compat.h includes some system headers. As it stands
> this fragment will pull in glib-compat.h too early.
>
> You probably need to rearrange osdep.h so it is
> * config-host.h
> * poison.h
> * bits that must go before any standard headers
> * pure system includes
> * glib-compat.h
> * compiler.h
> (and hopefully none of the above needed stuff set up by compiler.h !)
>
> Or if this tangle of bits depending on each other seems too
> messy, we could just leave QEMU_GNUC_PREREQ the way it is :-)
Or I just change the order the header are included in libvhost-user
(before
20201125100640.366523-1-marcandre.lureau@redhat.com/">https://patchew.org/QEMU/20201125100640.366523-1-marcandre.lureau@redhat.com/
lands), since that was the reason I didn't include osdep.h iirc.
Anyway, if the rest of the series is accepted, the include should go
away too (should have done that on top).