Skip to content

Commit 41c650e

Browse files
authored
[clang] Don't use -Wno-nested-anon-types on GCC (#95029)
GCC usually doesn't warn about unrecognized -Wno-<foo> options, if no diagnostics are printed. However if some diagnostics are printed, it also mentions that there were unrecognized -Wno-<foo> options. Before 4feae05, we checked for whether -Wnested-anon-types was supported, and added the -Wno-<foo> form if the positive form of the option was supported. As of GCC 14, -Wnested-anon-types isn't supported, thus limit the use of the option to actual Clang (and still only while using the GCC compatible driver). This avoids unnecessary mentions about unrecognized -Wno-<foo> options when building with GCC.
1 parent 48f8130 commit 41c650e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

clang/CMakeLists.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,9 @@ if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
350350
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wno-long-long")
351351
endif ()
352352

353-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-nested-anon-types" )
353+
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
354+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-nested-anon-types" )
355+
endif ()
354356
endif ()
355357

356358
# Determine HOST_LINK_VERSION on Darwin.

0 commit comments

Comments
 (0)