diff mbox series

[PULL,24/54] compiler.h: Add an explicit check for the compiler version

Message ID 1544628195-37728-25-git-send-email-pbonzini@redhat.com (mailing list archive)
State New, archived
Headers show
Series [PULL,01/54] accel: Improve selection of the default accelerator | expand

Commit Message

Paolo Bonzini Dec. 12, 2018, 3:22 p.m. UTC
From: Thomas Huth <thuth@redhat.com>

The questions about our minimum compiler requirement pops up every
couple of months, and we then have to recall the details each time.
So let's document this in a proper way, by adding a comment and
check for the right compiler version to our compiler.h header.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1543574620-17506-1-git-send-email-thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/qemu/compiler.h | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Thomas Huth Dec. 12, 2018, 3:59 p.m. UTC | #1
On 2018-12-12 16:22, Paolo Bonzini wrote:
> From: Thomas Huth <thuth@redhat.com>
> 
> The questions about our minimum compiler requirement pops up every
> couple of months, and we then have to recall the details each time.
> So let's document this in a proper way, by adding a comment and
> check for the right compiler version to our compiler.h header.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> Message-Id: <1543574620-17506-1-git-send-email-thuth@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  include/qemu/compiler.h | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h
> index 6b92710..6f32ec2 100644
> --- a/include/qemu/compiler.h
> +++ b/include/qemu/compiler.h
> @@ -22,6 +22,14 @@
>  # define QEMU_GNUC_PREREQ(maj, min) 0
>  #endif
>  
> +/*
> + * We need at least GCC 4.1 for atomics support. Clang also supports these,
> + * and reports itself as GCC 4.2, so it passes this check, too.
> + */
> +#if !QEMU_GNUC_PREREQ(4, 1)
> +#error QEMU needs a compiler that is compatible with GCC v4.1 or newer
> +#endif

You can drop this patch, it has been obsoleted by the configure check.

 Thomas
diff mbox series

Patch

diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h
index 6b92710..6f32ec2 100644
--- a/include/qemu/compiler.h
+++ b/include/qemu/compiler.h
@@ -22,6 +22,14 @@ 
 # define QEMU_GNUC_PREREQ(maj, min) 0
 #endif
 
+/*
+ * We need at least GCC 4.1 for atomics support. Clang also supports these,
+ * and reports itself as GCC 4.2, so it passes this check, too.
+ */
+#if !QEMU_GNUC_PREREQ(4, 1)
+#error QEMU needs a compiler that is compatible with GCC v4.1 or newer
+#endif
+
 #define QEMU_NORETURN __attribute__ ((__noreturn__))
 
 #define QEMU_WARN_UNUSED_RESULT __attribute__((warn_unused_result))