[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC v2 1/9] configure: test if _Generic works as expected
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [RFC v2 1/9] configure: test if _Generic works as expected |
Date: |
Wed, 29 Mar 2017 16:41:40 -0300 |
Test if _Generic works as expected, and set HAVE_C11_GENERIC
config variable if it does.
Signed-off-by: Eduardo Habkost <address@hidden>
---
configure | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/configure b/configure
index d1ce33bc79..b29bce0b53 100755
--- a/configure
+++ b/configure
@@ -1548,6 +1548,22 @@ EOF
fi
fi
+# Ensure we support _Generic, and that it takes type qualifiers into account
+have_c11_generic=
+cat > $TMPC << EOF
+const int *p;
+typedef typeof(_Generic(p,
+ const int *: (int *)0,
+ int *: 0,
+ default: 0)) T;
+T foo;
+int x(void);
+int x(void) { return *foo; }
+EOF
+if do_cc $QEMU_CFLAGS -Werror -c -o $TMPO $TMPC;then
+ have_c11_generic=yes
+fi
+
# Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and
# large functions that use global variables. The bug is in all releases of
# GCC, but it became particularly acute in 4.6.x and 4.7.x. It is fixed in
@@ -5751,6 +5767,10 @@ if test "$have_sysmacros" = "yes" ; then
echo "CONFIG_SYSMACROS=y" >> $config_host_mak
fi
+if test "$have_c11_generic" = "yes" ; then
+ echo "HAVE_C11_GENERIC=y" >> $config_host_mak
+fi
+
# Hold two types of flag:
# CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on
# a thread we have a handle to
--
2.11.0.259.g40922b1
- [Qemu-devel] [RFC v2 0/9] qom: Make object_get_class()/*_GET_CLASS return const pointers, Eduardo Habkost, 2017/03/29
- [Qemu-devel] [RFC v2 2/9] Simplify code using *MACHINE_GET_CLASS, Eduardo Habkost, 2017/03/29
- [Qemu-devel] [RFC v2 1/9] configure: test if _Generic works as expected,
Eduardo Habkost <=
- [Qemu-devel] [RFC v2 3/9] qom: QUALIFIED_CAST helper macro, Eduardo Habkost, 2017/03/29
- [Qemu-devel] [RFC v2 4/9] qom: Make object_class_get_parent() const-aware, Eduardo Habkost, 2017/03/29
- [Qemu-devel] [RFC v2 5/9] Make class parameter const at some functions, Eduardo Habkost, 2017/03/29
- [Qemu-devel] [RFC v2 6/9] Explicitly cast the *_GET_CLASS() value when we break the rules, Eduardo Habkost, 2017/03/29
- [Qemu-devel] [RFC v2 8/9] qom: Make class cast macros/functions const-aware, Eduardo Habkost, 2017/03/29
- [Qemu-devel] [RFC v2 9/9] qom: Make object_get_class() return const pointer, Eduardo Habkost, 2017/03/29
- Re: [Qemu-devel] [RFC v2 0/9] qom: Make object_get_class()/*_GET_CLASS return const pointers, Laszlo Ersek, 2017/03/29
- Re: [Qemu-devel] [RFC v2 0/9] qom: Make object_get_class()/*_GET_CLASS return const pointers, Eduardo Habkost, 2017/03/29
- [Qemu-devel] [RFC v2 7/9] Use const variables for *_GET_CLASS values, Eduardo Habkost, 2017/03/29