diff --git a/Makefile b/Makefile index f80e68eb9..2b0c212c8 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,7 @@ CXXFLAGS+= -Wall -Wextra -Wno-unused-parameter -Wno-ignored-qualifiers ifdef HAVE_GCC CXXFLAGS+= -Wno-multichar -Wunused -fno-rtti -Woverloaded-virtual -Wnon-virtual-dtor -std=c++14 endif -ifdef HAVE_CLANG +ifdef CLANG_WARNINGS CXXFLAGS+= -Weverything -Wno-c++17-extensions -Wno-c++98-compat -Wno-c++98-compat-pedantic \ -Wno-double-promotion -Wno-switch-enum -Wno-conversion -Wno-covered-switch-default \ -Wno-inconsistent-missing-destructor-override \ diff --git a/configure b/configure index 648452860..169657f2b 100755 --- a/configure +++ b/configure @@ -414,12 +414,16 @@ if test "$have_clang" = yes; then cxx_version="$cxx_version, bad" cxx_verc_fail=yes fi + + # Only clang >= 5.0 supports extra warnings + if [ $clang_major -ge 5 ]; then + _make_def_CLANG_WARNINGS='CLANG_WARNINGS = 1' + fi fi CXXFLAGS="$CXXFLAGS" _make_def_HAVE_GCC3='HAVE_GCC3 = 1' add_line_to_config_mk 'CXX_UPDATE_DEP_FLAG = -MMD -MF "$(*D)/$(DEPDIR)/$(*F).d" -MQ "$@" -MP' _make_def_HAVE_GCC='HAVE_GCC = 1' - _make_def_HAVE_CLANG='HAVE_CLANG = 1' echo "$cxx_version" elif test "$have_gcc" = yes; then @@ -817,7 +821,7 @@ PROFILE := $_build_profile $_make_def_HAVE_GCC $_make_def_HAVE_GCC3 -$_make_def_HAVE_CLANG +$_make_def_CLANG_WARNINGS INCLUDES += $INCLUDES OBJS += $OBJS