[libcxx-commits] [PATCH] D106187: [libc++] Disable pragma system_header in the new testing configuration

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 16 13:44:19 PDT 2021


ldionne created this revision.
Herald added a subscriber: arichardson.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

The new testing configuration did not turn off #pragma system_header,
which means we were not seeing warnings in system headers.

I expect this to start failing on GCC (see the removed comment), but
I'd like to fix the root cause before I ship this.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106187

Files:
  libcxx/utils/libcxx/test/config.py
  libcxx/utils/libcxx/test/params.py


Index: libcxx/utils/libcxx/test/params.py
===================================================================
--- libcxx/utils/libcxx/test/params.py
+++ libcxx/utils/libcxx/test/params.py
@@ -93,9 +93,10 @@
 
   Parameter(name='stdlib', choices=['libc++', 'libstdc++', 'msvc'], type=str, default='libc++',
             help="The C++ Standard Library implementation being tested.",
-            actions=lambda stdlib: [
-              AddFeature(stdlib)
-            ]),
+            actions=lambda stdlib: filter(None, [
+              AddFeature(stdlib),
+              AddCompileFlag('-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER') if stdlib == 'libc++' else None
+            ])),
 
   Parameter(name='enable_warnings', choices=[True, False], type=bool, default=True,
             help="Whether to enable warnings when compiling the test suite.",
Index: libcxx/utils/libcxx/test/config.py
===================================================================
--- libcxx/utils/libcxx/test/config.py
+++ libcxx/utils/libcxx/test/config.py
@@ -286,12 +286,6 @@
         support_path = os.path.join(self.libcxx_src_root, 'test/support')
         self.cxx.compile_flags += ['-I' + support_path]
 
-        # On GCC, the libc++ headers cause errors due to throw() decorators
-        # on operator new clashing with those from the test suite, so we
-        # don't enable warnings in system headers on GCC.
-        if self.cxx.type != 'gcc':
-            self.cxx.compile_flags += ['-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER']
-
         # Add includes for the PSTL headers
         pstl_src_root = self.get_lit_conf('pstl_src_root')
         pstl_obj_root = self.get_lit_conf('pstl_obj_root')


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106187.359435.patch
Type: text/x-patch
Size: 1680 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210716/3617987b/attachment-0001.bin>


More information about the libcxx-commits mailing list