[libvirt] [PATCH] maint: show which compiler warning triggered

Eric Blake eblake at redhat.com
Tue Mar 30 16:44:57 UTC 2010


* acinclude.m4 (LIBVIRT_COMPILE_WARNINGS): Add
-fdiagnostics-show-option.
---

Here's an example of how things change, when using './configure
--enable-compiler-warnings=error' and introducing something gcc
would warn about:

  CC     libvirt_driver_nwfilter_la-nwfilter_ebiptables_driver.lo
cc1: warnings being treated as errors
nwfilter/nwfilter_ebiptables_driver.c: In function '_iptablesCreateRuleInstance':
nwfilter/nwfilter_ebiptables_driver.c:1059: error: unused variable 'oops' [-Wunused-variable]


 acinclude.m4 |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index f00933f..7fa2d67 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -13,13 +13,17 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
     dnl ******************************

     AC_ARG_ENABLE(compile-warnings,
-                  AC_HELP_STRING([--enable-compile-warnings=@<:@no/minimum/yes/maximum/error@:>@],
-                                 [Turn on compiler warnings]),,
+                  [AC_HELP_STRING([--enable-compile-warnings=@<:@no/minimum/yes/maximum/error@:>@],
+                                 [Turn on compiler warnings])],,
                   [enable_compile_warnings="m4_default([$1],[maximum])"])

     warnCFLAGS=

-    common_flags="-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fasynchronous-unwind-tables"
+    common_flags=
+    common_flags="$common_flags -Wp,-D_FORTIFY_SOURCE=2"
+    common_flags="$common_flags -fexceptions"
+    common_flags="$common_flags -fasynchronous-unwind-tables"
+    common_flags="$common_flags -fdiagnostics-show-option"

     case "$enable_compile_warnings" in
     no)
-- 
1.6.6.1




More information about the libvir-list mailing list