diff mbox series

[v2,12/13] compiler: remove GNUC check

Message ID 20201126112915.525285-13-marcandre.lureau@redhat.com
State New
Headers show
Series Remove GCC < 4.8 checks | expand

Commit Message

Marc-André Lureau Nov. 26, 2020, 11:29 a.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

QEMU requires Clang or GCC, that define and support __GNUC__ extensions.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 include/qemu/compiler.h | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

Comments

Peter Maydell Nov. 26, 2020, 12:10 p.m. UTC | #1
On Thu, 26 Nov 2020 at 11:30, <marcandre.lureau@redhat.com> wrote:
>
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> QEMU requires Clang or GCC, that define and support __GNUC__ extensions.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  include/qemu/compiler.h | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h
> index 108bfdb391..f492baf341 100644
> --- a/include/qemu/compiler.h
> +++ b/include/qemu/compiler.h
> @@ -55,14 +55,10 @@
>      (offsetof(container, field) + sizeof_field(container, field))
>
>  /* Convert from a base type to a parent type, with compile time checking.  */
> -#ifdef __GNUC__
>  #define DO_UPCAST(type, field, dev) ( __extension__ ( { \
>      char __attribute__((unused)) offset_must_be_zero[ \
>          -offsetof(type, field)]; \
>      container_of(dev, type, field);}))
> -#else
> -#define DO_UPCAST(type, field, dev) container_of(dev, type, field)
> -#endif

This bit looks good.

>  #define typeof_field(type, field) typeof(((type *)0)->field)
>  #define type_check(t1,t2) ((t1*)0 - (t2*)0)
> @@ -93,7 +89,7 @@
>  #if defined(__clang__)
>    /* clang doesn't support gnu_printf, so use printf. */
>  # define GCC_FMT_ATTR(n, m) __attribute__((format(printf, n, m)))
> -#elif defined(__GNUC__)
> +#else
>     /* Use gnu_printf (qemu uses standard format strings). */
>  # define GCC_FMT_ATTR(n, m) __attribute__((format(gnu_printf, n, m)))
>  # if defined(_WIN32)
> @@ -101,8 +97,6 @@
>      * even when MinGW or GLib include files use __printf__. */
>  #  define __printf__ __gnu_printf__
>  # endif
> -#else
> -#define GCC_FMT_ATTR(n, m)
>  #endif

Didn't you already change the GCC_FMT_ATTR stuff in a previous
patch in the series? If so this part should just be squashed
into that one.

thanks
-- PMM
Marc-André Lureau Nov. 26, 2020, 12:12 p.m. UTC | #2
On Thu, Nov 26, 2020 at 4:10 PM Peter Maydell <peter.maydell@linaro.org> wrote:
>
> On Thu, 26 Nov 2020 at 11:30, <marcandre.lureau@redhat.com> wrote:
> >
> > From: Marc-André Lureau <marcandre.lureau@redhat.com>
> >
> > QEMU requires Clang or GCC, that define and support __GNUC__ extensions.
> >
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> >  include/qemu/compiler.h | 8 +-------
> >  1 file changed, 1 insertion(+), 7 deletions(-)
> >
> > diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h
> > index 108bfdb391..f492baf341 100644
> > --- a/include/qemu/compiler.h
> > +++ b/include/qemu/compiler.h
> > @@ -55,14 +55,10 @@
> >      (offsetof(container, field) + sizeof_field(container, field))
> >
> >  /* Convert from a base type to a parent type, with compile time checking.  */
> > -#ifdef __GNUC__
> >  #define DO_UPCAST(type, field, dev) ( __extension__ ( { \
> >      char __attribute__((unused)) offset_must_be_zero[ \
> >          -offsetof(type, field)]; \
> >      container_of(dev, type, field);}))
> > -#else
> > -#define DO_UPCAST(type, field, dev) container_of(dev, type, field)
> > -#endif
>
> This bit looks good.
>
> >  #define typeof_field(type, field) typeof(((type *)0)->field)
> >  #define type_check(t1,t2) ((t1*)0 - (t2*)0)
> > @@ -93,7 +89,7 @@
> >  #if defined(__clang__)
> >    /* clang doesn't support gnu_printf, so use printf. */
> >  # define GCC_FMT_ATTR(n, m) __attribute__((format(printf, n, m)))
> > -#elif defined(__GNUC__)
> > +#else
> >     /* Use gnu_printf (qemu uses standard format strings). */
> >  # define GCC_FMT_ATTR(n, m) __attribute__((format(gnu_printf, n, m)))
> >  # if defined(_WIN32)
> > @@ -101,8 +97,6 @@
> >      * even when MinGW or GLib include files use __printf__. */
> >  #  define __printf__ __gnu_printf__
> >  # endif
> > -#else
> > -#define GCC_FMT_ATTR(n, m)
> >  #endif
>
> Didn't you already change the GCC_FMT_ATTR stuff in a previous
> patch in the series? If so this part should just be squashed
> into that one.
>

It's a mix of concerns. I focused on the first patch on the clang
exception, then dropped the explicit GNUC check. I would rather keep
it that way.

thanks
diff mbox series

Patch

diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h
index 108bfdb391..f492baf341 100644
--- a/include/qemu/compiler.h
+++ b/include/qemu/compiler.h
@@ -55,14 +55,10 @@ 
     (offsetof(container, field) + sizeof_field(container, field))
 
 /* Convert from a base type to a parent type, with compile time checking.  */
-#ifdef __GNUC__
 #define DO_UPCAST(type, field, dev) ( __extension__ ( { \
     char __attribute__((unused)) offset_must_be_zero[ \
         -offsetof(type, field)]; \
     container_of(dev, type, field);}))
-#else
-#define DO_UPCAST(type, field, dev) container_of(dev, type, field)
-#endif
 
 #define typeof_field(type, field) typeof(((type *)0)->field)
 #define type_check(t1,t2) ((t1*)0 - (t2*)0)
@@ -93,7 +89,7 @@ 
 #if defined(__clang__)
   /* clang doesn't support gnu_printf, so use printf. */
 # define GCC_FMT_ATTR(n, m) __attribute__((format(printf, n, m)))
-#elif defined(__GNUC__)
+#else
    /* Use gnu_printf (qemu uses standard format strings). */
 # define GCC_FMT_ATTR(n, m) __attribute__((format(gnu_printf, n, m)))
 # if defined(_WIN32)
@@ -101,8 +97,6 @@ 
     * even when MinGW or GLib include files use __printf__. */
 #  define __printf__ __gnu_printf__
 # endif
-#else
-#define GCC_FMT_ATTR(n, m)
 #endif
 
 #ifndef __has_warning