Skip to content

Commit 376fecc

Browse files
authored
CI: Fix unsupported warnings on macOS workflows. (#728)
-W(no-)format-truncation warning were only added in LLVM 18, and Apple Clang 17 (from Xcode 16.3).
1 parent dedf483 commit 376fecc

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

prboom2/cmake/DsdaTargetFeatures.cmake

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ function(dsda_internal_setup_warnings_gnu result_var)
2222
"-Wno-unused-function"
2323
"-Wno-switch"
2424
"-Wno-sign-compare"
25-
"-Wno-format-truncation"
2625
"-Wno-missing-field-initializers"
2726
)
2827
set(GNU_C_WARNINGS
@@ -33,6 +32,13 @@ function(dsda_internal_setup_warnings_gnu result_var)
3332
)
3433
set(GNU_WARNINGS_SET ${GNU_WARNINGS} ${GNU_C_WARNINGS})
3534

35+
if(CMAKE_C_COMPILER_ID STREQUAL "GNU"
36+
OR (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 18)
37+
OR (CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 17)
38+
)
39+
list(APPEND GNU_WARNINGS_SET "-Wno-format-truncation")
40+
endif()
41+
3642
include(CheckCCompilerFlag)
3743
check_c_compiler_flag("${GNU_WARNINGS_SET}" DSDA_SUPPORTS_GNU_WARNINGS)
3844

@@ -99,7 +105,7 @@ endfunction()
99105

100106
function(dsda_target_set_warnings tgt)
101107
dsda_fail_if_invalid_target(${tgt})
102-
108+
103109
if(NOT DEFINED CACHE{DSDA_ENABLED_WARNINGS})
104110
dsda_internal_setup_warnings()
105111
endif()

0 commit comments

Comments
 (0)