Merge pull request #10630 from akallabeth/disable-ctad-maybe-unuspported

[build,c++] add CXXCompilerFlags to (un)set warnings
This commit is contained in:
akallabeth 2024-09-20 10:48:56 +02:00 committed by GitHub
commit 7a607dbc53
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 73 additions and 4 deletions

View File

@ -39,6 +39,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/)
include(CommonConfigOptions) include(CommonConfigOptions)
include(ConfigureFreeRDP) include(ConfigureFreeRDP)
include(CXXCompilerFlags)
option(WITH_DEBUG_SDL_EVENTS "[dangerous, not for release builds!] Debug SDL events" ${DEFAULT_DEBUG_OPTION}) option(WITH_DEBUG_SDL_EVENTS "[dangerous, not for release builds!] Debug SDL events" ${DEFAULT_DEBUG_OPTION})
option(WITH_DEBUG_SDL_KBD_EVENTS "[dangerous, not for release builds!] Debug SDL keyboard events" ${DEFAULT_DEBUG_OPTION}) option(WITH_DEBUG_SDL_KBD_EVENTS "[dangerous, not for release builds!] Debug SDL keyboard events" ${DEFAULT_DEBUG_OPTION})

View File

@ -33,8 +33,8 @@
#include <freerdp/log.h> #include <freerdp/log.h>
#define TAG CLIENT_TAG("sdl.disp") #define TAG CLIENT_TAG("sdl.disp")
#define RESIZE_MIN_DELAY 200 /* minimum delay in ms between two resizes */ static constexpr UINT64 RESIZE_MIN_DELAY = 200; /* minimum delay in ms between two resizes */
#define MAX_RETRIES 5 static constexpr unsigned MAX_RETRIES = 5;
BOOL sdlDispContext::settings_changed() BOOL sdlDispContext::settings_changed()
{ {

View File

@ -33,8 +33,8 @@
#include <freerdp/log.h> #include <freerdp/log.h>
#define TAG CLIENT_TAG("sdl.disp") #define TAG CLIENT_TAG("sdl.disp")
#define RESIZE_MIN_DELAY 200 /* minimum delay in ms between two resizes */ static constexpr UINT64 RESIZE_MIN_DELAY = 200; /* minimum delay in ms between two resizes */
#define MAX_RETRIES 5 static constexpr unsigned MAX_RETRIES = 5;
BOOL sdlDispContext::settings_changed() BOOL sdlDispContext::settings_changed()
{ {

View File

@ -0,0 +1,64 @@
include(CheckCXXCompilerFlag)
macro (checkCXXFlag FLAG)
check_cxx_compiler_flag("${FLAG}" CXXFLAG${FLAG})
if(CXXFLAG${FLAG})
string(APPEND CMAKE_CXX_FLAGS " ${FLAG}")
else()
message(WARNING "compiler does not support ${FLAG}")
endif()
endmacro()
option(ENABLE_WARNING_VERBOSE "enable -Weveryting (and some exceptions) for compile" ON)
option(ENABLE_WARNING_ERROR "enable -Werror for compile" OFF)
if (ENABLE_WARNING_VERBOSE)
if (MSVC)
# Remove previous warning definitions,
# NMake is otherwise complaining.
foreach (flags_var_to_scrub
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_MINSIZEREL)
string (REGEX REPLACE "(^| )[/-]W[ ]*[1-9]" " "
"${flags_var_to_scrub}" "${${flags_var_to_scrub}}")
endforeach()
set(C_WARNING_FLAGS
/W4
/wo4324
)
else()
set(C_WARNING_FLAGS
-Weverything
-Wall
-Wpedantic
-Wno-padded
-Wno-switch-enum
-Wno-cast-align
-Wno-declaration-after-statement
-Wno-unsafe-buffer-usage
-Wno-reserved-identifier
-Wno-covered-switch-default
-Wno-disabled-macro-expansion
-Wno-ctad-maybe-unsupported
-Wno-c++98-compat
-Wno-c++98-compat-pedantic
-Wno-pre-c++17-compat
)
endif()
foreach(FLAG ${C_WARNING_FLAGS})
CheckCXXFlag(${FLAG})
endforeach()
endif()
if (ENABLE_WARNING_ERROR)
CheckCXXFlag(-Werror)
endif()
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "default CXXFLAGS")
message("Using CXXFLAGS ${CMAKE_CXX_FLAGS}")

View File

@ -42,6 +42,7 @@ if (ENABLE_WARNING_VERBOSE)
-Wno-unsafe-buffer-usage -Wno-unsafe-buffer-usage
-Wno-reserved-identifier -Wno-reserved-identifier
-Wno-covered-switch-default -Wno-covered-switch-default
-Wno-disabled-macro-expansion
) )
endif() endif()

View File

@ -44,6 +44,7 @@ message("project ${PROJECT_NAME} is using version ${PROJECT_VERSION}")
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../cmake/) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../cmake/)
include(CommonConfigOptions) include(CommonConfigOptions)
include(CXXCompilerFlags)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)

View File

@ -37,6 +37,7 @@ message("project ${PROJECT_NAME} is using version ${PROJECT_VERSION}")
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../cmake/) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../cmake/)
include(CommonConfigOptions) include(CommonConfigOptions)
include(CXXCompilerFlags)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)

View File

@ -36,6 +36,7 @@ message("project ${PROJECT_NAME} is using version ${PROJECT_VERSION}")
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../cmake/) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../cmake/)
include(CommonConfigOptions) include(CommonConfigOptions)
include(CXXCompilerFlags)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)