summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2013-07-23 09:49:57 +0200
committerLuboš Luňák <l.lunak@suse.cz>2013-07-23 09:52:11 +0200
commit92dfa82d2d25f2acdee0a538bf15f1fac36c0ecf (patch)
tree7054baae8356a17f7ae69ecd48cee9cd8aca4277 /configure.ac
parent0d2a7adf4e12b08bb6017df03e6e4ea04acc5df5 (diff)
adjust for upstreaming of warn_unused attribute
The warn_unused attribute has been upstream to GCC and Clang, so use it if present. Still warn about STL types if those do not use it yet (which is the status as of now). Change-Id: I3c003e44c08d1d141e23bba38cf92e663a5ac353
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac28
1 files changed, 28 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index add4a6bbd8c8..1147e4dddf37 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5668,6 +5668,34 @@ if test "$GCC" = "yes"; then
AC_MSG_RESULT([yes])
], [AC_MSG_RESULT([no])])
AC_LANG_POP([C++])
+
+ AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
+ AC_LANG_PUSH([C++])
+ save_CXXFLAGS=$CXXFLAGS
+ CXXFLAGS="$CFLAGS -Werror -Wunknown-pragmas"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+ struct __attribute__((warn_unused)) dummy {};
+ ])], [
+ AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
+ AC_MSG_RESULT([yes])
+ ], [AC_MSG_RESULT([no])])
+ CXXFLAGS=$save_CXXFLAGS
+ AC_LANG_POP([C++])
+
+ AC_MSG_CHECKING([whether STL uses __attribute__((warn_unused))])
+ AC_LANG_PUSH([C++])
+ save_CXXFLAGS=$CXXFLAGS
+ CXXFLAGS="$CFLAGS -Werror -Wunused"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+ #include <string>
+ void f() { std::string s; }
+ ])], [
+ AC_MSG_RESULT([no])
+ ], [
+ AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED_STL],[1])
+ AC_MSG_RESULT([yes])])
+ CXXFLAGS=$save_CXXFLAGS
+ AC_LANG_POP([C++])
fi
AC_SUBST(HAVE_GCC_NO_LONG_DOUBLE)