Remove GCC < 4.8 checks
v2 cover Remove GCC < 4.8 checks
From: Marc-André Lureau <[email protected]>
Hi,
Since commit efc6c07 ("configure: Add a test for the minimum compiler version"), QEMU explicitely depends on GCC >= 4.8.
v2:
- include reviewed Philippe earlier series
- drop problematic patch to replace GCC_FMT_ATTR, but tweak the check to be clang
- replace QEMU_GNUC_PREREQ with G_GNUC_CHECK_VERSION
- split changes
- add patches to drop __GNUC__ checks (clang advertizes itself as 4.2.1, unless -fgnuc-version=0)
Marc-André Lureau (11):
compiler.h: replace QEMU_GNUC_PREREQ macro compiler.h: remove GCC < 3 __builtin_expect fallback qemu-plugin.h: remove GCC < 4
tests: remove GCC < 4 fallbacks
virtiofsd: replace _Static_assert with QEMU_BUILD_BUG_ON compiler.h: explicit case for Clang printf attribute
audio: remove GNUC & MSVC check
poison: remove GNUC check
xen: remove GNUC check
compiler: remove GNUC check
linux-user: remove GNUC check
Philippe Mathieu-Daudé (2):
qemu/atomic: Drop special case for unsupported compiler accel/tcg: Remove special case for GCC < 4.6
include/exec/poison.h | 2 -- include/hw/xen/interface/io/ring.h | 9 ------ include/qemu/atomic.h | 17 ----------- include/qemu/compiler.h | 45 ++++++++---------------------- include/qemu/qemu-plugin.h | 9 ++---- scripts/cocci-macro-file.h | 1 - tools/virtiofsd/fuse_common.h | 11 +------- accel/tcg/cpu-exec.c | 2 +- audio/audio.c | 8 +----- linux-user/strace.c | 4 --- tests/tcg/arm/fcvt.c | 8 ++---- 11 files changed, 20 insertions(+), 96 deletions(-)
Signature · 1 line
2.29.0
PATCH v2 1/13 compiler.h: replace QEMU_GNUC_PREREQ macro
From: Marc-André Lureau <[email protected]>
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).
--- 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(-)
include/qemu/atomic.h +1 -1
@@ -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
include/qemu/compiler.h +3 -12
@@ -7,21 +7,12 @@#ifndef COMPILER_H #define COMPILER_H +#include "glib-compat.h" +#if defined __clang_analyzer__ || defined __COVERITY__#define QEMU_STATIC_ANALYSIS 1#endif -/*---------------------------------------------------------------------------- -| 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 -#define QEMU_NORETURN __attribute__ ((__noreturn__))#define QEMU_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
@@ -104,7 +95,7 @@ sizeof(QEMU_BUILD_BUG_ON_STRUCT(x)))#if defined __GNUC__ -# if !QEMU_GNUC_PREREQ (4 ,4 ) +# if !G_GNUC_CHECK_VERSION (4 ,4 )/* gcc versions before 4.4.x don't support gnu_printf, so use printf. */ # define GCC_FMT_ATTR (n, m) __attribute__((format(printf, n, m)))# else
scripts/cocci-macro-file.h +0 -1
@@ -19,7 +19,6 @@*/ /* From qemu/compiler.h */ -#define QEMU_GNUC_PREREQ (maj, min) 1#define QEMU_NORETURN __attribute__ ((__noreturn__))#define QEMU_WARN_UNUSED_RESULT __attribute__((warn_unused_result))#define QEMU_SENTINEL __attribute__((sentinel))
accel/tcg/cpu-exec.c +1 -1
@@ -724,7 +724,7 @@ int cpu_exec(CPUState *cpu)/* prepare setjmp context for exception handling */ if (sigsetjmp (cpu->jmp_env,0 ) !=0 ) { -#if defined(__clang__) || !QEMU_GNUC_PREREQ (4 ,6 ) +#if defined(__clang__) || !G_GNUC_CHECK_VERSION (4 ,6 )/* Some compilers wrongly smash all local variables after * siglongjmp. There were bug reports for gcc 4.5.0 and clang. * Reload essential local variables here for those compilers.
Signature · 1 line
2.29.0
Re: [PATCH v2 01/13] compiler.h: replace QEMU_GNUC_PREREQ macro
Quoted 35 lines · On Thu, 26 Nov 2020 at 11:29, <[email protected]> wrote:
From: Marc-André Lureau <[email protected]>
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: makeG_GNUC_CHECK_VERSION()portable" which was apparently harmless).Signed-off-by Marc-André Lureau <[email protected]>--- 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(-)include/qemu/atomic.h +1
-1@@ -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 include/qemu/compiler.h +0
-0
include/qemu/compiler.h line 10
Quoted 4 lines
include/qemu/compiler.h +1
-0@@ -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 :-)
thanks
-- PMM
Re: [PATCH v2 01/13] compiler.h: replace QEMU_GNUC_PREREQ macro
Hi
Quoted 59 lines · Peter Maydell
Quoted 35 lines · On Thu, 26 Nov 2020 at 11:29, <[email protected]> wrote:
From: Marc-André Lureau <[email protected]>
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: makeG_GNUC_CHECK_VERSION()portable" which was apparently harmless).Signed-off-by Marc-André Lureau <[email protected]>--- 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(-)include/qemu/atomic.h +1
-1@@ -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 include/qemu/compiler.h +0
-0include/qemu/compiler.h line 10
Quoted 4 lines
include/qemu/compiler.h +1
-0@@ -7,21 +7,12 @@#ifndef COMPILER_H #define COMPILER_H +#include "glib-compat.h"
osdep.halready includesglib-compat.h, so if it's safe to include it this early we should just move that #include line inosdep.hup abovecompiler.h. But I don't think it's going to be quite that simple, because some parts ofosdep.hneed to happen before we include any system headers, andglib-compat.hincludes some system headers. As it stands this fragment will pull inglib-compat.htoo early.You probably need to rearrange
osdep.hso 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 bycompiler.h!)
Quoted 2 lines
Or if this tangle of bits depending on each other seems too messy, we could just leave
QEMU_GNUC_PREREQthe way it is :-)
Or I just change the order the header are included in libvhost-user (before https://patchew.org/QEMU/[email protected]/
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).
PATCH v2 2/13 qemu/atomic: Drop special case for unsupported compiler
In reply to [email protected]From: Philippe Mathieu-Daudé <[email protected]>
Since commit efc6c070aca ("configure: Add a test for the minimum compiler version") the minimum compiler version required for GCC is 4.8, which has the GCC BZ#36793 bug fixed.
We can safely remove the special case introduced in commit a281ebc11a6 ("virtio: add missing mb() on notification").
With clang 3.8 (xenial amd64) __ATOMIC_RELAXED is defined, so the chunk to remove (which is x86-specific), isn't reached.
--- include/qemu/atomic.h | 17 ----------------- 1 file changed, 17 deletions(-)
include/qemu/atomic.h +0 -17
@@ -241,23 +241,6 @@#else /* __ATOMIC_RELAXED */ -/* -* We use GCC builtin if it's available, as that can use mfence on -* 32-bit as well, e.g. if built with -march=pentium-m. However, on -* i386 the spec is buggy, and the implementation followed it until -* 4.3 (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36793). -*/ -#if defined(__i386__) || defined(__x86_64__) -#if !G_GNUC_CHECK_VERSION (4 ,4 ) -#if defined __x86_64__ -#define smp_mb () ({ asm volatile("mfence" ::: "memory"); (void)0; }) -#else -#define smp_mb () ({ asm volatile("lock; addl $0,0(%%esp) " ::: "memory"); (void)0; }) -#endif -#endif -#endif - -#ifdef __alpha__#define smp_read_barrier_depends () asm volatile("mb":::"memory")#endif
Signature · 1 line
2.29.0
Re: [PATCH v2 02/13] qemu/atomic: Drop special case for unsupported compiler
Quoted 7 lines · On Thu, 26 Nov 2020 at 11:29, <[email protected]> wrote:
From: Philippe Mathieu-Daudé <[email protected]>
Since commit
efc6c070aca("configure: Add a test for the minimum compiler version") the minimum compiler version required for GCC is 4.8, which has the GCC BZ#36793 bug fixed.
Quoted 5 lines
We can safely remove the special case introduced in commit
a281ebc11a6("virtio: add missingmb()on notification").With clang 3.8 (xenial amd64)
__ATOMIC_RELAXEDis defined, so the chunk to remove (which is x86-specific), isn't reached.
The minimum clang version enforced by configure is 3.4, not 3.8. (Or Apple XCode clang 5.1 -- they use a different versioning scheme!)
thanks
-- PMM
Re: [PATCH v2 02/13] qemu/atomic: Drop special case for unsupported compiler
Quoted 8 lines · Peter Maydell
Quoted 7 lines · On Thu, 26 Nov 2020 at 11:29, <[email protected]> wrote:
From: Philippe Mathieu-Daudé <[email protected]>
Since commit
efc6c070aca("configure: Add a test for the minimum compiler version") the minimum compiler version required for GCC is 4.8, which has the GCC BZ#36793 bug fixed.
Quoted 8 lines
Quoted 5 lines
We can safely remove the special case introduced in commit
a281ebc11a6("virtio: add missingmb()on notification").With clang 3.8 (xenial amd64)
__ATOMIC_RELAXEDis defined, so the chunk to remove (which is x86-specific), isn't reached.The minimum clang version enforced by configure is 3.4, not 3.8. (Or Apple XCode clang 5.1 -- they use a different versioning scheme!)
We picked clang 3.4 based on fact that is what ships in EPEL7, and Debian Jessie 3.5. We then picked the XCode version to match.
Based on our platform support matrix we no longer support Debian Jessie, and IMHO we also don't really need to consider 3rd party add-on repos shipping non-default toolschains. So IMHO we could entirely ignore clang in EPEL7 when picking min versions.
IOW, we are likely justified in picking a new clang version if someone wants to research what is a suitable min version across our intended supported distros.
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [PATCH v2 02/13] qemu/atomic: Drop special case for unsupported compiler
Quoted 22 lines · Daniel P. Berrangé
Quoted 8 lines · Peter Maydell
Quoted 7 lines · On Thu, 26 Nov 2020 at 11:29, <[email protected]> wrote:
From: Philippe Mathieu-Daudé <[email protected]>
Since commit
efc6c070aca("configure: Add a test for the minimum compiler version") the minimum compiler version required for GCC is 4.8, which has the GCC BZ#36793 bug fixed.Quoted 8 lines
Quoted 5 lines
We can safely remove the special case introduced in commit
a281ebc11a6("virtio: add missingmb()on notification").With clang 3.8 (xenial amd64)
__ATOMIC_RELAXEDis defined, so the chunk to remove (which is x86-specific), isn't reached.The minimum clang version enforced by configure is 3.4, not 3.8. (Or Apple XCode clang 5.1 -- they use a different versioning scheme!)
We picked clang 3.4 based on fact that is what ships in EPEL7, and Debian Jessie 3.5. We then picked the XCode version to match.
Quoted 8 lines
Based on our platform support matrix we no longer support Debian Jessie, and IMHO we also don't really need to consider 3rd party add-on repos shipping non-default toolschains. So IMHO we could entirely ignore clang in EPEL7 when picking min versions.
IOW, we are likely justified in picking a new clang version if someone wants to research what is a suitable min version across our intended supported distros.
Sure, but if we do that then the series should start with the "bump the minimum clang version" patch with accompanying justification.
thanks
-- PMM
Re: [PATCH v2 02/13] qemu/atomic: Drop special case for unsupported compiler
Hi
Quoted 30 lines · Peter Maydell
Quoted 6 lines · Daniel P. Berrangé
Quoted 4 lines · Peter Maydell
Quoted 3 lines · On Thu, 26 Nov 2020 at 11:29, <[email protected]> wrote:
From: Philippe Mathieu-Daudé <[email protected]>
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Since commit
efc6c070aca("configure: Add a test for the minimum compiler version") the minimum compiler version required for GCC is 4.8, which has the GCC BZ#36793 bug fixed.We can safely remove the special case introduced in commit
a281ebc11a6("virtio: add missingmb()on notification").With clang 3.8 (xenial amd64)
__ATOMIC_RELAXEDis defined, so thechunk
Quoted 13 lines
Quoted 4 lines
Quoted 1 line
to remove (which is x86-specific), isn't reached.
The minimum clang version enforced by configure is 3.4, not 3.8. (Or Apple XCode clang 5.1 -- they use a different versioning scheme!)
We picked clang 3.4 based on fact that is what ships in EPEL7, and Debian Jessie 3.5. We then picked the XCode version to match.
Based on our platform support matrix we no longer support Debian Jessie, and IMHO we also don't really need to consider 3rd party add-on repos shipping non-default toolschains. So IMHO we could entirely ignore clang in EPEL7 when picking min versions.
Quoted 8 lines
Quoted 3 lines
IOW, we are likely justified in picking a new clang version if someone wants to research what is a suitable min version across our intended supported distros.
Sure, but if we do that then the series should start with the "bump the minimum clang version" patch with accompanying justification.
With clang-3.4.2-9.el7.x86_64 (epel7), __ATOMIC_RELAXED is defined. I'll update the commit message.
Some research on google suggests that it might be true also with XCode clang 5.1, I could use some help to verify that:
clang -dM -E - < /dev/null | grep __ATOMIC_RELAXED
Signature · 1 line
Marc-André Lureau
Re: [PATCH v2 02/13] qemu/atomic: Drop special case for unsupported compiler
Quoted 45 lines · Marc-André Lureau
Hi
Quoted 30 lines · Peter Maydell
Quoted 6 lines · Daniel P. Berrangé
Quoted 4 lines · Peter Maydell
Quoted 3 lines · On Thu, 26 Nov 2020 at 11:29, <[email protected]> wrote:
From: Philippe Mathieu-Daudé <[email protected]>
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Since commit
efc6c070aca("configure: Add a test for the minimum compiler version") the minimum compiler version required for GCC is 4.8, which has the GCC BZ#36793 bug fixed.We can safely remove the special case introduced in commit
a281ebc11a6("virtio: add missingmb()on notification").With clang 3.8 (xenial amd64)
__ATOMIC_RELAXEDis defined, so thechunk
Quoted 13 lines
Quoted 4 lines
Quoted 1 line
to remove (which is x86-specific), isn't reached.
The minimum clang version enforced by configure is 3.4, not 3.8. (Or Apple XCode clang 5.1 -- they use a different versioning scheme!)
We picked clang 3.4 based on fact that is what ships in EPEL7, and Debian Jessie 3.5. We then picked the XCode version to match.
Based on our platform support matrix we no longer support Debian Jessie, and IMHO we also don't really need to consider 3rd party add-on repos shipping non-default toolschains. So IMHO we could entirely ignore clang in EPEL7 when picking min versions.
Quoted 8 lines
Quoted 3 lines
IOW, we are likely justified in picking a new clang version if someone wants to research what is a suitable min version across our intended supported distros.
Sure, but if we do that then the series should start with the "bump the minimum clang version" patch with accompanying justification.
Quoted 6 lines
With clang-3.4.2-9.el7.x86_64 (epel7),
__ATOMIC_RELAXEDis defined. I'll update the commit message.Some research on google suggests that it might be true also with XCode clang 5.1, I could use some help to verify that:
clang -dM -E - </dev/null| grep__ATOMIC_RELAXED
The oldest xcode that travis has support for is 7.3. I'd really just suggest bumping min clang to something more modern, than trying to find xcode 5.1
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [PATCH v2 02/13] qemu/atomic: Drop special case for unsupported compiler
Quoted 49 lines · Daniel P. Berrangé
Quoted 48 lines · Marc-André Lureau
Hi
Quoted 30 lines · Peter Maydell
Quoted 6 lines · Daniel P. Berrangé
Quoted 4 lines · Peter Maydell
Quoted 3 lines · On Thu, 26 Nov 2020 at 11:29, <[email protected]> wrote:
From: Philippe Mathieu-Daudé <[email protected]>
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Since commit
efc6c070aca("configure: Add a test for the minimum compiler version") the minimum compiler version required for GCC is 4.8, which has the GCC BZ#36793 bug fixed.We can safely remove the special case introduced in commit
a281ebc11a6("virtio: add missingmb()on notification").With clang 3.8 (xenial amd64)
__ATOMIC_RELAXEDis defined, so thechunk
Quoted 13 lines
Quoted 4 lines
Quoted 1 line
to remove (which is x86-specific), isn't reached.
The minimum clang version enforced by configure is 3.4, not 3.8. (Or Apple XCode clang 5.1 -- they use a different versioning scheme!)
We picked clang 3.4 based on fact that is what ships in EPEL7, and Debian Jessie 3.5. We then picked the XCode version to match.
Based on our platform support matrix we no longer support Debian Jessie, and IMHO we also don't really need to consider 3rd party add-on repos shipping non-default toolschains. So IMHO we could entirely ignore clang in EPEL7 when picking min versions.
Quoted 8 lines
Quoted 3 lines
IOW, we are likely justified in picking a new clang version if someone wants to research what is a suitable min version across our intended supported distros.
Sure, but if we do that then the series should start with the "bump the minimum clang version" patch with accompanying justification.
With clang-3.4.2-9.el7.x86_64 (epel7),
__ATOMIC_RELAXEDis defined. I'll update the commit message.
Quoted 7 lines
Quoted 3 lines
Some research on google suggests that it might be true also with XCode clang 5.1, I could use some help to verify that:
clang -dM -E - </dev/null| grep__ATOMIC_RELAXEDThe oldest xcode that travis has support for is 7.3. I'd really just suggest bumping min clang to something more modern, than trying to find xcode 5.1
Actually, since you've validated main clang 3.4 code, you can assume this applies equally to xcode 5.1, as that is using the clang 3.4 codebase.
Basically we can assume features match across the regular and xcode clangs, with the mapped versions. IOW changing either is sufficient, no need to check both IMHO.
https://en.wikipedia.org/wiki/Xcode#Xcode_5.0_-_6.x_(since_arm64_support)_2
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
PATCH v2 3/13 accel/tcg: Remove special case for GCC < 4.6
In reply to [email protected]From: Philippe Mathieu-Daudé <[email protected]>
Since commit efc6c070aca ("configure: Add a test for the minimum compiler version") the minimum compiler version required for GCC is 4.8.
We can safely remove the special case for GCC 4.6 introduced in commit 0448f5f8b81 ("cpu-exec: Fix compiler warning (-Werror=clobbered)").
No change for Clang as we don't know.
--- accel/tcg/cpu-exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
accel/tcg/cpu-exec.c +1 -1
@@ -724,7 +724,7 @@ int cpu_exec(CPUState *cpu)/* prepare setjmp context for exception handling */ if (sigsetjmp (cpu->jmp_env,0 ) !=0 ) { -#if defined(__clang__) || !G_GNUC_CHECK_VERSION (4 ,6 ) +#if defined(__clang__)/* Some compilers wrongly smash all local variables after * siglongjmp. There were bug reports for gcc 4.5.0 and clang. * Reload essential local variables here for those compilers.
Signature · 1 line
2.29.0
PATCH v2 4/13 compiler.h: remove GCC < 3 __builtin_expect fallback
In reply to [email protected]From: Marc-André Lureau <[email protected]>
Since commit efc6c07 ("configure: Add a test for the minimum compiler version"), QEMU explicitely depends on GCC >= 4.8.
(clang >= 3.8 advertizes itself as GCC >= 4.2 compatible)
--- include/qemu/compiler.h | 4 ---- 1 file changed, 4 deletions(-)
include/qemu/compiler.h +0 -4
@@ -35,10 +35,6 @@#endif #ifndef likely -#if __GNUC__ <3 -#define __builtin_expect (x, n) (x) -#endif -#define likely (x) __builtin_expect(!!(x), 1)#define unlikely (x) __builtin_expect(!!(x), 0)#endif
Signature · 1 line
2.29.0
Re: [PATCH v2 04/13] compiler.h: remove GCC < 3 __builtin_expect fallback
Quoted 7 lines · On Thu, 26 Nov 2020 at 11:29, <[email protected]> wrote:
From: Marc-André Lureau <[email protected]>
Since commit efc6c07 ("configure: Add a test for the minimum compiler version"), QEMU explicitely depends on GCC >= 4.8.
(clang >= 3.8 advertizes itself as GCC >= 4.2 compatible)
All clangs always have advertised themselves as gcc-4.2-compatible, as far as I'm aware. 3.4 is the version we need to care about, I think it probably supported __builtin_expect(). (A test of the whole series with gcc 4.8 and clang 3.4 would confirm this.)
thnaks
-- PMM
Re: [PATCH v2 04/13] compiler.h: remove GCC < 3 __builtin_expect fallback
Hi
Quoted 7 lines · Peter Maydell
Quoted 6 lines · On Thu, 26 Nov 2020 at 11:29, <[email protected]> wrote:
From: Marc-André Lureau <[email protected]>
Since commit efc6c07 ("configure: Add a test for the minimum compiler version"), QEMU explicitely depends on GCC >= 4.8.
Quoted 7 lines
Quoted 1 line
(clang >= 3.8 advertizes itself as GCC >= 4.2 compatible)
All clangs always have advertised themselves as gcc-4.2-compatible, as far as I'm aware. 3.4 is the version we need to care about, I think it probably supported
__builtin_expect(). (A test of the whole series with gcc 4.8 and clang 3.4 would confirm this.)
clang 3.4 also advertizes as gcc-4.2, thus we can safely remove that __builtin_expect() fallback (if it didn't have it, it would have failed for a long while)
I also checked the __builtin_expect() support with clang-3.4.2-9.el7.x86_64 from EPEL7 successfully.
Signature · 1 line
Marc-André Lureau
PATCH v2 5/13 qemu-plugin.h: remove GCC < 4
In reply to [email protected]From: Marc-André Lureau <[email protected]>
Since commit efc6c07 ("configure: Add a test for the minimum compiler version"), QEMU explicitely depends on GCC >= 4.8.
(clang >= 3.8 advertizes itself as GCC >= 4.2 compatible)
--- include/qemu/qemu-plugin.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
include/qemu/qemu-plugin.h +2 -7
@@ -28,13 +28,8 @@#endif #define QEMU_PLUGIN_LOCAL #else -#if __GNUC__ >=4 -#define QEMU_PLUGIN_EXPORT __attribute__((visibility("default"))) -#define QEMU_PLUGIN_LOCAL __attribute__((visibility("hidden"))) -#else -#define QEMU_PLUGIN_EXPORT -#define QEMU_PLUGIN_LOCAL -#endif +#define QEMU_PLUGIN_EXPORT __attribute__((visibility("default"))) +#define QEMU_PLUGIN_LOCAL __attribute__((visibility("hidden")))#endif typedef uint64_t qemu_plugin_id_t ;
Signature · 1 line
2.29.0
Re: [PATCH v2 05/13] qemu-plugin.h: remove GCC < 4
Quoted 6 lines · On Thu, 26 Nov 2020 at 11:30, <[email protected]> wrote:
From: Marc-André Lureau <[email protected]>
Since commit efc6c07 ("configure: Add a test for the minimum compiler version"), QEMU explicitely depends on GCC >= 4.8.
Quoted 6 lines
(clang >= 3.8 advertizes itself as GCC >= 4.2 compatible)
Signed-off-by Marc-André Lureau <[email protected]>--- include/qemu/qemu-plugin.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
This is an interesting case, because it's a header intended for external use (people compiling plugins), not part of QEMU proper. I don't know whether we want to impose the same clang/gcc requirements on plugin builders, though it's probably not a bad idea to do so. Alex ?
thanks
-- PMM
Re: [PATCH v2 05/13] qemu-plugin.h: remove GCC < 4
Quoted 14 lines · Peter Maydell
Quoted 6 lines · On Thu, 26 Nov 2020 at 11:30, <[email protected]> wrote:
From: Marc-André Lureau <[email protected]>
Since commit efc6c07 ("configure: Add a test for the minimum compiler version"), QEMU explicitely depends on GCC >= 4.8.
Quoted 6 lines
(clang >= 3.8 advertizes itself as GCC >= 4.2 compatible)
Signed-off-by Marc-André Lureau <[email protected]>--- include/qemu/qemu-plugin.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
Quoted 5 lines
This is an interesting case, because it's a header intended for external use (people compiling plugins), not part of QEMU proper. I don't know whether we want to impose the same clang/gcc requirements on plugin builders, though it's probably not a bad idea to do so. Alex ?
IIUC, we expect that the plugins are built specifically to go with the QEMU you have built. With that in mind, it looks reasonable to assume the same compiler toolchain versions for both.
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [PATCH v2 05/13] qemu-plugin.h: remove GCC < 4
Quoted 9 lines · Daniel P. Berrangé
Quoted 5 lines · Peter Maydell
This is an interesting case, because it's a header intended for external use (people compiling plugins), not part of QEMU proper. I don't know whether we want to impose the same clang/gcc requirements on plugin builders, though it's probably not a bad idea to do so. Alex ?
IIUC, we expect that the plugins are built specifically to go with the QEMU you have built.
No, the point of the plugin interface is that it actually is a (constrained) stable ABI with version-querying and checking so you don't have to build a plugin against the exact matching QEMU version. (But "don't use really ancient gcc" doesn't seem like a very major thing to ask of its users.)
thanks
-- PMM
Alex Bennée
Acked-byRe: [PATCH v2 05/13] qemu-plugin.h: remove GCC < 4
Quoted 8 lines · Peter Maydell
Quoted 7 lines · Daniel P. Berrangé
Quoted 5 lines · Peter Maydell
This is an interesting case, because it's a header intended for external use (people compiling plugins), not part of QEMU proper. I don't know whether we want to impose the same clang/gcc requirements on plugin builders, though it's probably not a bad idea to do so. Alex ?
Quoted 8 lines
Quoted 2 lines
IIUC, we expect that the plugins are built specifically to go with the QEMU you have built.
No, the point of the plugin interface is that it actually is a (constrained) stable ABI with version-querying and checking so you don't have to build a plugin against the exact matching QEMU version. (But "don't use really ancient gcc" doesn't seem like a very major thing to ask of its users.)
Quite. But I agree using a GCC from this decade seems reasonable especially as the feature has only been in QEMU for a few cycles.
Signature · 1 line
Alex Bennée
PATCH v2 6/13 tests: remove GCC < 4 fallbacks
In reply to [email protected]From: Marc-André Lureau <[email protected]>
Since commit efc6c07 ("configure: Add a test for the minimum compiler version"), QEMU explicitely depends on GCC >= 4.8.
(clang >= 3.8 advertizes itself as GCC >= 4.2 compatible)
--- tests/tcg/arm/fcvt.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
tests/tcg/arm/fcvt.c +3 -5
@@ -73,11 +73,9 @@ static void print_int64(int i, int64_t num)#ifndef SNANF /* Signaling NaN macros, if supported. */ -# if __GNUC_PREREQ (3 ,3 ) -# define SNANF (__builtin_nansf ("")) -# define SNAN (__builtin_nans ("")) -# define SNANL (__builtin_nansl ("")) -# endif +# define SNANF (__builtin_nansf ("")) +# define SNAN (__builtin_nans ("")) +# define SNANL (__builtin_nansl (""))#endif float single_numbers[] = { -SNANF ,
Signature · 1 line
2.29.0
Re: [PATCH v2 06/13] tests: remove GCC < 4 fallbacks
Quoted 20 lines · On Thu, 26 Nov 2020 at 11:30, <[email protected]> wrote:
From: Marc-André Lureau <[email protected]>
Since commit efc6c07 ("configure: Add a test for the minimum compiler version"), QEMU explicitely depends on GCC >= 4.8.
(clang >= 3.8 advertizes itself as GCC >= 4.2 compatible)
Signed-off-by Marc-André Lureau <[email protected]>--- tests/tcg/arm/fcvt.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)tests/tcg/arm/fcvt.c +0
-0@@ -73,11 +73,9 @@ static void print_int64(int i, int64_t num)#ifndef SNANF
tests/tcg/arm/fcvt.c static void print_int64(int i, int64_t num) · line 79
Quoted 10 lines
tests/tcg/arm/fcvt.c +3
-5/* Signaling NaN macros, if supported. */ -# if __GNUC_PREREQ (3 ,3 ) -# define SNANF (__builtin_nansf ("")) -# define SNAN (__builtin_nans ("")) -# define SNANL (__builtin_nansl ("")) -# endif +# define SNANF (__builtin_nansf ("")) +# define SNAN (__builtin_nans ("")) +# define SNANL (__builtin_nansl (""))#endif
Please fix the commit message to talk about clang 3.4, not 3.8, but otherwise
thanks
-- PMM
Alex Bennée
Acked-byRe: [PATCH v2 06/13] tests: remove GCC < 4 fallbacks
Quoted 6 lines · Peter Maydell
Quoted 5 lines · On Thu, 26 Nov 2020 at 11:30, <[email protected]> wrote:
From: Marc-André Lureau <[email protected]>
Since commit efc6c07 ("configure: Add a test for the minimum compiler version"), QEMU explicitely depends on GCC >= 4.8.
technically the tests/tcg tests don't depend on the same compilers as the main QEMU build. However as the cross compiler case is most likely covered by our much more modern docker images and the buildin arm-on-arm will re-use the host compiler this is fine.
Signature · 1 line
Alex Bennée
PATCH v2 7/13 virtiofsd: replace _Static_assert with QEMU_BUILD_BUG_ON
In reply to [email protected]From: Marc-André Lureau <[email protected]>
This allows to get rid of a check for older GCC version (which was a bit bogus too since it was falling back on c++ version..)
--- tools/virtiofsd/fuse_common.h | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
tools/virtiofsd/fuse_common.h +1 -10
@@ -809,15 +809,6 @@ void fuse_remove_signal_handlers(struct fuse_session *se);* * On 32bit systems please add -D_FILE_OFFSET_BITS=64 to your compile flags! */ - -#if defined(__GNUC__) && \ - (__GNUC__ >4 || __GNUC__ ==4 && __GNUC_MINOR__ >=6 ) && \ - !defined __cplusplus -_Static_assert (sizeof (off_t) ==8 ,"fuse: off_t must be 64bit" ); -#else -struct _fuse_off_t_must_be_64bit_dummy_struct { -unsigned _fuse_off_t_must_be_64bit:((sizeof (off_t) ==8 ) ?1 :-1 ); -}; -#endif +QEMU_BUILD_BUG_ON (sizeof (off_t) !=8 );#endif /* FUSE_COMMON_H_ */
Signature · 1 line
2.29.0
PATCH v2 8/13 compiler.h: explicit case for Clang printf attribute
In reply to [email protected]From: Marc-André Lureau <[email protected]>
Since commit efc6c07 ("configure: Add a test for the minimum compiler version"), QEMU explicitely depends on GCC >= 4.8, we could thus drop earlier version checks. Except clang advertizes itself as GCC 4.2.1.
Since clang doesn't support gnu_printf, make that case explicitely and drop GCC version check.
--- include/qemu/compiler.h | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
include/qemu/compiler.h +10 -12
@@ -90,18 +90,16 @@#define QEMU_BUILD_BUG_ON_ZERO (x) (sizeof(QEMU_BUILD_BUG_ON_STRUCT(x)) - \ sizeof(QEMU_BUILD_BUG_ON_STRUCT(x))) -#if defined __GNUC__ -# if !G_GNUC_CHECK_VERSION (4 ,4 ) -/* gcc versions before 4.4.x don't support gnu_printf, so use printf. */ -# define GCC_FMT_ATTR (n, m) __attribute__((format(printf, n, m))) -# else -/* Use gnu_printf when supported (qemu uses standard format strings). */ -# define GCC_FMT_ATTR (n, m) __attribute__((format(gnu_printf, n, m))) -# if defined(_WIN32) -/* Map __printf__ to __gnu_printf__ because we want standard format strings -* even when MinGW or GLib include files use __printf__. */ -# define __printf__ __gnu_printf__ -# endif +#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__) +/* Use gnu_printf (qemu uses standard format strings). */ +# define GCC_FMT_ATTR (n, m) __attribute__((format(gnu_printf, n, m))) +# if defined(_WIN32) +/* Map __printf__ to __gnu_printf__ because we want standard format strings +* even when MinGW or GLib include files use __printf__. */ +# define __printf__ __gnu_printf__# endif #else #define GCC_FMT_ATTR (n, m)
Signature · 1 line
2.29.0
Re: [PATCH v2 08/13] compiler.h: explicit case for Clang printf attribute
Quoted 36 lines · On Thu, 26 Nov 2020 at 11:30, <[email protected]> wrote:
From: Marc-André Lureau <[email protected]>
Since commit efc6c07 ("configure: Add a test for the minimum compiler version"), QEMU explicitely depends on GCC >= 4.8, we could thus drop earlier version checks. Except clang advertizes itself as GCC 4.2.1.
Since clang doesn't support
gnu_printf, make that case explicitely and drop GCC version check.Signed-off-by Marc-André Lureau <[email protected]>--- include/qemu/compiler.h | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)include/qemu/compiler.h +1
-12@@ -90,18 +90,16 @@#define QEMU_BUILD_BUG_ON_ZERO (x) (sizeof(QEMU_BUILD_BUG_ON_STRUCT(x)) - \ sizeof(QEMU_BUILD_BUG_ON_STRUCT(x))) -#if defined __GNUC__ -# if !G_GNUC_CHECK_VERSION (4 ,4 ) -/* gcc versions before 4.4.x don't support gnu_printf, so use printf. */ -# define GCC_FMT_ATTR (n, m) __attribute__((format(printf, n, m))) -# else -/* Use gnu_printf when supported (qemu uses standard format strings). */ -# define GCC_FMT_ATTR (n, m) __attribute__((format(gnu_printf, n, m))) -# if defined(_WIN32) -/* Map __printf__ to __gnu_printf__ because we want standard format strings -* even when MinGW or GLib include files use __printf__. */ -# define __printf__ __gnu_printf__ -# endif +#if defined(__clang__)
include/qemu/compiler.h line 103
Quoted 10 lines
include/qemu/compiler.h +9
-0+/* clang doesn't support gnu_printf, so use printf. */ +# define GCC_FMT_ATTR (n, m) __attribute__((format(printf, n, m))) +#elif defined(__GNUC__) +/* Use gnu_printf (qemu uses standard format strings). */ +# define GCC_FMT_ATTR (n, m) __attribute__((format(gnu_printf, n, m))) +# if defined(_WIN32) +/* Map __printf__ to __gnu_printf__ because we want standard format strings +* even when MinGW or GLib include files use __printf__. */ +# define __printf__ __gnu_printf__# endif
checkpatch probably warns about the block comment style so you might as well fix it while touching that line, but otherwise
thanks
-- PMM
PATCH v2 9/13 audio: remove GNUC & MSVC check
In reply to [email protected]From: Marc-André Lureau <[email protected]>
QEMU requires either GCC or Clang, which both advertize __GNUC__. Drop MSVC fallback path.
--- audio/audio.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
audio/audio.c +1 -7
@@ -122,13 +122,7 @@ int audio_bug (const char *funcname, int cond)#if definedAUDIO_BREAKPOINT_ON_BUG # if definedHOST_I386 -# if defined __GNUC__ - __asm__ ("int3" ); -# elif defined _MSC_VER - _asm _emit 0xcc; -# else -abort (); -# endif + __asm__ ("int3" );# else abort ();# endif
Signature · 1 line
2.29.0
Re: [PATCH v2 09/13] audio: remove GNUC & MSVC check
Quoted 31 lines · On Thu, 26 Nov 2020 at 11:30, <[email protected]> wrote:
From: Marc-André Lureau <[email protected]>
QEMU requires either GCC or Clang, which both advertize
__GNUC__. Drop MSVC fallback path.Signed-off-by Marc-André Lureau <[email protected]>--- audio/audio.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)audio/audio.c +1
-8@@ -122,13 +122,7 @@ int audio_bug (const char *funcname, int cond)#if definedAUDIO_BREAKPOINT_ON_BUG # if definedHOST_I386 -# if defined __GNUC__ - __asm__ ("int3" ); -# elif defined _MSC_VER - _asm _emit 0xcc; -# else -abort (); -# endif + __asm__ ("int3" );# else abort ();# endif --
Quoted 1 line
2.29.0
I would prefer to just drop this attempt to emit an inline breakpoint insn (which won't work on non-x86 hosts and seems to me to have no benefit over just calling abort(), which will also drop you into the debugger) and simply make it abort() if AUDIO_BREAKPOINT_ON_BUG is defined. Gerd, do you have an opinion ?
thanks
-- PMM
Re: [PATCH v2 09/13] audio: remove GNUC & MSVC check
Hi
Quoted 32 lines · Peter Maydell
Quoted 31 lines · On Thu, 26 Nov 2020 at 11:30, <[email protected]> wrote:
From: Marc-André Lureau <[email protected]>
QEMU requires either GCC or Clang, which both advertize
__GNUC__. Drop MSVC fallback path.Signed-off-by Marc-André Lureau <[email protected]>--- audio/audio.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)audio/audio.c +1
-8@@ -122,13 +122,7 @@ int audio_bug (const char *funcname, int cond)#if definedAUDIO_BREAKPOINT_ON_BUG # if definedHOST_I386 -# if defined __GNUC__ - __asm__ ("int3" ); -# elif defined _MSC_VER - _asm _emit 0xcc; -# else -abort (); -# endif + __asm__ ("int3" );# else abort ();# endif --
Quoted 10 lines
Quoted 1 line
2.29.0
I would prefer to just drop this attempt to emit an inline breakpoint insn (which won't work on non-x86 hosts and seems to me to have no benefit over just calling
abort(), which will also drop you into the debugger) and simply make itabort()ifAUDIO_BREAKPOINT_ON_BUGis defined. Gerd, do you have an opinion ?
Oh yeah.. But audio/ is a rabbit hole, so I had to refrain myself doing more cleanups.
Signature · 1 line
Marc-André Lureau
Re: [PATCH v2 09/13] audio: remove GNUC & MSVC check
In reply to Peter MaydellHi,
Quoted 9 lines
Quoted 8 lines
#if defined
AUDIO_BREAKPOINT_ON_BUG
# if definedHOST_I386
+__asm__("int3");
# elseabort ();# endif
--
2.29.0
Quoted 6 lines
I would prefer to just drop this attempt to emit an inline breakpoint insn (which won't work on non-x86 hosts and seems to me to have no benefit over just calling
abort(), which will also drop you into the debugger) and simply make itabort()ifAUDIO_BREAKPOINT_ON_BUGis defined. Gerd, do you have an opinion ?
kraxel@sirius ~/projects/qemu# git grep AUDIO_BREAKPOINT_ON_BUG audio/audio.c:#if defined AUDIO_BREAKPOINT_ON_BUG
Seems this is unused, so just remove it?
take care,
Gerd
Re: [PATCH v2 09/13] audio: remove GNUC & MSVC check
Quoted 18 lines · Gerd Hoffmann
Hi,
Quoted 9 lines
Quoted 8 lines
#if defined
AUDIO_BREAKPOINT_ON_BUG
# if definedHOST_I386
+__asm__("int3");
# elseabort ();# endif
--
2.29.0Quoted 6 lines
I would prefer to just drop this attempt to emit an inline breakpoint insn (which won't work on non-x86 hosts and seems to me to have no benefit over just calling
abort(), which will also drop you into the debugger) and simply make itabort()ifAUDIO_BREAKPOINT_ON_BUGis defined. Gerd, do you have an opinion ?
Quoted 6 lines
kraxel@sirius ~/projects/qemu# git grep
AUDIO_BREAKPOINT_ON_BUGaudio/audio.c:#if definedAUDIO_BREAKPOINT_ON_BUGSeems this is unused, so just remove it?
I think the original intention was to build with CFLAGS set manually for debugging this limited case. (Iirc, we have other such #ifdef lurking around)
Signature · 1 line
Marc-André Lureau
PATCH v2 10/13 poison: remove GNUC check
In reply to [email protected]From: Marc-André Lureau <[email protected]>
QEMU requires Clang or GCC, that define and support __GNUC__ extensions
--- include/exec/poison.h | 2 -- 1 file changed, 2 deletions(-)
include/exec/poison.h +0 -2
@@ -3,7 +3,6 @@#ifndef HW_POISON_H #define HW_POISON_H -#ifdef __GNUC__#pragma GCC poison TARGET_I386#pragma GCC poison TARGET_X86_64
@@ -93,4 +92,3 @@#pragma GCC poison CONFIG_SOFTMMU#endif -#endif
Signature · 1 line
2.29.0
Re: [PATCH v2 10/13] poison: remove GNUC check
Quoted 9 lines · On Thu, 26 Nov 2020 at 11:30, <[email protected]> wrote:
From: Marc-André Lureau <[email protected]>
QEMU requires Clang or GCC, that define and support
__GNUC__extensionsSigned-off-by Marc-André Lureau <[email protected]>--- include/exec/poison.h | 2 -- 1 file changed, 2 deletions(-)
thanks
-- PMM
PATCH v2 11/13 xen: remove GNUC check
In reply to [email protected]From: Marc-André Lureau <[email protected]>
QEMU requires Clang or GCC, that define and support __GNUC__ extensions
--- include/hw/xen/interface/io/ring.h | 9 --------- 1 file changed, 9 deletions(-)
include/hw/xen/interface/io/ring.h +0 -9
@@ -206,21 +206,12 @@ typedef struct __name##_back_ring __name##_back_ring_t#define RING_HAS_UNCONSUMED_RESPONSES (_r) \ ((_r)->sring->rsp_prod - (_r)->rsp_cons) -#ifdef __GNUC__#define RING_HAS_UNCONSUMED_REQUESTS (_r) ({ \ unsigned int req = (_r)->sring->req_prod - (_r)->req_cons; \ unsigned int rsp = RING_SIZE(_r) - \ ((_r)->req_cons - (_r)->rsp_prod_pvt); \ req < rsp ? req : rsp; \ }) -#else -/* Same as above, but without the nice GCC ({ ... }) syntax. */ -#define RING_HAS_UNCONSUMED_REQUESTS (_r) \ - ((((_r)->sring->req_prod - (_r)->req_cons) < \ - (RING_SIZE(_r) - ((_r)->req_cons - (_r)->rsp_prod_pvt))) ? \ - ((_r)->sring->req_prod - (_r)->req_cons) : \ - (RING_SIZE(_r) - ((_r)->req_cons - (_r)->rsp_prod_pvt))) -#endif /* Direct access to individual ring elements, by index. */ #define RING_GET_REQUEST (_r, _idx) \
Signature · 1 line
2.29.0
Re: [PATCH v2 11/13] xen: remove GNUC check
Quoted 9 lines · On Thu, 26 Nov 2020 at 11:30, <[email protected]> wrote:
From: Marc-André Lureau <[email protected]>
QEMU requires Clang or GCC, that define and support
__GNUC__extensionsSigned-off-by Marc-André Lureau <[email protected]>--- include/hw/xen/interface/io/ring.h | 9 --------- 1 file changed, 9 deletions(-)
From QEMU's POV this change is good, but this header seems to have originally been an import from the Xen public headers -- are we happy to diverge from that original or do we prefer to stay as close as possible to the upstream header? Cc'ing the Xen maintainers for their opinion.
Quoted 17 lines
include/hw/xen/interface/io/ring.h +0
-3@@ -206,21 +206,12 @@ typedef struct __name##_back_ring __name##_back_ring_t#define RING_HAS_UNCONSUMED_RESPONSES (_r) \ ((_r)->sring->rsp_prod - (_r)->rsp_cons) -#ifdef __GNUC__#define RING_HAS_UNCONSUMED_REQUESTS (_r) ({ \ unsigned int req = (_r)->sring->req_prod - (_r)->req_cons; \ unsigned int rsp = RING_SIZE(_r) - \ ((_r)->req_cons - (_r)->rsp_prod_pvt); \ req < rsp ? req : rsp; \ }) -#else -/* Same as above, but without the nice GCC ({ ... }) syntax. */
include/hw/xen/interface/io/ring.h typedef struct __name##_back_ring __name##_back_ring_t
Quoted 10 lines
include/hw/xen/interface/io/ring.h +0
-7-#define RING_HAS_UNCONSUMED_REQUESTS (_r) \ - ((((_r)->sring->req_prod - (_r)->req_cons) < \ - (RING_SIZE(_r) - ((_r)->req_cons - (_r)->rsp_prod_pvt))) ? \ - ((_r)->sring->req_prod - (_r)->req_cons) : \ - (RING_SIZE(_r) - ((_r)->req_cons - (_r)->rsp_prod_pvt))) -#endif /* Direct access to individual ring elements, by index. */ #define RING_GET_REQUEST (_r, _idx) \ --
thanks
-- PMM
Re: [PATCH v2 11/13] xen: remove GNUC check
Quoted 11 lines · Peter Maydell
Quoted 9 lines · On Thu, 26 Nov 2020 at 11:30, <[email protected]> wrote:
From: Marc-André Lureau <[email protected]>
QEMU requires Clang or GCC, that define and support
__GNUC__extensionsSigned-off-by Marc-André Lureau <[email protected]>--- include/hw/xen/interface/io/ring.h | 9 --------- 1 file changed, 9 deletions(-)
Quoted 5 lines
Quoted 1 line
From QEMU's POV this change is good, but this header seems to have
originally been an import from the Xen public headers -- are we happy to diverge from that original or do we prefer to stay as close as possible to the upstream header? Cc'ing the Xen maintainers for their opinion.
Small divergences are not a problem. I think this is OK.
Quoted 26 lines
Quoted 26 lines
include/hw/xen/interface/io/ring.h +0
-9@@ -206,21 +206,12 @@ typedef struct __name##_back_ring __name##_back_ring_t#define RING_HAS_UNCONSUMED_RESPONSES (_r) \ ((_r)->sring->rsp_prod - (_r)->rsp_cons) -#ifdef __GNUC__#define RING_HAS_UNCONSUMED_REQUESTS (_r) ({ \ unsigned int req = (_r)->sring->req_prod - (_r)->req_cons; \ unsigned int rsp = RING_SIZE(_r) - \ ((_r)->req_cons - (_r)->rsp_prod_pvt); \ req < rsp ? req : rsp; \ }) -#else -/* Same as above, but without the nice GCC ({ ... }) syntax. */ -#define RING_HAS_UNCONSUMED_REQUESTS (_r) \ - ((((_r)->sring->req_prod - (_r)->req_cons) < \ - (RING_SIZE(_r) - ((_r)->req_cons - (_r)->rsp_prod_pvt))) ? \ - ((_r)->sring->req_prod - (_r)->req_cons) : \ - (RING_SIZE(_r) - ((_r)->req_cons - (_r)->rsp_prod_pvt))) -#endif /* Direct access to individual ring elements, by index. */ #define RING_GET_REQUEST (_r, _idx) \
PATCH v2 12/13 compiler: remove GNUC check
In reply to [email protected]From: Marc-André Lureau <[email protected]>
QEMU requires Clang or GCC, that define and support __GNUC__ extensions.
--- include/qemu/compiler.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
include/qemu/compiler.h +1 -7
@@ -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
Signature · 1 line
2.29.0
Re: [PATCH v2 12/13] compiler: remove GNUC check
Quoted 16 lines · On Thu, 26 Nov 2020 at 11:30, <[email protected]> wrote:
From: Marc-André Lureau <[email protected]>
QEMU requires Clang or GCC, that define and support
__GNUC__extensions.Signed-off-by Marc-André Lureau <[email protected]>--- include/qemu/compiler.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)include/qemu/compiler.h +0
-0@@ -55,14 +55,10 @@ (offsetof(container , field) +sizeof_field (container, field))
include/qemu/compiler.h line 65
Quoted 10 lines
include/qemu/compiler.h +0
-4/* 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.
Quoted 12 lines
include/qemu/compiler.h +1
-1#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)
include/qemu/compiler.h line 100
Quoted 6 lines
include/qemu/compiler.h +0
-2@@ -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
Re: [PATCH v2 12/13] compiler: remove GNUC check
Quoted 45 lines · Peter Maydell
Quoted 16 lines · On Thu, 26 Nov 2020 at 11:30, <[email protected]> wrote:
From: Marc-André Lureau <[email protected]>
QEMU requires Clang or GCC, that define and support
__GNUC__extensions.Signed-off-by Marc-André Lureau <[email protected]>--- include/qemu/compiler.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)include/qemu/compiler.h +0
-0@@ -55,14 +55,10 @@ (offsetof(container , field) +sizeof_field (container, field))include/qemu/compiler.h line 65
Quoted 10 lines
include/qemu/compiler.h +0
-4/* 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.
Quoted 14 lines
include/qemu/compiler.h +1
-1#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__
Quoted 9 lines
include/qemu/compiler.h line 100
Quoted 4 lines
include/qemu/compiler.h +0
-2# endif -#else -#define GCC_FMT_ATTR (n, m)#endif Didn't you already change the
GCC_FMT_ATTRstuff 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
PATCH v2 13/13 linux-user: remove GNUC check
In reply to [email protected]From: Marc-André Lureau <[email protected]>
QEMU requires Clang or GCC, that define and support __GNUC__ extensions.
--- linux-user/strace.c | 4 ---- 1 file changed, 4 deletions(-)
linux-user/strace.c +0 -4
@@ -24,7 +24,6 @@ struct syscallname { abi_long, abi_long, abi_long); }; -#ifdef __GNUC__/* * It is possible that target doesn't have syscall that uses * following flags but we don't want the compiler to warn
@@ -32,9 +31,6 @@ struct syscallname {* functions. It is ok to keep them while not used. */ #define UNUSED __attribute__ ((unused)) -#else -#define UNUSED -#endif /* * Structure used to translate flag values into strings. This is
Signature · 1 line
2.29.0
Re: [PATCH v2 13/13] linux-user: remove GNUC check
Quoted 7 lines · On Thu, 26 Nov 2020 at 11:31, <[email protected]> wrote:
From: Marc-André Lureau <[email protected]>
QEMU requires Clang or GCC, that define and support
__GNUC__extensions.Signed-off-by Marc-André Lureau <[email protected]>---
thanks
-- PMM
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Type: series
Message-id: [email protected]
Subject: [PATCH v2 00/13] Remove GCC < 4.8 checks
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
- [tag update] patchew/[email protected] -> patchew/[email protected]
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
77ab4c6 linux-user: remove GNUC check
f76a0b9 compiler: remove GNUC check
beeadb1 xen: remove GNUC check
405e99f poison: remove GNUC check
e5c6d98 audio: remove GNUC & MSVC check
2678b63 compiler.h: explicit case for Clang printf attribute 47e1c5e virtiofsd: replace _Static_assert with QEMU_BUILD_BUG_ON 5e15c4d tests: remove GCC < 4 fallbacks
a2ff6e8 qemu-plugin.h: remove GCC < 4
f0eebeb compiler.h: remove GCC < 3 __builtin_expect fallback b157e9f accel/tcg: Remove special case for GCC < 4.6 93edd26 qemu/atomic: Drop special case for unsupported compiler b5c4061 compiler.h: replace QEMU_GNUC_PREREQ macro
=== OUTPUT BEGIN ===
1/13 Checking commit b5c4061785ec (compiler.h: replace QEMU_GNUC_PREREQ macro)
WARNING: architecture specific defines should be avoided
#25: FILE: accel/tcg/cpu-exec.c:727:
+#if defined(__clang__) || !G_GNUC_CHECK_VERSION(4, 6)
total: 0 errors, 1 warnings, 54 lines checked
Patch 1/13 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
2/13 Checking commit 93edd26cd83a (qemu/atomic: Drop special case for unsupported compiler) 3/13 Checking commit b157e9f1f2df (accel/tcg: Remove special case for GCC < 4.6)
WARNING: architecture specific defines should be avoided
#30: FILE: accel/tcg/cpu-exec.c:727:
+#if defined(__clang__)
total: 0 errors, 1 warnings, 8 lines checked
Patch 3/13 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
4/13 Checking commit f0eebebebb3b (compiler.h: remove GCC < 3 __builtin_expect fallback) 5/13 Checking commit a2ff6e8ca3d5 (qemu-plugin.h: remove GCC < 4)
6/13 Checking commit 5e15c4d002dd (tests: remove GCC < 4 fallbacks)
ERROR: space prohibited between function name and open parenthesis '(' #28: FILE: tests/tcg/arm/fcvt.c:76:
+# define SNANF (__builtin_nansf (""))
ERROR: space prohibited between function name and open parenthesis '(' #29: FILE: tests/tcg/arm/fcvt.c:77:
+# define SNAN (__builtin_nans (""))
ERROR: space prohibited between function name and open parenthesis '(' #30: FILE: tests/tcg/arm/fcvt.c:78:
+# define SNANL (__builtin_nansl (""))
total: 3 errors, 0 warnings, 14 lines checked
Patch 6/13 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
7/13 Checking commit 47e1c5e0319a (virtiofsd: replace _Static_assert with QEMU_BUILD_BUG_ON) 8/13 Checking commit 2678b639f490 (compiler.h: explicit case for Clang printf attribute)
WARNING: architecture specific defines should be avoided
#37: FILE: include/qemu/compiler.h:93:
+#if defined(__clang__)
WARNING: Block comments use a leading /* on a separate line #44: FILE: include/qemu/compiler.h:100:
+ /* Map __printf__ to __gnu_printf__ because we want standard format strings
WARNING: Block comments use a trailing */ on a separate line #45: FILE: include/qemu/compiler.h:101:
+ * even when MinGW or GLib include files use __printf__. */
total: 0 errors, 3 warnings, 28 lines checked
Patch 8/13 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
9/13 Checking commit e5c6d9859362 (audio: remove GNUC & MSVC check) 10/13 Checking commit 405e99fe1fee (poison: remove GNUC check) 11/13 Checking commit beeadb186e66 (xen: remove GNUC check) 12/13 Checking commit f76a0b946371 (compiler: remove GNUC check) 13/13 Checking commit 77ab4c6a10d7 (linux-user: remove GNUC check) === OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]