[clang] [clang] Don't use -Wno-nested-anon-types on GCC (PR #95029)

2024-06-11 Thread Martin Storsjö via cfe-commits

https://github.com/mstorsjo closed 
https://github.com/llvm/llvm-project/pull/95029
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Don't use -Wno-nested-anon-types on GCC (PR #95029)

2024-06-10 Thread Vlad Serebrennikov via cfe-commits

https://github.com/Endilll approved this pull request.

`-Wnested-anon-types` isn't supported even by GCC 7.4, so yeah, thank you for 
fixing this.

https://github.com/llvm/llvm-project/pull/95029
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Don't use -Wno-nested-anon-types on GCC (PR #95029)

2024-06-10 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Martin Storsjö (mstorsjo)


Changes

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 4feae05c6abda364a9295aecfa600d7d4e7dfeb6, 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.

---
Full diff: https://github.com/llvm/llvm-project/pull/95029.diff


1 Files Affected:

- (modified) clang/CMakeLists.txt (+3-1) 


``diff
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 2ac0bccb42f50..2b5269f2ce2e7 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -350,7 +350,9 @@ if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wno-long-long")
   endif ()
 
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-nested-anon-types" )
+  if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-nested-anon-types" )
+  endif ()
 endif ()
 
 # Determine HOST_LINK_VERSION on Darwin.

``




https://github.com/llvm/llvm-project/pull/95029
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Don't use -Wno-nested-anon-types on GCC (PR #95029)

2024-06-10 Thread Martin Storsjö via cfe-commits

https://github.com/mstorsjo created 
https://github.com/llvm/llvm-project/pull/95029

GCC usually doesn't warn about unrecognized -Wno- options, if no 
diagnostics are printed. However if some diagnostics are printed, it also 
mentions that there were unrecognized -Wno- options.

Before 4feae05c6abda364a9295aecfa600d7d4e7dfeb6, we checked for whether 
-Wnested-anon-types was supported, and added the -Wno- 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- options when 
building with GCC.

From 4af34cd1a03064a3f5966f8f33bccdec940def89 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= 
Date: Mon, 10 Jun 2024 22:30:59 +0300
Subject: [PATCH] [clang] Don't use -Wno-nested-anon-types on GCC

GCC usually doesn't warn about unrecognized -Wno- options,
if no diagnostics are printed. However if some diagnostics are
printed, it also mentions that there were unrecognized -Wno-
options.

Before 4feae05c6abda364a9295aecfa600d7d4e7dfeb6, we checked
for whether -Wnested-anon-types was supported, and added the
-Wno- 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).
---
 clang/CMakeLists.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 2ac0bccb42f50..2b5269f2ce2e7 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -350,7 +350,9 @@ if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wno-long-long")
   endif ()
 
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-nested-anon-types" )
+  if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-nested-anon-types" )
+  endif ()
 endif ()
 
 # Determine HOST_LINK_VERSION on Darwin.

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits