6ca6e8
commit 291d4402067760edb7c0f339f9e451787a25e20a
6ca6e8
Author: Joseph Myers <joseph@codesourcery.com>
6ca6e8
Date:   Fri Aug 27 17:47:46 2021 +0000
6ca6e8
6ca6e8
    Allow #pragma GCC in headers in conformtest
6ca6e8
    
6ca6e8
    No "#pragma GCC" pragma allows macro-expansion of its arguments, so no
6ca6e8
    namespace issues arise from use of such pragmas in installed headers.
6ca6e8
    Ignore them in conformtest tests of header namespace.
6ca6e8
    
6ca6e8
    Tested for x86_64, in conjunction with Paul's patch
6ca6e8
    <https://sourceware.org/pipermail/libc-alpha/2021-August/130571.html>
6ca6e8
    adding use of such pragmas to installed headers shared with gnulib.
6ca6e8
    
6ca6e8
    (cherry picked from commit 6090a4a1b32fd7859d0ad5b7e9b240bd5fa04b3f)
6ca6e8
6ca6e8
diff --git a/conform/conformtest.py b/conform/conformtest.py
6ca6e8
index 4898e16c9fb96503..164cf2917d464aa1 100644
6ca6e8
--- a/conform/conformtest.py
6ca6e8
+++ b/conform/conformtest.py
6ca6e8
@@ -631,6 +631,14 @@ class HeaderTests(object):
6ca6e8
                     continue
6ca6e8
                 if re.match(r'# [1-9]', line):
6ca6e8
                     continue
6ca6e8
+                if line.startswith('#pragma GCC '):
6ca6e8
+                    # No GCC pragma uses macro expansion, so no
6ca6e8
+                    # namespace issues arise from such pragmas.  (Some
6ca6e8
+                    # pragmas not in the GCC namespace do macro-expand
6ca6e8
+                    # their arguments and so could be affected by
6ca6e8
+                    # macros defined by user code including the
6ca6e8
+                    # header.)
6ca6e8
+                    continue
6ca6e8
                 match = re.match(r'#define (.*)', line)
6ca6e8
                 if match:
6ca6e8
                     self.check_token(bad_tokens, match.group(1))