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