[CMAKE] Clang*: Add '-Werror=unknown-warning-option' for C/CXX (#6383)

* [UDFS] Clang: Fix a #pragma

'warning: unknown warning group '-Wstringop-overflow', ignored [-Wunknown-warning-option]'

Follow-up to 612b1f2e6 (0.4.15-dev-1129).

* [CREATESPEC] Clang: Fix a target_compile_options()

'warning: unknown warning option '-Wno-stringop-overflow'; did you mean '-Wno-shift-overflow'? [-Wunknown-warning-option]'

Addendum to 00ed72d7e (0.4.15-dev-1169).

* [MSVCRT_WINETEST] Clang*: Fix a target_compile_options()

'warning: unknown warning option '-Wno-stringop-truncation'; did you mean '-Wno-string-concatenation'? [-Wunknown-warning-option]'

Addendum to commits 00ed72d7e (0.4.15-dev-1169) then f155b9377 (0.4.15-dev-4612).

* [TELNET] Clang*: Fix a target_compile_options()

'warning: unknown warning option '-Wno-restrict' [-Wunknown-warning-option]'

Addendum to 447ef2aa4 (0.4.15-dev-4613).
This commit is contained in:
Serge Gautherie 2024-05-31 16:26:11 +02:00 committed by GitHub
parent b50ab0dc68
commit 3cc4361cca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 18 additions and 8 deletions

View file

@ -36,7 +36,10 @@ if (NOT MSVC)
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
target_compile_options(telnet PRIVATE -Wno-restrict $<$<COMPILE_LANGUAGE:CXX>:-Wno-narrowing>)
target_compile_options(telnet PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-Wno-narrowing>)
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
target_compile_options(telnet PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-Wno-restrict>)
endif()
endif()
set_module_type(telnet win32cui)

View file

@ -222,7 +222,7 @@ VOID inline MyFreePool__(PVOID addr) {
#endif //MY_MEM_BOUNDS_CHECK
/* This function just scares the hell out of GCC */
#ifdef __GNUC__
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-overflow"
#endif
@ -298,7 +298,7 @@ ULONG inline MyReallocPool__(PCHAR addr, ULONG len, PCHAR *pnewaddr, ULONG newle
*/
return newlen;
}
#ifdef __GNUC__
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif

View file

@ -2,8 +2,8 @@
add_executable(createspec createspec.c)
set_module_type(createspec win32cui)
target_link_libraries(createspec wine)
if(NOT MSVC)
target_compile_options(createspec PRIVATE -Wno-stringop-overflow)
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
target_compile_options(createspec PRIVATE $<$<COMPILE_LANGUAGE:C>:-Wno-stringop-overflow>)
endif()
add_importlibs(createspec dbghelp msvcrt kernel32)
add_cd_file(TARGET createspec DESTINATION reactos/system32 FOR all)

View file

@ -28,7 +28,10 @@ target_compile_definitions(msvcrt_winetest PRIVATE
__msvcrt_ulong=ULONG)
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
target_compile_options(msvcrt_winetest PRIVATE -Wno-format -Wno-stringop-truncation -Wno-overflow)
target_compile_options(msvcrt_winetest PRIVATE $<$<COMPILE_LANGUAGE:C>:-Wno-format -Wno-overflow>)
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
target_compile_options(msvcrt_winetest PRIVATE $<$<COMPILE_LANGUAGE:C>:-Wno-stringop-truncation>)
endif()
endif()
set_module_type(msvcrt_winetest win32cui)

View file

@ -96,6 +96,10 @@ add_compile_options(-march=${OARCH} -mtune=${TUNE})
# Warnings, errors
if((NOT CMAKE_BUILD_TYPE STREQUAL "Release") AND (NOT CMAKE_C_COMPILER_ID STREQUAL Clang))
add_compile_options(-Werror)
else()
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:-Werror=unknown-warning-option>)
endif()
endif()
add_compile_options(-Wall -Wpointer-arith)

View file

@ -23,8 +23,7 @@ endif()
add_compile_options(/GF)
# Enable function level linking and comdat folding (only C/C++, not ASM!)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/Gy>)
add_compile_options($<$<COMPILE_LANGUAGE:C>:/Gy>)
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/Gy>)
add_link_options(/OPT:REF /OPT:ICF)
if(ARCH STREQUAL "i386")
@ -145,6 +144,7 @@ endif()
add_compile_options(/w14115)
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:-Werror=unknown-warning-option>)
add_compile_options("$<$<COMPILE_LANGUAGE:C,CXX>:-nostdinc;-Wno-multichar;-Wno-char-subscripts;-Wno-microsoft-enum-forward-reference;-Wno-pragma-pack;-Wno-microsoft-anon-tag;-Wno-parentheses-equality;-Wno-unknown-pragmas>")
endif()