diff mbox series

[01/39] conform: Use -dD instead of -dN on compiler invocation

Message ID 20241222000509.2205895-2-hjl.tools@gmail.com
State Accepted
Commit fe925cb04585dd1cfca4094b255b3390bc56f770
Headers show
Series [01/39] conform: Use -dD instead of -dN on compiler invocation | expand

Commit Message

H.J. Lu Dec. 22, 2024, 12:04 a.m. UTC
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>

clang does not support -dN.
---
 conform/conformtest.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Sam James Dec. 22, 2024, 2:41 a.m. UTC | #1
"H.J. Lu" <hjl.tools@gmail.com> writes:

> From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
>
> clang does not support -dN.
> ---

The parsing of the output was also updated in this commit, so OK:
Reviewed-by: Sam James <sam@gentoo.org>

>  conform/conformtest.py | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/conform/conformtest.py b/conform/conformtest.py
> index 8337afcdad..d38afb06a8 100644
> --- a/conform/conformtest.py
> +++ b/conform/conformtest.py
> @@ -620,7 +620,7 @@ class HeaderTests(object):
>          out_file = os.path.join(self.temp_dir, 'namespace-out')
>          with open(c_file, 'w') as c_file_out:
>              c_file_out.write('#include <%s>\n' % self.header)
> -        cmd = ('%s %s -E %s -P -Wp,-dN > %s'
> +        cmd = ('%s %s -E %s -P -Wp,-dD > %s'
>                 % (self.cc, self.cflags_namespace, c_file, out_file))
>          subprocess.check_call(cmd, shell=True)
>          bad_tokens = set()
> @@ -639,11 +639,11 @@ class HeaderTests(object):
>                      # macros defined by user code including the
>                      # header.)
>                      continue
> -                match = re.match(r'#define (.*)', line)
> +                match = re.match(r'#define (.*?[^\(\s]+)', line)
>                  if match:
>                      self.check_token(bad_tokens, match.group(1))
>                      continue
> -                match = re.match(r'#undef (.*)', line)
> +                match = re.match(r'#undef (.*?[^\(\s]+)', line)
>                  if match:
>                      bad_tokens.discard(match.group(1))
>                      continue
diff mbox series

Patch

diff --git a/conform/conformtest.py b/conform/conformtest.py
index 8337afcdad..d38afb06a8 100644
--- a/conform/conformtest.py
+++ b/conform/conformtest.py
@@ -620,7 +620,7 @@  class HeaderTests(object):
         out_file = os.path.join(self.temp_dir, 'namespace-out')
         with open(c_file, 'w') as c_file_out:
             c_file_out.write('#include <%s>\n' % self.header)
-        cmd = ('%s %s -E %s -P -Wp,-dN > %s'
+        cmd = ('%s %s -E %s -P -Wp,-dD > %s'
                % (self.cc, self.cflags_namespace, c_file, out_file))
         subprocess.check_call(cmd, shell=True)
         bad_tokens = set()
@@ -639,11 +639,11 @@  class HeaderTests(object):
                     # macros defined by user code including the
                     # header.)
                     continue
-                match = re.match(r'#define (.*)', line)
+                match = re.match(r'#define (.*?[^\(\s]+)', line)
                 if match:
                     self.check_token(bad_tokens, match.group(1))
                     continue
-                match = re.match(r'#undef (.*)', line)
+                match = re.match(r'#undef (.*?[^\(\s]+)', line)
                 if match:
                     bad_tokens.discard(match.group(1))
                     continue