[libcxx-commits] [libcxx] ab65e4a - [libc++] Fix disabling of extension warnings in C++20 and later (#134989)

via libcxx-commits libcxx-commits at lists.llvm.org
Sat May 10 08:05:38 PDT 2025


Author: Nikolas Klauser
Date: 2025-05-10T17:05:35+02:00
New Revision: ab65e4a730d3341b268e7af19a7bbf86dea547a1

URL: https://github.com/llvm/llvm-project/commit/ab65e4a730d3341b268e7af19a7bbf86dea547a1
DIFF: https://github.com/llvm/llvm-project/commit/ab65e4a730d3341b268e7af19a7bbf86dea547a1.diff

LOG: [libc++] Fix disabling of extension warnings in C++20 and later (#134989)

`__has_feature(modules)` is always true in C++20 and later. Instead of
using that, just disable extension warnings if they're not ignored
through the system header machinery anyways.

Added: 
    

Modified: 
    libcxx/include/__config

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__config b/libcxx/include/__config
index e14632f65b877..110450f6e9c51 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -538,9 +538,9 @@ typedef __char32_t char32_t;
 #  endif
 
 // Clang modules take a significant compile time hit when pushing and popping diagnostics.
-// Since all the headers are marked as system headers in the modulemap, we can simply disable this
-// pushing and popping when building with clang modules.
-#  if !__has_feature(modules)
+// Since all the headers are marked as system headers unless _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER is defined, we can
+// simply disable this pushing and popping when _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER isn't defined.
+#  ifdef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
 #    define _LIBCPP_PUSH_EXTENSION_DIAGNOSTICS                                                                         \
       _LIBCPP_DIAGNOSTIC_PUSH                                                                                          \
       _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++11-extensions")                                                           \


        


More information about the libcxx-commits mailing list