[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/2] Remove GCC version checks (all < 4.8)
From: |
marcandre . lureau |
Subject: |
[PATCH 1/2] Remove GCC version checks (all < 4.8) |
Date: |
Tue, 24 Nov 2020 16:52:34 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Since commit efc6c07 ("configure: Add a test for the minimum compiler
version"), QEMU explicitely depends on GCC >= 4.8.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
include/qemu/atomic.h | 17 -----------------
include/qemu/compiler.h | 22 ++++++----------------
include/qemu/qemu-plugin.h | 9 ++-------
tools/virtiofsd/fuse_common.h | 4 +---
accel/tcg/cpu-exec.c | 2 +-
tests/tcg/arm/fcvt.c | 8 +++-----
6 files changed, 13 insertions(+), 49 deletions(-)
diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h
index c1d211a351..8f4b3a80fb 100644
--- a/include/qemu/atomic.h
+++ b/include/qemu/atomic.h
@@ -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 !QEMU_GNUC_PREREQ(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
diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h
index c76281f354..e391de15ef 100644
--- a/include/qemu/compiler.h
+++ b/include/qemu/compiler.h
@@ -44,10 +44,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
@@ -104,20 +100,14 @@
sizeof(QEMU_BUILD_BUG_ON_STRUCT(x)))
#if defined __GNUC__
-# if !QEMU_GNUC_PREREQ(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
+# 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)
+# define GCC_FMT_ATTR(n, m)
#endif
#ifndef __has_warning
diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h
index bab8b0d4b3..5775e82c4e 100644
--- a/include/qemu/qemu-plugin.h
+++ b/include/qemu/qemu-plugin.h
@@ -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;
diff --git a/tools/virtiofsd/fuse_common.h b/tools/virtiofsd/fuse_common.h
index 5aee5193eb..2f073578fe 100644
--- a/tools/virtiofsd/fuse_common.h
+++ b/tools/virtiofsd/fuse_common.h
@@ -810,9 +810,7 @@ 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
+#if defined(__GNUC__) && !defined __cplusplus
_Static_assert(sizeof(off_t) == 8, "fuse: off_t must be 64bit");
#else
struct _fuse_off_t_must_be_64bit_dummy_struct {
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 58aea605d8..37a88edb6d 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -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__)
/* 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.
diff --git a/tests/tcg/arm/fcvt.c b/tests/tcg/arm/fcvt.c
index 617626bc63..7ac47b564e 100644
--- a/tests/tcg/arm/fcvt.c
+++ b/tests/tcg/arm/fcvt.c
@@ -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,
--
2.29.0