[libcxx-commits] [PATCH] D129047: [libc++] Improves pragma system_header test.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Jul 3 09:43:08 PDT 2022


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

The number of spaces between `#` and `pragma` can differ due to
different indention levels in the preprocessor directives. Therefore
allow any number of spaces.

The test used to put an exclamation mark in its diagnostic. This adds
little benefit and only makes it harder to copy the offending filename.
As drive-by this exclamation mark has been removed.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129047

Files:
  libcxx/test/libcxx/lint/lint_headers.sh.py


Index: libcxx/test/libcxx/lint/lint_headers.sh.py
===================================================================
--- libcxx/test/libcxx/lint/lint_headers.sh.py
+++ libcxx/test/libcxx/lint/lint_headers.sh.py
@@ -20,9 +20,11 @@
 
 def check_for_pragma_GCC_system_header(pretty_fname, lines):
     if pretty_fname not in ['__undef_macros']:
-        if '#  pragma GCC system_header\n' not in lines:
-            print('FAILED TO FIND #  pragma GCC system_header in libcxx/include/%s!' % pretty_fname)
-            return False
+        for line in lines:
+            if re.match('# *pragma GCC system_header\n', line):
+                return True
+        print('FAILED TO FIND #  pragma GCC system_header in libcxx/include/%s' % pretty_fname)
+        return False
     return True
 
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129047.441962.patch
Type: text/x-patch
Size: 791 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220703/33d9a7a7/attachment.bin>


More information about the libcxx-commits mailing list