Drop HAVE_GCC_ATTRIBUTE_WARN_UNUSED_STL
For one, loplugin:unusedvariablecheck does not merely check for unused variables
with types from the standard library since
fe2164949b
"teach unusedvariablecheck plugin about
SfxPoolItem subclasses", so disabling loplugin:unusedvariablecheck based on
HAVE_GCC_ATTRIBUTE_WARN_UNUSED_STL is wrong.
For another, I have seen no standard library implementation that decorates its
types with such "warn-if-unused" attributes, and
<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0600r0.pdf>
"[[nodiscard]] in the Library" (which proposes to add the corresponding C++17
attribute to just a few select functions and no types at all) makes it appear
unlikely that will happen.
Change-Id: I0a7759e1caf3e3137057c9689080948a4d6747e0
This commit is contained in:
@@ -11,11 +11,6 @@
|
||||
|
||||
#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 "compat.hxx"
|
||||
#include "check.hxx"
|
||||
#include "unusedvariablecheck.hxx"
|
||||
@@ -81,6 +76,4 @@ static Plugin::Registration< UnusedVariableCheck > X( "unusedvariablecheck" );
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
@@ -22,7 +22,5 @@ Any change in this header will cause a rebuild of almost everything.
|
||||
#define HAVE_SYSLOG_H 0
|
||||
/* Compiler supports __attribute__((warn_unused)). */
|
||||
#define HAVE_GCC_ATTRIBUTE_WARN_UNUSED 0
|
||||
/* C++ library uses __attribute__((warn_unused)) for basic types like std::string. */
|
||||
#define HAVE_GCC_ATTRIBUTE_WARN_UNUSED_STL 0
|
||||
|
||||
#endif
|
||||
|
15
configure.ac
15
configure.ac
@@ -5904,21 +5904,6 @@ if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
|
||||
], [AC_MSG_RESULT([no])])
|
||||
AC_LANG_POP([C++])
|
||||
|
||||
AC_MSG_CHECKING([whether STL uses __attribute__((warn_unused))])
|
||||
AC_LANG_PUSH([C++])
|
||||
save_CXXFLAGS=$CXXFLAGS
|
||||
CXXFLAGS="$CXXFLAGS -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++])
|
||||
|
||||
AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
|
||||
AC_LANG_PUSH([C++])
|
||||
save_CXXFLAGS=$CXXFLAGS
|
||||
|
Reference in New Issue
Block a user