aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <chris.kcat@gmail.com>2022-12-05 22:29:26 -0800
committerChris Robinson <chris.kcat@gmail.com>2022-12-05 22:29:26 -0800
commit25a6814cf36bee82b24cb1b5f40769e66c327db4 (patch)
tree7e1d535174863b25d37ce6f7f1c9cf2f3db655fa
parentc55d6d8c345223c062dfdbd747fb13a8fd44aad5 (diff)
Don't warn for attributes being in a later standard
C++ specifies that unknown attributes should be ignored and aren't an error. Clang issues a warning when encountering a known attribute from newer standard version than the target version. GCC recognizes attributes from newer standard versions it's aware of, allowing improved compilation capabilities. Hopefully Clang (and MSVC) will take advantage since it recognizes them, even if they weren't standardized for the target version, but there's no need to warn about known attributes in either case.
-rw-r--r--CMakeLists.txt5
1 files changed, 5 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 30820f91..e20770bc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -258,6 +258,11 @@ else()
-Wpedantic
$<$<COMPILE_LANGUAGE:CXX>:-Wold-style-cast -Wnon-virtual-dtor -Woverloaded-virtual>)
+ check_cxx_compiler_flag(-Wno-c++20-attribute-extensions HAVE_WNO_CXX20_ATTR_EXT)
+ if(HAVE_WNO_CXX20_ATTR_EXT)
+ set(C_FLAGS ${C_FLAGS} $<$<COMPILE_LANGUAGE:CXX>:-Wno-c++20-attribute-extensions>)
+ endif()
+
if(ALSOFT_WERROR)
set(C_FLAGS ${C_FLAGS} -Werror)
endif()