Skip to content

Commit 839add1

Browse files
committed
build: Enable -Wsuggest-override
1 parent de5e91c commit 839add1

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

configure.ac

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,10 @@ if test "x$enable_werror" = "xyes"; then
368368
AX_CHECK_COMPILE_FLAG([-Werror=return-type],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=return-type"],,[[$CXXFLAG_WERROR]])
369369
AX_CHECK_COMPILE_FLAG([-Werror=conditional-uninitialized],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=conditional-uninitialized"],,[[$CXXFLAG_WERROR]])
370370
AX_CHECK_COMPILE_FLAG([-Werror=sign-compare],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=sign-compare"],,[[$CXXFLAG_WERROR]])
371+
dnl -Wsuggest-override is broken with GCC before 9.2
372+
dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78010
373+
AX_CHECK_COMPILE_FLAG([-Werror=suggest-override],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=suggest-override"],,[[$CXXFLAG_WERROR]],
374+
[AC_LANG_SOURCE([[struct A { virtual void f(); }; struct B : A { void f() final; };]])])
371375
fi
372376

373377
if test "x$CXXFLAGS_overridden" = "xno"; then
@@ -385,6 +389,8 @@ if test "x$CXXFLAGS_overridden" = "xno"; then
385389
AX_CHECK_COMPILE_FLAG([-Wdate-time],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wdate-time"],,[[$CXXFLAG_WERROR]])
386390
AX_CHECK_COMPILE_FLAG([-Wconditional-uninitialized],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wconditional-uninitialized"],,[[$CXXFLAG_WERROR]])
387391
AX_CHECK_COMPILE_FLAG([-Wsign-compare],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wsign-compare"],,[[$CXXFLAG_WERROR]])
392+
AX_CHECK_COMPILE_FLAG([-Wsuggest-override],[WARN_CXXFLAGS="$WARN_CXXFLAGS -Wsuggest-override"],,[[$CXXFLAG_WERROR]],
393+
[AC_LANG_SOURCE([[struct A { virtual void f(); }; struct B : A { void f() final; };]])])
388394

389395
dnl Some compilers (gcc) ignore unknown -Wno-* options, but warn about all
390396
dnl unknown options if any other warning is produced. Test the -Wfoo case, and

src/Makefile.leveldb.include

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ LEVELDB_CPPFLAGS_INT += -DLEVELDB_PLATFORM_POSIX
3636
endif
3737

3838
leveldb_libleveldb_a_CPPFLAGS = $(AM_CPPFLAGS) $(LEVELDB_CPPFLAGS_INT) $(LEVELDB_CPPFLAGS)
39-
leveldb_libleveldb_a_CXXFLAGS = $(filter-out -Wconditional-uninitialized -Werror=conditional-uninitialized, $(AM_CXXFLAGS)) $(PIE_FLAGS)
39+
leveldb_libleveldb_a_CXXFLAGS = $(filter-out -Wconditional-uninitialized -Werror=conditional-uninitialized -Wsuggest-override -Werror=suggest-override, $(AM_CXXFLAGS)) $(PIE_FLAGS)
4040

4141
leveldb_libleveldb_a_SOURCES=
4242
leveldb_libleveldb_a_SOURCES += leveldb/port/port_stdcxx.h

src/wallet/db.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,14 @@
1919
#include <unordered_map>
2020
#include <vector>
2121

22+
#if defined(__GNUC__) && !defined(__clang__)
23+
#pragma GCC diagnostic push
24+
#pragma GCC diagnostic ignored "-Wsuggest-override"
25+
#endif
2226
#include <db_cxx.h>
27+
#if defined(__GNUC__) && !defined(__clang__)
28+
#pragma GCC diagnostic pop
29+
#endif
2330

2431
struct bilingual_str;
2532

0 commit comments

Comments
 (0)