This is a funny one: gcc and clang silently accept the [[deprecated]]
and [[fallthrough]] attributes which are introduced in the C++17
standard - even when the compiler is configured only with C++14 support.
BUT, clang will issue a warning that the attributes are not supported if
compiled with -pedantic. Thus, we have to check for support of the
attributes with -pedantic set.
#
# Some compilers are too generous in accepting some of the language
# features that we test below and do not issue an error but a warning. Set
-# -Werror to make the feature detection more reliable.
+# -pedantic -Werror to make the feature detection more reliable.
#
set(_werror_flag "")
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
enable_if_supported(_werror_flag "/WX /EHsc")
else()
+ enable_if_supported(_werror_flag "-pedantic")
enable_if_supported(_werror_flag "-Werror")
enable_if_supported(_werror_flag "-Wno-unused-command-line-argument")
endif()
In the beginning the Universe was created. This has made a lot of
people very angry and has been widely regarded as a bad move.
Douglas Adams