[Spice-devel] [PATCH 2/2] configure.ac: remove detection of WARN_UNUSED_RESULT

Christophe Fergeau cfergeau at gmail.com
Fri Apr 1 09:19:12 PDT 2011


spice configure.ac has some code to detect if the compiler has
a special attribute to tag some functions so that they generate a
warning when their return value isn't checked. However, this test
is broken (the gcc attribute name is "warn_unused_result", not
"__warn_unused_result__" and WARN_UNUSED_RESULT is unused anyway
since spice-protocol provides SPICE_GNUC_WARN_UNUSED_RESULT. Thus
we can just drop that block of code from configure.ac
---
 configure.ac |   14 --------------
 1 files changed, 0 insertions(+), 14 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5580a5d..0a4e734 100644
--- a/configure.ac
+++ b/configure.ac
@@ -459,20 +459,6 @@ if test $os_win32 == "yes" ; then
     AC_SUBST(WINDRES)
 fi
 
-# We only wish to enable attribute(warn_unused_result) if we can prevent
-# gcc from generating thousands of warnings about the misapplication of the
-# attribute to void functions and variables.
-AC_MSG_CHECKING([how to enable unused result warnings])
-warn_unused_result=""
-if echo $WARN_CFLAGS | grep -e '-Wno-attributes' >/dev/null; then
-    AC_TRY_COMPILE([__attribute__((__warn_unused_result__))
-	int f (int i) { return i; }], [],
-	[warn_unused_result="__attribute__((__warn_unused_result__))"])
-fi
-AC_DEFINE_UNQUOTED([WARN_UNUSED_RESULT], [$warn_unused_result],
-	  [Define to the value your compiler uses to support the warn-unused-result attribute])
-AC_MSG_RESULT([$warn_unused_result])
-
 AC_SUBST(WARN_CFLAGS)
 AC_SUBST(CFLAGS_CFLAGS)
 
-- 
1.7.4.2



More information about the Spice-devel mailing list