summaryrefslogtreecommitdiff
path: root/compilerplugins
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 /compilerplugins
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 'compilerplugins')
-rw-r--r--compilerplugins/clang/unusedvariablecheck.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/compilerplugins/clang/unusedvariablecheck.cxx b/compilerplugins/clang/unusedvariablecheck.cxx
index a0763ac2f11d..86f405db0f7c 100644
--- a/compilerplugins/clang/unusedvariablecheck.cxx
+++ b/compilerplugins/clang/unusedvariablecheck.cxx
@@ -8,6 +8,13 @@
*
*/
+#include <config_global.h>
+
+// If there is support for warn_unused attribute even in STL classes, then there's
+// no point in having this check enabled, otherwise keep it at least for STL
+// (LO classes won't get duplicated warnings, as the attribute is different).
+#if !HAVE_GCC_ATTRIBUTE_WARN_UNUSED_STL
+
#include "unusedvariablecheck.hxx"
#include <clang/AST/Attr.h>
@@ -101,3 +108,5 @@ bool UnusedVariableCheck::VisitVarDecl( const VarDecl* var )
static Plugin::Registration< UnusedVariableCheck > X( "unusedvariablecheck" );
} // namespace
+
+#endif