mirror of
https://github.com/MariaDB/server.git
synced 2025-03-26 08:58:40 +01:00
MDEV-31890: Compilation failing on MacOS (unknown warning option -Wno-unused-but-set-variable)
For clang compiler the compiler's flag -Wno-unused-but-set-variable was set based on compiler version. This approach could result in false positive detection for presence of compiler option since only first three groups of digits in compiler version taken into account and it could lead to inaccuracy in determining of supported compiler's features. Correct way to detect options supported by a compiler is to use the macros MY_CHECK_CXX_COMPILER_FLAG and to check the result of variable with prefix have_CXX__ So, to check whether compiler does support the option -Wno-unused-but-set-variable the macros MY_CHECK_CXX_COMPILER_FLAG(-Wno-unused-but-set-variable) should be called and the result variable have_CXX__Wno_unused_but_set_variable be tested for assigned value.
This commit is contained in:
parent
02878f128e
commit
1fde785315
2 changed files with 5 additions and 4 deletions
|
@ -153,8 +153,8 @@ SET (SQL_SOURCE
|
|||
${MYSYS_LIBWRAP_SOURCE}
|
||||
)
|
||||
|
||||
IF(CMAKE_C_COMPILER_ID MATCHES "Clang" AND
|
||||
NOT CMAKE_C_COMPILER_VERSION VERSION_LESS "13.0.0")
|
||||
MY_CHECK_CXX_COMPILER_FLAG(-Wno-unused-but-set-variable)
|
||||
IF(have_CXX__Wno_unused_but_set_variable)
|
||||
ADD_COMPILE_FLAGS(${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.cc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/sql_yacc_ora.cc
|
||||
COMPILE_FLAGS "-Wno-unused-but-set-variable")
|
||||
|
|
|
@ -358,8 +358,9 @@ IF(MSVC)
|
|||
# on generated file.
|
||||
TARGET_COMPILE_OPTIONS(innobase PRIVATE "/wd4065")
|
||||
ENDIF()
|
||||
IF(CMAKE_C_COMPILER_ID MATCHES "Clang" AND
|
||||
NOT CMAKE_C_COMPILER_VERSION VERSION_LESS "13.0.0")
|
||||
|
||||
MY_CHECK_CXX_COMPILER_FLAG(-Wno-unused-but-set-variable)
|
||||
IF(have_CXX__Wno_unused_but_set_variable)
|
||||
ADD_COMPILE_FLAGS(pars/pars0grm.cc fts/fts0pars.cc
|
||||
COMPILE_FLAGS "-Wno-unused-but-set-variable")
|
||||
ENDIF()
|
||||
|
|
Loading…
Add table
Reference in a new issue