Skip to content

Commit a28a84b

Browse files
committed
s
fixed `-Wlifetime-safety-intra-tu-suggestions` Clang warnings disabled `-Wlifetime-safety-intra-tu-suggestions` Clang warning for now
1 parent 9089489 commit a28a84b

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
7373
add_compile_options_safe(-Wno-thread-safety-negative)
7474
add_compile_options_safe(-Wno-thread-safety-beta)
7575

76+
# TODO: check for proper AppleClang version
77+
# we do not add the annotation until C++20
78+
# the warning was introduced with Clang 23
79+
if(CMAKE_CXX_STANDARD LESS 20)
80+
add_compile_options_safe(-Wno-lifetime-safety-intra-tu-suggestions)
81+
endif()
82+
7683
# TODO: fix these?
7784
add_compile_options(-Wno-padded)
7885
add_compile_options(-Wno-sign-conversion)
@@ -83,6 +90,7 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
8390
# we are not interested in these
8491
set_source_files_properties(test.cpp PROPERTIES COMPILE_FLAGS "-Wno-multichar -Wno-four-char-constants")
8592

93+
# TODO: check for proper AppleClang version
8694
if (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 14 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 14)
8795
# TODO: verify this regression still exists in clang-15
8896
if (CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")

simplecpp.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@
4545
# include <sys/types.h>
4646
#endif
4747

48+
#if defined(__has_cpp_attribute)
49+
# if __has_cpp_attribute (clang::lifetimebound)
50+
# define SIMPLECPP_LIFETIMEBOUND [[clang::lifetimebound]]
51+
# else
52+
# define SIMPLECPP_LIFETIMEBOUND
53+
# endif
54+
#else
55+
# define SIMPLECPP_LIFETIMEBOUND
56+
#endif
57+
4858
#if defined(_MSC_VER)
4959
# pragma warning(push)
5060
// suppress warnings about "conversion from 'type1' to 'type2', possible loss of data"

0 commit comments

Comments
 (0)