Skip to content

Commit 06dd33c

Browse files
committed
build: try to ban GNU extensions
GNU extensions are inherently non-portable, and can cause regressions on other platforms. Attempt to catch the accidental use of GNU extensions early by using clang to identify them.
1 parent 14d9011 commit 06dd33c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,10 @@ if(MSVC OR "${CMAKE_SIMULATE_ID}" STREQUAL MSVC)
455455
include(ClangClCompileRules)
456456
endif()
457457

458+
if(CMAKE_C_COMPILER_ID STREQUAL Clang)
459+
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Werror=gnu>)
460+
endif()
461+
458462
if(CMAKE_SYSTEM_NAME STREQUAL Darwin OR
459463
EXISTS "${SWIFT_PATH_TO_LIBDISPATCH_SOURCE}")
460464
set(SWIFT_BUILD_SYNTAXPARSERLIB_default TRUE)

0 commit comments

Comments
 (0)