mirror of
https://github.com/transmission/transmission
synced 2025-03-04 02:28:03 +00:00
Require C11, switch to standard static_assert
This commit is contained in:
parent
5125feca5d
commit
077f4d8d2b
2 changed files with 6 additions and 9 deletions
|
@ -383,14 +383,14 @@ endif()
|
|||
## Compiler standard version
|
||||
|
||||
if(CMAKE_VERSION VERSION_LESS "3.1")
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++17")
|
||||
elseif(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17")
|
||||
endif()
|
||||
else()
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
|
|
@ -139,15 +139,12 @@
|
|||
* @def TR_STATIC_ASSERT
|
||||
* @brief This helper allows to perform static checks at compile time
|
||||
*/
|
||||
#if defined(static_assert)
|
||||
#if defined(__cplusplus) || defined(static_assert)
|
||||
#define TR_STATIC_ASSERT static_assert
|
||||
#elif __has_feature(c_static_assert) || __has_extension(c_static_assert)
|
||||
#elif __has_feature(c_static_assert) || __has_extension(c_static_assert) || TR_GNUC_CHECK_VERSION(4, 6)
|
||||
#define TR_STATIC_ASSERT _Static_assert
|
||||
#else
|
||||
#define TR_STATIC_ASSERT(x, msg) \
|
||||
{ \
|
||||
typedef char __tr_static_check__ [(x) ? 1 : -1] UNUSED; \
|
||||
}
|
||||
#define TR_STATIC_ASSERT(x, msg) (void)(x)
|
||||
#endif
|
||||
|
||||
/* Sometimes the system defines MAX/MIN, sometimes not.
|
||||
|
|
Loading…
Add table
Reference in a new issue