qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] clang: Disable warning about expansion to 'defined'


From: Pranith Kumar
Subject: [Qemu-devel] [PATCH] clang: Disable warning about expansion to 'defined'
Date: Mon, 8 Aug 2016 22:35:44 -0400

Clang produces the following warning. The warning is detailed here:
https://reviews.llvm.org/D15866. Disable the warning.

/home/pranith/devops/code/qemu/hw/display/qxl.c:507:5: warning: macro expansion 
producing 'defined' has undefined behavior [-Wexpansion-to-defined]
#if SPICE_NEEDS_SET_MM_TIME
    ^
/home/pranith/devops/code/qemu/include/ui/qemu-spice.h:46:5: note: expanded 
from macro 'SPICE_NEEDS_SET_MM_TIME'
  (!defined(SPICE_SERVER_VERSION) || (SPICE_SERVER_VERSION < 0xc06))
    ^
/home/pranith/devops/code/qemu/hw/display/qxl.c:1074:5: warning: macro 
expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined]
#if SPICE_NEEDS_SET_MM_TIME
    ^
/home/pranith/devops/code/qemu/include/ui/qemu-spice.h:46:5: note: expanded 
from macro 'SPICE_NEEDS_SET_MM_TIME'
  (!defined(SPICE_SERVER_VERSION) || (SPICE_SERVER_VERSION < 0xc06))

Signed-off-by: Pranith Kumar <address@hidden>
---
 configure | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/configure b/configure
index f57fcc6..a1a6e3f 100755
--- a/configure
+++ b/configure
@@ -3025,6 +3025,19 @@ if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; 
then
     fi
 fi
 
+# Silence clang warnings about expansion to 'defined' in macro
+cat > $TMPC << EOF
+#define TEST (defined(DUMMY))
+#if TEST
+int main(void) { return 0; }
+#endif
+EOF
+if ! compile_prog "-Werror" ; then
+    if cc_has_warning_flag "-Wno-expansion-to-defined"; then
+       CFLAGS="-Wno-expansion-to-defined $CFLAGS"
+    fi
+fi
+
 ##########################################
 # SHA command probe for modules
 if test "$modules" = yes; then
-- 
2.9.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]