[libcxx-commits] [libcxx] 8cb5c82 - [libc++] Improves pragma system_header test.

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jul 6 11:54:52 PDT 2022


Author: Mark de Wever
Date: 2022-07-06T20:54:47+02:00
New Revision: 8cb5c82ad23b367bb411a6f75d6520001c4ed66b

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

LOG: [libc++] Improves pragma system_header test.

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.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D129047

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/libcxx/test/libcxx/lint/lint_headers.sh.py b/libcxx/test/libcxx/lint/lint_headers.sh.py
index 9113b1aecf8ad..8805ee6252ae1 100644
--- a/libcxx/test/libcxx/lint/lint_headers.sh.py
+++ b/libcxx/test/libcxx/lint/lint_headers.sh.py
@@ -20,9 +20,11 @@ def exclude_from_consideration(path):
 
 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
 
 


        


More information about the libcxx-commits mailing list