public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/azanella/clang] conform: Replace _Static_assert with macro
@ 2024-04-17 20:11 Adhemerval Zanella
  0 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2024-04-17 20:11 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=a0606429223eab21c3211197a6f2550d72619b21

commit a0606429223eab21c3211197a6f2550d72619b21
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Mar 29 16:06:13 2022 -0300

    conform: Replace _Static_assert with macro
    
    clang does not allow non integral constant expression in
    _Static_assert.  Replace with a macro that uses name bit-field
    where an invalid constant expression sets its size to 0, resulting
    in a error.

Diff:
---
 conform/conformtest.py | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/conform/conformtest.py b/conform/conformtest.py
index d38afb06a8..a43ab05a0a 100644
--- a/conform/conformtest.py
+++ b/conform/conformtest.py
@@ -157,9 +157,9 @@ class ConstantTest(object):
                     '%s'
                     '# define conformtest_%d_value (%s)\n'
                     '#endif\n'
-                    '_Static_assert (((%s < 0) == conformtest_%d_negative) '
+                    'STATIC_ASSERT (((%s < 0) == conformtest_%d_negative) '
                     '&& (%s == conformtest_%d_value), '
-                    '"value match inside and outside #if");\n'
+                    'value_match_inside_and_outside_if);\n'
                     % (self.symbol, self.num, sym_bits_def_neg, self.num,
                        sym_bits_or_neg, self.num, sym_bits_def_pos, self.num,
                        sym_bits_or_pos, self.symbol, self.num, self.symbol,
@@ -179,8 +179,8 @@ class ConstantTest(object):
                 'Type of symbol %s' % self.symbol,
                 text))
         if self.op is not None:
-            text = ('_Static_assert (%(symbol)s %(op)s %(value)s, '
-                    '"value constraint");\n'
+            text = ('STATIC_ASSERT (%(symbol)s %(op)s %(value)s, '
+                    'value_constraint);\n'
                     % vars(self))
             self.subtests.append(CompileSubTest(
                 'Value of symbol %s' % self.symbol,
@@ -552,6 +552,16 @@ class HeaderTests(object):
         self.skipped += 1
         sys.stdout.flush()
 
+    def common_definitions(self):
+        """Add any required common definition for the compilation tests."""
+        text = ('#define __STR(pre,post) pre ## post\n'
+                '#define _STR(pre,post) __STR(pre, post)\n'
+                '#define STATIC_ASSERT(cond, msg) \\\n'
+                '  typedef struct {\\\n'
+                '    int _STR (static_assertion_failed_, msg) : !!(cond);\\\n'
+                '  } _STR (static_assertion_failed_, __COUNTER__)\n')
+        return text
+
     def compile_test(self, name, text):
         """Run a compilation test; return True if it passes."""
         self.total += 1
@@ -565,7 +575,8 @@ class HeaderTests(object):
         c_file = os.path.join(self.temp_dir, 'test.c')
         o_file = os.path.join(self.temp_dir, 'test.o')
         with open(c_file, 'w') as c_file_out:
-            c_file_out.write('#include <%s>\n%s' % (self.header, text))
+            c_file_out.write('#include <%s>\n%s\n%s' %
+                    (self.header, self.common_definitions(), text))
         cmd = ('%s %s -c %s -o %s' % (self.cc, self.cflags, c_file, o_file))
         try:
             subprocess.check_call(cmd, shell=True)

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [glibc/azanella/clang] conform: Replace _Static_assert with macro
@ 2024-04-02 15:57 Adhemerval Zanella
  0 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2024-04-02 15:57 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=1ec697c47499650d86d608724a35036a308e5c34

commit 1ec697c47499650d86d608724a35036a308e5c34
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Mar 29 16:06:13 2022 -0300

    conform: Replace _Static_assert with macro
    
    clang does not allow non integral constant expression in
    _Static_assert.  Replace with a macro that uses name bit-field
    where an invalid constant expression sets its size to 0, resulting
    in a error.

Diff:
---
 conform/conformtest.py | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/conform/conformtest.py b/conform/conformtest.py
index d38afb06a8..a43ab05a0a 100644
--- a/conform/conformtest.py
+++ b/conform/conformtest.py
@@ -157,9 +157,9 @@ class ConstantTest(object):
                     '%s'
                     '# define conformtest_%d_value (%s)\n'
                     '#endif\n'
-                    '_Static_assert (((%s < 0) == conformtest_%d_negative) '
+                    'STATIC_ASSERT (((%s < 0) == conformtest_%d_negative) '
                     '&& (%s == conformtest_%d_value), '
-                    '"value match inside and outside #if");\n'
+                    'value_match_inside_and_outside_if);\n'
                     % (self.symbol, self.num, sym_bits_def_neg, self.num,
                        sym_bits_or_neg, self.num, sym_bits_def_pos, self.num,
                        sym_bits_or_pos, self.symbol, self.num, self.symbol,
@@ -179,8 +179,8 @@ class ConstantTest(object):
                 'Type of symbol %s' % self.symbol,
                 text))
         if self.op is not None:
-            text = ('_Static_assert (%(symbol)s %(op)s %(value)s, '
-                    '"value constraint");\n'
+            text = ('STATIC_ASSERT (%(symbol)s %(op)s %(value)s, '
+                    'value_constraint);\n'
                     % vars(self))
             self.subtests.append(CompileSubTest(
                 'Value of symbol %s' % self.symbol,
@@ -552,6 +552,16 @@ class HeaderTests(object):
         self.skipped += 1
         sys.stdout.flush()
 
+    def common_definitions(self):
+        """Add any required common definition for the compilation tests."""
+        text = ('#define __STR(pre,post) pre ## post\n'
+                '#define _STR(pre,post) __STR(pre, post)\n'
+                '#define STATIC_ASSERT(cond, msg) \\\n'
+                '  typedef struct {\\\n'
+                '    int _STR (static_assertion_failed_, msg) : !!(cond);\\\n'
+                '  } _STR (static_assertion_failed_, __COUNTER__)\n')
+        return text
+
     def compile_test(self, name, text):
         """Run a compilation test; return True if it passes."""
         self.total += 1
@@ -565,7 +575,8 @@ class HeaderTests(object):
         c_file = os.path.join(self.temp_dir, 'test.c')
         o_file = os.path.join(self.temp_dir, 'test.o')
         with open(c_file, 'w') as c_file_out:
-            c_file_out.write('#include <%s>\n%s' % (self.header, text))
+            c_file_out.write('#include <%s>\n%s\n%s' %
+                    (self.header, self.common_definitions(), text))
         cmd = ('%s %s -c %s -o %s' % (self.cc, self.cflags, c_file, o_file))
         try:
             subprocess.check_call(cmd, shell=True)

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [glibc/azanella/clang] conform: Replace _Static_assert with macro
@ 2024-02-09 17:36 Adhemerval Zanella
  0 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2024-02-09 17:36 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=e2b9b3c6693e22d1a66ac40472835ca2a537f7cd

commit e2b9b3c6693e22d1a66ac40472835ca2a537f7cd
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Mar 29 16:06:13 2022 -0300

    conform: Replace _Static_assert with macro
    
    clang does not allow non integral constant expression in
    _Static_assert.  Replace with a macro that uses name bit-field
    where an invalid constant expression sets its size to 0, resulting
    in a error.

Diff:
---
 conform/conformtest.py | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/conform/conformtest.py b/conform/conformtest.py
index d38afb06a8..a43ab05a0a 100644
--- a/conform/conformtest.py
+++ b/conform/conformtest.py
@@ -157,9 +157,9 @@ class ConstantTest(object):
                     '%s'
                     '# define conformtest_%d_value (%s)\n'
                     '#endif\n'
-                    '_Static_assert (((%s < 0) == conformtest_%d_negative) '
+                    'STATIC_ASSERT (((%s < 0) == conformtest_%d_negative) '
                     '&& (%s == conformtest_%d_value), '
-                    '"value match inside and outside #if");\n'
+                    'value_match_inside_and_outside_if);\n'
                     % (self.symbol, self.num, sym_bits_def_neg, self.num,
                        sym_bits_or_neg, self.num, sym_bits_def_pos, self.num,
                        sym_bits_or_pos, self.symbol, self.num, self.symbol,
@@ -179,8 +179,8 @@ class ConstantTest(object):
                 'Type of symbol %s' % self.symbol,
                 text))
         if self.op is not None:
-            text = ('_Static_assert (%(symbol)s %(op)s %(value)s, '
-                    '"value constraint");\n'
+            text = ('STATIC_ASSERT (%(symbol)s %(op)s %(value)s, '
+                    'value_constraint);\n'
                     % vars(self))
             self.subtests.append(CompileSubTest(
                 'Value of symbol %s' % self.symbol,
@@ -552,6 +552,16 @@ class HeaderTests(object):
         self.skipped += 1
         sys.stdout.flush()
 
+    def common_definitions(self):
+        """Add any required common definition for the compilation tests."""
+        text = ('#define __STR(pre,post) pre ## post\n'
+                '#define _STR(pre,post) __STR(pre, post)\n'
+                '#define STATIC_ASSERT(cond, msg) \\\n'
+                '  typedef struct {\\\n'
+                '    int _STR (static_assertion_failed_, msg) : !!(cond);\\\n'
+                '  } _STR (static_assertion_failed_, __COUNTER__)\n')
+        return text
+
     def compile_test(self, name, text):
         """Run a compilation test; return True if it passes."""
         self.total += 1
@@ -565,7 +575,8 @@ class HeaderTests(object):
         c_file = os.path.join(self.temp_dir, 'test.c')
         o_file = os.path.join(self.temp_dir, 'test.o')
         with open(c_file, 'w') as c_file_out:
-            c_file_out.write('#include <%s>\n%s' % (self.header, text))
+            c_file_out.write('#include <%s>\n%s\n%s' %
+                    (self.header, self.common_definitions(), text))
         cmd = ('%s %s -c %s -o %s' % (self.cc, self.cflags, c_file, o_file))
         try:
             subprocess.check_call(cmd, shell=True)

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [glibc/azanella/clang] conform: Replace _Static_assert with macro
@ 2024-02-07 14:11 Adhemerval Zanella
  0 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2024-02-07 14:11 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b64271abf2adcd421ecd9969ce5f315785329f49

commit b64271abf2adcd421ecd9969ce5f315785329f49
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Mar 29 16:06:13 2022 -0300

    conform: Replace _Static_assert with macro
    
    clang does not allow non integral constant expression in
    _Static_assert.  Replace with a macro that uses name bit-field
    where an invalid constant expression sets its size to 0, resulting
    in a error.

Diff:
---
 conform/conformtest.py | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/conform/conformtest.py b/conform/conformtest.py
index d38afb06a8..a43ab05a0a 100644
--- a/conform/conformtest.py
+++ b/conform/conformtest.py
@@ -157,9 +157,9 @@ class ConstantTest(object):
                     '%s'
                     '# define conformtest_%d_value (%s)\n'
                     '#endif\n'
-                    '_Static_assert (((%s < 0) == conformtest_%d_negative) '
+                    'STATIC_ASSERT (((%s < 0) == conformtest_%d_negative) '
                     '&& (%s == conformtest_%d_value), '
-                    '"value match inside and outside #if");\n'
+                    'value_match_inside_and_outside_if);\n'
                     % (self.symbol, self.num, sym_bits_def_neg, self.num,
                        sym_bits_or_neg, self.num, sym_bits_def_pos, self.num,
                        sym_bits_or_pos, self.symbol, self.num, self.symbol,
@@ -179,8 +179,8 @@ class ConstantTest(object):
                 'Type of symbol %s' % self.symbol,
                 text))
         if self.op is not None:
-            text = ('_Static_assert (%(symbol)s %(op)s %(value)s, '
-                    '"value constraint");\n'
+            text = ('STATIC_ASSERT (%(symbol)s %(op)s %(value)s, '
+                    'value_constraint);\n'
                     % vars(self))
             self.subtests.append(CompileSubTest(
                 'Value of symbol %s' % self.symbol,
@@ -552,6 +552,16 @@ class HeaderTests(object):
         self.skipped += 1
         sys.stdout.flush()
 
+    def common_definitions(self):
+        """Add any required common definition for the compilation tests."""
+        text = ('#define __STR(pre,post) pre ## post\n'
+                '#define _STR(pre,post) __STR(pre, post)\n'
+                '#define STATIC_ASSERT(cond, msg) \\\n'
+                '  typedef struct {\\\n'
+                '    int _STR (static_assertion_failed_, msg) : !!(cond);\\\n'
+                '  } _STR (static_assertion_failed_, __COUNTER__)\n')
+        return text
+
     def compile_test(self, name, text):
         """Run a compilation test; return True if it passes."""
         self.total += 1
@@ -565,7 +575,8 @@ class HeaderTests(object):
         c_file = os.path.join(self.temp_dir, 'test.c')
         o_file = os.path.join(self.temp_dir, 'test.o')
         with open(c_file, 'w') as c_file_out:
-            c_file_out.write('#include <%s>\n%s' % (self.header, text))
+            c_file_out.write('#include <%s>\n%s\n%s' %
+                    (self.header, self.common_definitions(), text))
         cmd = ('%s %s -c %s -o %s' % (self.cc, self.cflags, c_file, o_file))
         try:
             subprocess.check_call(cmd, shell=True)

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [glibc/azanella/clang] conform: Replace _Static_assert with macro
@ 2024-01-29 18:01 Adhemerval Zanella
  0 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2024-01-29 18:01 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=dde66238c36d18121d5817802793468baee435c6

commit dde66238c36d18121d5817802793468baee435c6
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Mar 29 16:06:13 2022 -0300

    conform: Replace _Static_assert with macro
    
    clang does not allow non integral constant expression in
    _Static_assert.  Replace with a macro that uses name bit-field
    where an invalid constant expression sets its size to 0, resulting
    in a error.

Diff:
---
 conform/conformtest.py | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/conform/conformtest.py b/conform/conformtest.py
index d38afb06a8..a43ab05a0a 100644
--- a/conform/conformtest.py
+++ b/conform/conformtest.py
@@ -157,9 +157,9 @@ class ConstantTest(object):
                     '%s'
                     '# define conformtest_%d_value (%s)\n'
                     '#endif\n'
-                    '_Static_assert (((%s < 0) == conformtest_%d_negative) '
+                    'STATIC_ASSERT (((%s < 0) == conformtest_%d_negative) '
                     '&& (%s == conformtest_%d_value), '
-                    '"value match inside and outside #if");\n'
+                    'value_match_inside_and_outside_if);\n'
                     % (self.symbol, self.num, sym_bits_def_neg, self.num,
                        sym_bits_or_neg, self.num, sym_bits_def_pos, self.num,
                        sym_bits_or_pos, self.symbol, self.num, self.symbol,
@@ -179,8 +179,8 @@ class ConstantTest(object):
                 'Type of symbol %s' % self.symbol,
                 text))
         if self.op is not None:
-            text = ('_Static_assert (%(symbol)s %(op)s %(value)s, '
-                    '"value constraint");\n'
+            text = ('STATIC_ASSERT (%(symbol)s %(op)s %(value)s, '
+                    'value_constraint);\n'
                     % vars(self))
             self.subtests.append(CompileSubTest(
                 'Value of symbol %s' % self.symbol,
@@ -552,6 +552,16 @@ class HeaderTests(object):
         self.skipped += 1
         sys.stdout.flush()
 
+    def common_definitions(self):
+        """Add any required common definition for the compilation tests."""
+        text = ('#define __STR(pre,post) pre ## post\n'
+                '#define _STR(pre,post) __STR(pre, post)\n'
+                '#define STATIC_ASSERT(cond, msg) \\\n'
+                '  typedef struct {\\\n'
+                '    int _STR (static_assertion_failed_, msg) : !!(cond);\\\n'
+                '  } _STR (static_assertion_failed_, __COUNTER__)\n')
+        return text
+
     def compile_test(self, name, text):
         """Run a compilation test; return True if it passes."""
         self.total += 1
@@ -565,7 +575,8 @@ class HeaderTests(object):
         c_file = os.path.join(self.temp_dir, 'test.c')
         o_file = os.path.join(self.temp_dir, 'test.o')
         with open(c_file, 'w') as c_file_out:
-            c_file_out.write('#include <%s>\n%s' % (self.header, text))
+            c_file_out.write('#include <%s>\n%s\n%s' %
+                    (self.header, self.common_definitions(), text))
         cmd = ('%s %s -c %s -o %s' % (self.cc, self.cflags, c_file, o_file))
         try:
             subprocess.check_call(cmd, shell=True)

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [glibc/azanella/clang] conform: Replace _Static_assert with macro
@ 2023-12-21 18:58 Adhemerval Zanella
  0 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2023-12-21 18:58 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=6e3d0c5bcc6c9d969e602a5dd7794ae9b4a43971

commit 6e3d0c5bcc6c9d969e602a5dd7794ae9b4a43971
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Mar 29 16:06:13 2022 -0300

    conform: Replace _Static_assert with macro
    
    clang does not allow non integral constant expression in
    _Static_assert.  Replace with a macro that uses name bit-field
    where an invalid constant expression sets its size to 0, resulting
    in a error.

Diff:
---
 conform/conformtest.py | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/conform/conformtest.py b/conform/conformtest.py
index fcaab48a6c..e89fb19134 100644
--- a/conform/conformtest.py
+++ b/conform/conformtest.py
@@ -157,9 +157,9 @@ class ConstantTest(object):
                     '%s'
                     '# define conformtest_%d_value (%s)\n'
                     '#endif\n'
-                    '_Static_assert (((%s < 0) == conformtest_%d_negative) '
+                    'STATIC_ASSERT (((%s < 0) == conformtest_%d_negative) '
                     '&& (%s == conformtest_%d_value), '
-                    '"value match inside and outside #if");\n'
+                    'value_match_inside_and_outside_if);\n'
                     % (self.symbol, self.num, sym_bits_def_neg, self.num,
                        sym_bits_or_neg, self.num, sym_bits_def_pos, self.num,
                        sym_bits_or_pos, self.symbol, self.num, self.symbol,
@@ -179,8 +179,8 @@ class ConstantTest(object):
                 'Type of symbol %s' % self.symbol,
                 text))
         if self.op is not None:
-            text = ('_Static_assert (%(symbol)s %(op)s %(value)s, '
-                    '"value constraint");\n'
+            text = ('STATIC_ASSERT (%(symbol)s %(op)s %(value)s, '
+                    'value_constraint);\n'
                     % vars(self))
             self.subtests.append(CompileSubTest(
                 'Value of symbol %s' % self.symbol,
@@ -552,6 +552,16 @@ class HeaderTests(object):
         self.skipped += 1
         sys.stdout.flush()
 
+    def common_definitions(self):
+        """Add any required common definition for the compilation tests."""
+        text = ('#define __STR(pre,post) pre ## post\n'
+                '#define _STR(pre,post) __STR(pre, post)\n'
+                '#define STATIC_ASSERT(cond, msg) \\\n'
+                '  typedef struct {\\\n'
+                '    int _STR (static_assertion_failed_, msg) : !!(cond);\\\n'
+                '  } _STR (static_assertion_failed_, __COUNTER__)\n')
+        return text
+
     def compile_test(self, name, text):
         """Run a compilation test; return True if it passes."""
         self.total += 1
@@ -565,7 +575,8 @@ class HeaderTests(object):
         c_file = os.path.join(self.temp_dir, 'test.c')
         o_file = os.path.join(self.temp_dir, 'test.o')
         with open(c_file, 'w') as c_file_out:
-            c_file_out.write('#include <%s>\n%s' % (self.header, text))
+            c_file_out.write('#include <%s>\n%s\n%s' %
+                    (self.header, self.common_definitions(), text))
         cmd = ('%s %s -c %s -o %s' % (self.cc, self.cflags, c_file, o_file))
         try:
             subprocess.check_call(cmd, shell=True)

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [glibc/azanella/clang] conform: Replace _Static_assert with macro
@ 2023-09-28 17:56 Adhemerval Zanella
  0 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2023-09-28 17:56 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=8db9c9ec167bf8f8ab949c5380f79f4580f4acad

commit 8db9c9ec167bf8f8ab949c5380f79f4580f4acad
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Mar 29 16:06:13 2022 -0300

    conform: Replace _Static_assert with macro
    
    clang does not allow non integral constant expression in
    _Static_assert.  Replace with a macro that uses name bit-field
    where an invalid constant expression sets its size to 0, resulting
    in a error.

Diff:
---
 conform/conformtest.py | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/conform/conformtest.py b/conform/conformtest.py
index fcaab48a6c..e89fb19134 100644
--- a/conform/conformtest.py
+++ b/conform/conformtest.py
@@ -157,9 +157,9 @@ class ConstantTest(object):
                     '%s'
                     '# define conformtest_%d_value (%s)\n'
                     '#endif\n'
-                    '_Static_assert (((%s < 0) == conformtest_%d_negative) '
+                    'STATIC_ASSERT (((%s < 0) == conformtest_%d_negative) '
                     '&& (%s == conformtest_%d_value), '
-                    '"value match inside and outside #if");\n'
+                    'value_match_inside_and_outside_if);\n'
                     % (self.symbol, self.num, sym_bits_def_neg, self.num,
                        sym_bits_or_neg, self.num, sym_bits_def_pos, self.num,
                        sym_bits_or_pos, self.symbol, self.num, self.symbol,
@@ -179,8 +179,8 @@ class ConstantTest(object):
                 'Type of symbol %s' % self.symbol,
                 text))
         if self.op is not None:
-            text = ('_Static_assert (%(symbol)s %(op)s %(value)s, '
-                    '"value constraint");\n'
+            text = ('STATIC_ASSERT (%(symbol)s %(op)s %(value)s, '
+                    'value_constraint);\n'
                     % vars(self))
             self.subtests.append(CompileSubTest(
                 'Value of symbol %s' % self.symbol,
@@ -552,6 +552,16 @@ class HeaderTests(object):
         self.skipped += 1
         sys.stdout.flush()
 
+    def common_definitions(self):
+        """Add any required common definition for the compilation tests."""
+        text = ('#define __STR(pre,post) pre ## post\n'
+                '#define _STR(pre,post) __STR(pre, post)\n'
+                '#define STATIC_ASSERT(cond, msg) \\\n'
+                '  typedef struct {\\\n'
+                '    int _STR (static_assertion_failed_, msg) : !!(cond);\\\n'
+                '  } _STR (static_assertion_failed_, __COUNTER__)\n')
+        return text
+
     def compile_test(self, name, text):
         """Run a compilation test; return True if it passes."""
         self.total += 1
@@ -565,7 +575,8 @@ class HeaderTests(object):
         c_file = os.path.join(self.temp_dir, 'test.c')
         o_file = os.path.join(self.temp_dir, 'test.o')
         with open(c_file, 'w') as c_file_out:
-            c_file_out.write('#include <%s>\n%s' % (self.header, text))
+            c_file_out.write('#include <%s>\n%s\n%s' %
+                    (self.header, self.common_definitions(), text))
         cmd = ('%s %s -c %s -o %s' % (self.cc, self.cflags, c_file, o_file))
         try:
             subprocess.check_call(cmd, shell=True)

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [glibc/azanella/clang] conform: Replace _Static_assert with macro
@ 2023-08-30 12:40 Adhemerval Zanella
  0 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2023-08-30 12:40 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=a197ae1fd8245cacd715272b101d58168c715d36

commit a197ae1fd8245cacd715272b101d58168c715d36
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Mar 29 16:06:13 2022 -0300

    conform: Replace _Static_assert with macro
    
    clang does not allow non integral constant expression in
    _Static_assert.  Replace with a macro that uses name bit-field
    where an invalid constant expression sets its size to 0, resulting
    in a error.

Diff:
---
 conform/conformtest.py | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/conform/conformtest.py b/conform/conformtest.py
index fcaab48a6c..e89fb19134 100644
--- a/conform/conformtest.py
+++ b/conform/conformtest.py
@@ -157,9 +157,9 @@ class ConstantTest(object):
                     '%s'
                     '# define conformtest_%d_value (%s)\n'
                     '#endif\n'
-                    '_Static_assert (((%s < 0) == conformtest_%d_negative) '
+                    'STATIC_ASSERT (((%s < 0) == conformtest_%d_negative) '
                     '&& (%s == conformtest_%d_value), '
-                    '"value match inside and outside #if");\n'
+                    'value_match_inside_and_outside_if);\n'
                     % (self.symbol, self.num, sym_bits_def_neg, self.num,
                        sym_bits_or_neg, self.num, sym_bits_def_pos, self.num,
                        sym_bits_or_pos, self.symbol, self.num, self.symbol,
@@ -179,8 +179,8 @@ class ConstantTest(object):
                 'Type of symbol %s' % self.symbol,
                 text))
         if self.op is not None:
-            text = ('_Static_assert (%(symbol)s %(op)s %(value)s, '
-                    '"value constraint");\n'
+            text = ('STATIC_ASSERT (%(symbol)s %(op)s %(value)s, '
+                    'value_constraint);\n'
                     % vars(self))
             self.subtests.append(CompileSubTest(
                 'Value of symbol %s' % self.symbol,
@@ -552,6 +552,16 @@ class HeaderTests(object):
         self.skipped += 1
         sys.stdout.flush()
 
+    def common_definitions(self):
+        """Add any required common definition for the compilation tests."""
+        text = ('#define __STR(pre,post) pre ## post\n'
+                '#define _STR(pre,post) __STR(pre, post)\n'
+                '#define STATIC_ASSERT(cond, msg) \\\n'
+                '  typedef struct {\\\n'
+                '    int _STR (static_assertion_failed_, msg) : !!(cond);\\\n'
+                '  } _STR (static_assertion_failed_, __COUNTER__)\n')
+        return text
+
     def compile_test(self, name, text):
         """Run a compilation test; return True if it passes."""
         self.total += 1
@@ -565,7 +575,8 @@ class HeaderTests(object):
         c_file = os.path.join(self.temp_dir, 'test.c')
         o_file = os.path.join(self.temp_dir, 'test.o')
         with open(c_file, 'w') as c_file_out:
-            c_file_out.write('#include <%s>\n%s' % (self.header, text))
+            c_file_out.write('#include <%s>\n%s\n%s' %
+                    (self.header, self.common_definitions(), text))
         cmd = ('%s %s -c %s -o %s' % (self.cc, self.cflags, c_file, o_file))
         try:
             subprocess.check_call(cmd, shell=True)

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [glibc/azanella/clang] conform: Replace _Static_assert with macro
@ 2023-02-09 19:52 Adhemerval Zanella
  0 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2023-02-09 19:52 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=ca96e1f8ca33aa81a5b32a77600998036978636f

commit ca96e1f8ca33aa81a5b32a77600998036978636f
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Mar 29 16:06:13 2022 -0300

    conform: Replace _Static_assert with macro
    
    clang does not allow non integral constant expression in
    _Static_assert.  Replace with a macro that uses name bit-field
    where an invalid constant expression sets its size to 0, resulting
    in a error.

Diff:
---
 conform/conformtest.py | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/conform/conformtest.py b/conform/conformtest.py
index fcaab48a6c..e89fb19134 100644
--- a/conform/conformtest.py
+++ b/conform/conformtest.py
@@ -157,9 +157,9 @@ class ConstantTest(object):
                     '%s'
                     '# define conformtest_%d_value (%s)\n'
                     '#endif\n'
-                    '_Static_assert (((%s < 0) == conformtest_%d_negative) '
+                    'STATIC_ASSERT (((%s < 0) == conformtest_%d_negative) '
                     '&& (%s == conformtest_%d_value), '
-                    '"value match inside and outside #if");\n'
+                    'value_match_inside_and_outside_if);\n'
                     % (self.symbol, self.num, sym_bits_def_neg, self.num,
                        sym_bits_or_neg, self.num, sym_bits_def_pos, self.num,
                        sym_bits_or_pos, self.symbol, self.num, self.symbol,
@@ -179,8 +179,8 @@ class ConstantTest(object):
                 'Type of symbol %s' % self.symbol,
                 text))
         if self.op is not None:
-            text = ('_Static_assert (%(symbol)s %(op)s %(value)s, '
-                    '"value constraint");\n'
+            text = ('STATIC_ASSERT (%(symbol)s %(op)s %(value)s, '
+                    'value_constraint);\n'
                     % vars(self))
             self.subtests.append(CompileSubTest(
                 'Value of symbol %s' % self.symbol,
@@ -552,6 +552,16 @@ class HeaderTests(object):
         self.skipped += 1
         sys.stdout.flush()
 
+    def common_definitions(self):
+        """Add any required common definition for the compilation tests."""
+        text = ('#define __STR(pre,post) pre ## post\n'
+                '#define _STR(pre,post) __STR(pre, post)\n'
+                '#define STATIC_ASSERT(cond, msg) \\\n'
+                '  typedef struct {\\\n'
+                '    int _STR (static_assertion_failed_, msg) : !!(cond);\\\n'
+                '  } _STR (static_assertion_failed_, __COUNTER__)\n')
+        return text
+
     def compile_test(self, name, text):
         """Run a compilation test; return True if it passes."""
         self.total += 1
@@ -565,7 +575,8 @@ class HeaderTests(object):
         c_file = os.path.join(self.temp_dir, 'test.c')
         o_file = os.path.join(self.temp_dir, 'test.o')
         with open(c_file, 'w') as c_file_out:
-            c_file_out.write('#include <%s>\n%s' % (self.header, text))
+            c_file_out.write('#include <%s>\n%s\n%s' %
+                    (self.header, self.common_definitions(), text))
         cmd = ('%s %s -c %s -o %s' % (self.cc, self.cflags, c_file, o_file))
         try:
             subprocess.check_call(cmd, shell=True)

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [glibc/azanella/clang] conform: Replace _Static_assert with macro
@ 2022-10-28 17:45 Adhemerval Zanella
  0 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2022-10-28 17:45 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=938fe3fe431bb3137efcc12fdac3526550e6f87e

commit 938fe3fe431bb3137efcc12fdac3526550e6f87e
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Mar 29 16:06:13 2022 -0300

    conform: Replace _Static_assert with macro
    
    clang does not allow non integral constant expression in
    _Static_assert.  Replace with a macro that uses name bit-field
    where an invalid constant expression sets its size to 0, resulting
    in a error.

Diff:
---
 conform/conformtest.py | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/conform/conformtest.py b/conform/conformtest.py
index 3d2b9cec03..abdfd40d11 100644
--- a/conform/conformtest.py
+++ b/conform/conformtest.py
@@ -157,9 +157,9 @@ class ConstantTest(object):
                     '%s'
                     '# define conformtest_%d_value (%s)\n'
                     '#endif\n'
-                    '_Static_assert (((%s < 0) == conformtest_%d_negative) '
+                    'STATIC_ASSERT (((%s < 0) == conformtest_%d_negative) '
                     '&& (%s == conformtest_%d_value), '
-                    '"value match inside and outside #if");\n'
+                    'value_match_inside_and_outside_if);\n'
                     % (self.symbol, self.num, sym_bits_def_neg, self.num,
                        sym_bits_or_neg, self.num, sym_bits_def_pos, self.num,
                        sym_bits_or_pos, self.symbol, self.num, self.symbol,
@@ -179,8 +179,8 @@ class ConstantTest(object):
                 'Type of symbol %s' % self.symbol,
                 text))
         if self.op is not None:
-            text = ('_Static_assert (%(symbol)s %(op)s %(value)s, '
-                    '"value constraint");\n'
+            text = ('STATIC_ASSERT (%(symbol)s %(op)s %(value)s, '
+                    'value_constraint);\n'
                     % vars(self))
             self.subtests.append(CompileSubTest(
                 'Value of symbol %s' % self.symbol,
@@ -552,6 +552,16 @@ class HeaderTests(object):
         self.skipped += 1
         sys.stdout.flush()
 
+    def common_definitions(self):
+        """Add any required common definition for the compilation tests."""
+        text = ('#define __STR(pre,post) pre ## post\n'
+                '#define _STR(pre,post) __STR(pre, post)\n'
+                '#define STATIC_ASSERT(cond, msg) \\\n'
+                '  typedef struct {\\\n'
+                '    int _STR (static_assertion_failed_, msg) : !!(cond);\\\n'
+                '  } _STR (static_assertion_failed_, __COUNTER__)\n')
+        return text
+
     def compile_test(self, name, text):
         """Run a compilation test; return True if it passes."""
         self.total += 1
@@ -565,7 +575,8 @@ class HeaderTests(object):
         c_file = os.path.join(self.temp_dir, 'test.c')
         o_file = os.path.join(self.temp_dir, 'test.o')
         with open(c_file, 'w') as c_file_out:
-            c_file_out.write('#include <%s>\n%s' % (self.header, text))
+            c_file_out.write('#include <%s>\n%s\n%s' %
+                    (self.header, self.common_definitions(), text))
         cmd = ('%s %s -c %s -o %s' % (self.cc, self.cflags, c_file, o_file))
         try:
             subprocess.check_call(cmd, shell=True)

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [glibc/azanella/clang] conform: Replace _Static_assert with macro
@ 2022-10-04 13:03 Adhemerval Zanella
  0 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2022-10-04 13:03 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=e65ffec23c2c5347baa99b6915184ec525e5e1fc

commit e65ffec23c2c5347baa99b6915184ec525e5e1fc
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Mar 29 16:06:13 2022 -0300

    conform: Replace _Static_assert with macro
    
    clang does not allow non integral constant expression in
    _Static_assert.  Replace with a macro that uses name bit-field
    where an invalid constant expression sets its size to 0, resulting
    in a error.

Diff:
---
 conform/conformtest.py | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/conform/conformtest.py b/conform/conformtest.py
index 3d2b9cec03..abdfd40d11 100644
--- a/conform/conformtest.py
+++ b/conform/conformtest.py
@@ -157,9 +157,9 @@ class ConstantTest(object):
                     '%s'
                     '# define conformtest_%d_value (%s)\n'
                     '#endif\n'
-                    '_Static_assert (((%s < 0) == conformtest_%d_negative) '
+                    'STATIC_ASSERT (((%s < 0) == conformtest_%d_negative) '
                     '&& (%s == conformtest_%d_value), '
-                    '"value match inside and outside #if");\n'
+                    'value_match_inside_and_outside_if);\n'
                     % (self.symbol, self.num, sym_bits_def_neg, self.num,
                        sym_bits_or_neg, self.num, sym_bits_def_pos, self.num,
                        sym_bits_or_pos, self.symbol, self.num, self.symbol,
@@ -179,8 +179,8 @@ class ConstantTest(object):
                 'Type of symbol %s' % self.symbol,
                 text))
         if self.op is not None:
-            text = ('_Static_assert (%(symbol)s %(op)s %(value)s, '
-                    '"value constraint");\n'
+            text = ('STATIC_ASSERT (%(symbol)s %(op)s %(value)s, '
+                    'value_constraint);\n'
                     % vars(self))
             self.subtests.append(CompileSubTest(
                 'Value of symbol %s' % self.symbol,
@@ -552,6 +552,16 @@ class HeaderTests(object):
         self.skipped += 1
         sys.stdout.flush()
 
+    def common_definitions(self):
+        """Add any required common definition for the compilation tests."""
+        text = ('#define __STR(pre,post) pre ## post\n'
+                '#define _STR(pre,post) __STR(pre, post)\n'
+                '#define STATIC_ASSERT(cond, msg) \\\n'
+                '  typedef struct {\\\n'
+                '    int _STR (static_assertion_failed_, msg) : !!(cond);\\\n'
+                '  } _STR (static_assertion_failed_, __COUNTER__)\n')
+        return text
+
     def compile_test(self, name, text):
         """Run a compilation test; return True if it passes."""
         self.total += 1
@@ -565,7 +575,8 @@ class HeaderTests(object):
         c_file = os.path.join(self.temp_dir, 'test.c')
         o_file = os.path.join(self.temp_dir, 'test.o')
         with open(c_file, 'w') as c_file_out:
-            c_file_out.write('#include <%s>\n%s' % (self.header, text))
+            c_file_out.write('#include <%s>\n%s\n%s' %
+                    (self.header, self.common_definitions(), text))
         cmd = ('%s %s -c %s -o %s' % (self.cc, self.cflags, c_file, o_file))
         try:
             subprocess.check_call(cmd, shell=True)

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [glibc/azanella/clang] conform: Replace _Static_assert with macro
@ 2022-06-09 21:24 Adhemerval Zanella
  0 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2022-06-09 21:24 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=25224435229e5980e139d7695dbc9cd91b7579d0

commit 25224435229e5980e139d7695dbc9cd91b7579d0
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Mar 29 16:06:13 2022 -0300

    conform: Replace _Static_assert with macro
    
    clang does not allow non integral constant expression in
    _Static_assert.  Replace with a macro that uses name bit-field
    where an invalid constant expression sets its size to 0, resulting
    in a error.

Diff:
---
 conform/conformtest.py | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/conform/conformtest.py b/conform/conformtest.py
index 3d2b9cec03..abdfd40d11 100644
--- a/conform/conformtest.py
+++ b/conform/conformtest.py
@@ -157,9 +157,9 @@ class ConstantTest(object):
                     '%s'
                     '# define conformtest_%d_value (%s)\n'
                     '#endif\n'
-                    '_Static_assert (((%s < 0) == conformtest_%d_negative) '
+                    'STATIC_ASSERT (((%s < 0) == conformtest_%d_negative) '
                     '&& (%s == conformtest_%d_value), '
-                    '"value match inside and outside #if");\n'
+                    'value_match_inside_and_outside_if);\n'
                     % (self.symbol, self.num, sym_bits_def_neg, self.num,
                        sym_bits_or_neg, self.num, sym_bits_def_pos, self.num,
                        sym_bits_or_pos, self.symbol, self.num, self.symbol,
@@ -179,8 +179,8 @@ class ConstantTest(object):
                 'Type of symbol %s' % self.symbol,
                 text))
         if self.op is not None:
-            text = ('_Static_assert (%(symbol)s %(op)s %(value)s, '
-                    '"value constraint");\n'
+            text = ('STATIC_ASSERT (%(symbol)s %(op)s %(value)s, '
+                    'value_constraint);\n'
                     % vars(self))
             self.subtests.append(CompileSubTest(
                 'Value of symbol %s' % self.symbol,
@@ -552,6 +552,16 @@ class HeaderTests(object):
         self.skipped += 1
         sys.stdout.flush()
 
+    def common_definitions(self):
+        """Add any required common definition for the compilation tests."""
+        text = ('#define __STR(pre,post) pre ## post\n'
+                '#define _STR(pre,post) __STR(pre, post)\n'
+                '#define STATIC_ASSERT(cond, msg) \\\n'
+                '  typedef struct {\\\n'
+                '    int _STR (static_assertion_failed_, msg) : !!(cond);\\\n'
+                '  } _STR (static_assertion_failed_, __COUNTER__)\n')
+        return text
+
     def compile_test(self, name, text):
         """Run a compilation test; return True if it passes."""
         self.total += 1
@@ -565,7 +575,8 @@ class HeaderTests(object):
         c_file = os.path.join(self.temp_dir, 'test.c')
         o_file = os.path.join(self.temp_dir, 'test.o')
         with open(c_file, 'w') as c_file_out:
-            c_file_out.write('#include <%s>\n%s' % (self.header, text))
+            c_file_out.write('#include <%s>\n%s\n%s' %
+                    (self.header, self.common_definitions(), text))
         cmd = ('%s %s -c %s -o %s' % (self.cc, self.cflags, c_file, o_file))
         try:
             subprocess.check_call(cmd, shell=True)


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [glibc/azanella/clang] conform: Replace _Static_assert with macro
@ 2022-06-09 13:21 Adhemerval Zanella
  0 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2022-06-09 13:21 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=25224435229e5980e139d7695dbc9cd91b7579d0

commit 25224435229e5980e139d7695dbc9cd91b7579d0
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Mar 29 16:06:13 2022 -0300

    conform: Replace _Static_assert with macro
    
    clang does not allow non integral constant expression in
    _Static_assert.  Replace with a macro that uses name bit-field
    where an invalid constant expression sets its size to 0, resulting
    in a error.

Diff:
---
 conform/conformtest.py | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/conform/conformtest.py b/conform/conformtest.py
index 3d2b9cec03..abdfd40d11 100644
--- a/conform/conformtest.py
+++ b/conform/conformtest.py
@@ -157,9 +157,9 @@ class ConstantTest(object):
                     '%s'
                     '# define conformtest_%d_value (%s)\n'
                     '#endif\n'
-                    '_Static_assert (((%s < 0) == conformtest_%d_negative) '
+                    'STATIC_ASSERT (((%s < 0) == conformtest_%d_negative) '
                     '&& (%s == conformtest_%d_value), '
-                    '"value match inside and outside #if");\n'
+                    'value_match_inside_and_outside_if);\n'
                     % (self.symbol, self.num, sym_bits_def_neg, self.num,
                        sym_bits_or_neg, self.num, sym_bits_def_pos, self.num,
                        sym_bits_or_pos, self.symbol, self.num, self.symbol,
@@ -179,8 +179,8 @@ class ConstantTest(object):
                 'Type of symbol %s' % self.symbol,
                 text))
         if self.op is not None:
-            text = ('_Static_assert (%(symbol)s %(op)s %(value)s, '
-                    '"value constraint");\n'
+            text = ('STATIC_ASSERT (%(symbol)s %(op)s %(value)s, '
+                    'value_constraint);\n'
                     % vars(self))
             self.subtests.append(CompileSubTest(
                 'Value of symbol %s' % self.symbol,
@@ -552,6 +552,16 @@ class HeaderTests(object):
         self.skipped += 1
         sys.stdout.flush()
 
+    def common_definitions(self):
+        """Add any required common definition for the compilation tests."""
+        text = ('#define __STR(pre,post) pre ## post\n'
+                '#define _STR(pre,post) __STR(pre, post)\n'
+                '#define STATIC_ASSERT(cond, msg) \\\n'
+                '  typedef struct {\\\n'
+                '    int _STR (static_assertion_failed_, msg) : !!(cond);\\\n'
+                '  } _STR (static_assertion_failed_, __COUNTER__)\n')
+        return text
+
     def compile_test(self, name, text):
         """Run a compilation test; return True if it passes."""
         self.total += 1
@@ -565,7 +575,8 @@ class HeaderTests(object):
         c_file = os.path.join(self.temp_dir, 'test.c')
         o_file = os.path.join(self.temp_dir, 'test.o')
         with open(c_file, 'w') as c_file_out:
-            c_file_out.write('#include <%s>\n%s' % (self.header, text))
+            c_file_out.write('#include <%s>\n%s\n%s' %
+                    (self.header, self.common_definitions(), text))
         cmd = ('%s %s -c %s -o %s' % (self.cc, self.cflags, c_file, o_file))
         try:
             subprocess.check_call(cmd, shell=True)


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [glibc/azanella/clang] conform: Replace _Static_assert with macro
@ 2022-06-03 14:10 Adhemerval Zanella
  0 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2022-06-03 14:10 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=095b3095be36e978980dab49a6da743aa4a0e5c2

commit 095b3095be36e978980dab49a6da743aa4a0e5c2
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Mar 29 16:06:13 2022 -0300

    conform: Replace _Static_assert with macro
    
    clang does not allow non integral constant expression in
    _Static_assert.  Replace with a macro that uses name bit-field
    where an invalid constant expression sets its size to 0, resulting
    in a error.

Diff:
---
 conform/conformtest.py | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/conform/conformtest.py b/conform/conformtest.py
index 3d2b9cec03..abdfd40d11 100644
--- a/conform/conformtest.py
+++ b/conform/conformtest.py
@@ -157,9 +157,9 @@ class ConstantTest(object):
                     '%s'
                     '# define conformtest_%d_value (%s)\n'
                     '#endif\n'
-                    '_Static_assert (((%s < 0) == conformtest_%d_negative) '
+                    'STATIC_ASSERT (((%s < 0) == conformtest_%d_negative) '
                     '&& (%s == conformtest_%d_value), '
-                    '"value match inside and outside #if");\n'
+                    'value_match_inside_and_outside_if);\n'
                     % (self.symbol, self.num, sym_bits_def_neg, self.num,
                        sym_bits_or_neg, self.num, sym_bits_def_pos, self.num,
                        sym_bits_or_pos, self.symbol, self.num, self.symbol,
@@ -179,8 +179,8 @@ class ConstantTest(object):
                 'Type of symbol %s' % self.symbol,
                 text))
         if self.op is not None:
-            text = ('_Static_assert (%(symbol)s %(op)s %(value)s, '
-                    '"value constraint");\n'
+            text = ('STATIC_ASSERT (%(symbol)s %(op)s %(value)s, '
+                    'value_constraint);\n'
                     % vars(self))
             self.subtests.append(CompileSubTest(
                 'Value of symbol %s' % self.symbol,
@@ -552,6 +552,16 @@ class HeaderTests(object):
         self.skipped += 1
         sys.stdout.flush()
 
+    def common_definitions(self):
+        """Add any required common definition for the compilation tests."""
+        text = ('#define __STR(pre,post) pre ## post\n'
+                '#define _STR(pre,post) __STR(pre, post)\n'
+                '#define STATIC_ASSERT(cond, msg) \\\n'
+                '  typedef struct {\\\n'
+                '    int _STR (static_assertion_failed_, msg) : !!(cond);\\\n'
+                '  } _STR (static_assertion_failed_, __COUNTER__)\n')
+        return text
+
     def compile_test(self, name, text):
         """Run a compilation test; return True if it passes."""
         self.total += 1
@@ -565,7 +575,8 @@ class HeaderTests(object):
         c_file = os.path.join(self.temp_dir, 'test.c')
         o_file = os.path.join(self.temp_dir, 'test.o')
         with open(c_file, 'w') as c_file_out:
-            c_file_out.write('#include <%s>\n%s' % (self.header, text))
+            c_file_out.write('#include <%s>\n%s\n%s' %
+                    (self.header, self.common_definitions(), text))
         cmd = ('%s %s -c %s -o %s' % (self.cc, self.cflags, c_file, o_file))
         try:
             subprocess.check_call(cmd, shell=True)


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [glibc/azanella/clang] conform: Replace _Static_assert with macro
@ 2022-05-13 14:24 Adhemerval Zanella
  0 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2022-05-13 14:24 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=241696e00312c9ca7f6344a95be69ed1d79dbe0a

commit 241696e00312c9ca7f6344a95be69ed1d79dbe0a
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Mar 29 16:06:13 2022 -0300

    conform: Replace _Static_assert with macro
    
    clang does not allow non integral constant expression in
    _Static_assert.  Replace with a macro that uses name bit-field
    where an invalid constant expression sets its size to 0, resulting
    in a error.

Diff:
---
 conform/conformtest.py | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/conform/conformtest.py b/conform/conformtest.py
index 3d2b9cec03..abdfd40d11 100644
--- a/conform/conformtest.py
+++ b/conform/conformtest.py
@@ -157,9 +157,9 @@ class ConstantTest(object):
                     '%s'
                     '# define conformtest_%d_value (%s)\n'
                     '#endif\n'
-                    '_Static_assert (((%s < 0) == conformtest_%d_negative) '
+                    'STATIC_ASSERT (((%s < 0) == conformtest_%d_negative) '
                     '&& (%s == conformtest_%d_value), '
-                    '"value match inside and outside #if");\n'
+                    'value_match_inside_and_outside_if);\n'
                     % (self.symbol, self.num, sym_bits_def_neg, self.num,
                        sym_bits_or_neg, self.num, sym_bits_def_pos, self.num,
                        sym_bits_or_pos, self.symbol, self.num, self.symbol,
@@ -179,8 +179,8 @@ class ConstantTest(object):
                 'Type of symbol %s' % self.symbol,
                 text))
         if self.op is not None:
-            text = ('_Static_assert (%(symbol)s %(op)s %(value)s, '
-                    '"value constraint");\n'
+            text = ('STATIC_ASSERT (%(symbol)s %(op)s %(value)s, '
+                    'value_constraint);\n'
                     % vars(self))
             self.subtests.append(CompileSubTest(
                 'Value of symbol %s' % self.symbol,
@@ -552,6 +552,16 @@ class HeaderTests(object):
         self.skipped += 1
         sys.stdout.flush()
 
+    def common_definitions(self):
+        """Add any required common definition for the compilation tests."""
+        text = ('#define __STR(pre,post) pre ## post\n'
+                '#define _STR(pre,post) __STR(pre, post)\n'
+                '#define STATIC_ASSERT(cond, msg) \\\n'
+                '  typedef struct {\\\n'
+                '    int _STR (static_assertion_failed_, msg) : !!(cond);\\\n'
+                '  } _STR (static_assertion_failed_, __COUNTER__)\n')
+        return text
+
     def compile_test(self, name, text):
         """Run a compilation test; return True if it passes."""
         self.total += 1
@@ -565,7 +575,8 @@ class HeaderTests(object):
         c_file = os.path.join(self.temp_dir, 'test.c')
         o_file = os.path.join(self.temp_dir, 'test.o')
         with open(c_file, 'w') as c_file_out:
-            c_file_out.write('#include <%s>\n%s' % (self.header, text))
+            c_file_out.write('#include <%s>\n%s\n%s' %
+                    (self.header, self.common_definitions(), text))
         cmd = ('%s %s -c %s -o %s' % (self.cc, self.cflags, c_file, o_file))
         try:
             subprocess.check_call(cmd, shell=True)


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [glibc/azanella/clang] conform: Replace _Static_assert with macro
@ 2022-05-12 19:38 Adhemerval Zanella
  0 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2022-05-12 19:38 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=37ca76bc2a673d5cd8394dcd2c266527dcf5782e

commit 37ca76bc2a673d5cd8394dcd2c266527dcf5782e
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Mar 29 16:06:13 2022 -0300

    conform: Replace _Static_assert with macro
    
    clang does not allow non integral constant expression in
    _Static_assert.  Replace with a macro that uses name bit-field
    where an invalid constant expression sets its size to 0, resulting
    in a error.

Diff:
---
 conform/conformtest.py | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/conform/conformtest.py b/conform/conformtest.py
index 3d2b9cec03..abdfd40d11 100644
--- a/conform/conformtest.py
+++ b/conform/conformtest.py
@@ -157,9 +157,9 @@ class ConstantTest(object):
                     '%s'
                     '# define conformtest_%d_value (%s)\n'
                     '#endif\n'
-                    '_Static_assert (((%s < 0) == conformtest_%d_negative) '
+                    'STATIC_ASSERT (((%s < 0) == conformtest_%d_negative) '
                     '&& (%s == conformtest_%d_value), '
-                    '"value match inside and outside #if");\n'
+                    'value_match_inside_and_outside_if);\n'
                     % (self.symbol, self.num, sym_bits_def_neg, self.num,
                        sym_bits_or_neg, self.num, sym_bits_def_pos, self.num,
                        sym_bits_or_pos, self.symbol, self.num, self.symbol,
@@ -179,8 +179,8 @@ class ConstantTest(object):
                 'Type of symbol %s' % self.symbol,
                 text))
         if self.op is not None:
-            text = ('_Static_assert (%(symbol)s %(op)s %(value)s, '
-                    '"value constraint");\n'
+            text = ('STATIC_ASSERT (%(symbol)s %(op)s %(value)s, '
+                    'value_constraint);\n'
                     % vars(self))
             self.subtests.append(CompileSubTest(
                 'Value of symbol %s' % self.symbol,
@@ -552,6 +552,16 @@ class HeaderTests(object):
         self.skipped += 1
         sys.stdout.flush()
 
+    def common_definitions(self):
+        """Add any required common definition for the compilation tests."""
+        text = ('#define __STR(pre,post) pre ## post\n'
+                '#define _STR(pre,post) __STR(pre, post)\n'
+                '#define STATIC_ASSERT(cond, msg) \\\n'
+                '  typedef struct {\\\n'
+                '    int _STR (static_assertion_failed_, msg) : !!(cond);\\\n'
+                '  } _STR (static_assertion_failed_, __COUNTER__)\n')
+        return text
+
     def compile_test(self, name, text):
         """Run a compilation test; return True if it passes."""
         self.total += 1
@@ -565,7 +575,8 @@ class HeaderTests(object):
         c_file = os.path.join(self.temp_dir, 'test.c')
         o_file = os.path.join(self.temp_dir, 'test.o')
         with open(c_file, 'w') as c_file_out:
-            c_file_out.write('#include <%s>\n%s' % (self.header, text))
+            c_file_out.write('#include <%s>\n%s\n%s' %
+                    (self.header, self.common_definitions(), text))
         cmd = ('%s %s -c %s -o %s' % (self.cc, self.cflags, c_file, o_file))
         try:
             subprocess.check_call(cmd, shell=True)


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [glibc/azanella/clang] conform: Replace _Static_assert with macro
@ 2022-05-10 18:28 Adhemerval Zanella
  0 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2022-05-10 18:28 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=7345ab92617e19b0da8ee164b02359d9844edae8

commit 7345ab92617e19b0da8ee164b02359d9844edae8
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Mar 29 16:06:13 2022 -0300

    conform: Replace _Static_assert with macro
    
    clang does not allow non integral constant expression in
    _Static_assert.  Replace with a macro that uses name bit-field
    where an invalid constant expression sets its size to 0, resulting
    in a error.

Diff:
---
 conform/conformtest.py | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/conform/conformtest.py b/conform/conformtest.py
index 3d2b9cec03..abdfd40d11 100644
--- a/conform/conformtest.py
+++ b/conform/conformtest.py
@@ -157,9 +157,9 @@ class ConstantTest(object):
                     '%s'
                     '# define conformtest_%d_value (%s)\n'
                     '#endif\n'
-                    '_Static_assert (((%s < 0) == conformtest_%d_negative) '
+                    'STATIC_ASSERT (((%s < 0) == conformtest_%d_negative) '
                     '&& (%s == conformtest_%d_value), '
-                    '"value match inside and outside #if");\n'
+                    'value_match_inside_and_outside_if);\n'
                     % (self.symbol, self.num, sym_bits_def_neg, self.num,
                        sym_bits_or_neg, self.num, sym_bits_def_pos, self.num,
                        sym_bits_or_pos, self.symbol, self.num, self.symbol,
@@ -179,8 +179,8 @@ class ConstantTest(object):
                 'Type of symbol %s' % self.symbol,
                 text))
         if self.op is not None:
-            text = ('_Static_assert (%(symbol)s %(op)s %(value)s, '
-                    '"value constraint");\n'
+            text = ('STATIC_ASSERT (%(symbol)s %(op)s %(value)s, '
+                    'value_constraint);\n'
                     % vars(self))
             self.subtests.append(CompileSubTest(
                 'Value of symbol %s' % self.symbol,
@@ -552,6 +552,16 @@ class HeaderTests(object):
         self.skipped += 1
         sys.stdout.flush()
 
+    def common_definitions(self):
+        """Add any required common definition for the compilation tests."""
+        text = ('#define __STR(pre,post) pre ## post\n'
+                '#define _STR(pre,post) __STR(pre, post)\n'
+                '#define STATIC_ASSERT(cond, msg) \\\n'
+                '  typedef struct {\\\n'
+                '    int _STR (static_assertion_failed_, msg) : !!(cond);\\\n'
+                '  } _STR (static_assertion_failed_, __COUNTER__)\n')
+        return text
+
     def compile_test(self, name, text):
         """Run a compilation test; return True if it passes."""
         self.total += 1
@@ -565,7 +575,8 @@ class HeaderTests(object):
         c_file = os.path.join(self.temp_dir, 'test.c')
         o_file = os.path.join(self.temp_dir, 'test.o')
         with open(c_file, 'w') as c_file_out:
-            c_file_out.write('#include <%s>\n%s' % (self.header, text))
+            c_file_out.write('#include <%s>\n%s\n%s' %
+                    (self.header, self.common_definitions(), text))
         cmd = ('%s %s -c %s -o %s' % (self.cc, self.cflags, c_file, o_file))
         try:
             subprocess.check_call(cmd, shell=True)


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [glibc/azanella/clang] conform: Replace _Static_assert with macro
@ 2022-04-29 14:08 Adhemerval Zanella
  0 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2022-04-29 14:08 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=c021a7619a34e1214d9fd17793e17e480d548da9

commit c021a7619a34e1214d9fd17793e17e480d548da9
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Mar 29 16:06:13 2022 -0300

    conform: Replace _Static_assert with macro
    
    clang does not allow non integral constant expression in
    _Static_assert.  Replace with a macro that uses name bit-field
    where an invalid constant expression sets its size to 0, resulting
    in a error.

Diff:
---
 conform/conformtest.py | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/conform/conformtest.py b/conform/conformtest.py
index 3d2b9cec03..abdfd40d11 100644
--- a/conform/conformtest.py
+++ b/conform/conformtest.py
@@ -157,9 +157,9 @@ class ConstantTest(object):
                     '%s'
                     '# define conformtest_%d_value (%s)\n'
                     '#endif\n'
-                    '_Static_assert (((%s < 0) == conformtest_%d_negative) '
+                    'STATIC_ASSERT (((%s < 0) == conformtest_%d_negative) '
                     '&& (%s == conformtest_%d_value), '
-                    '"value match inside and outside #if");\n'
+                    'value_match_inside_and_outside_if);\n'
                     % (self.symbol, self.num, sym_bits_def_neg, self.num,
                        sym_bits_or_neg, self.num, sym_bits_def_pos, self.num,
                        sym_bits_or_pos, self.symbol, self.num, self.symbol,
@@ -179,8 +179,8 @@ class ConstantTest(object):
                 'Type of symbol %s' % self.symbol,
                 text))
         if self.op is not None:
-            text = ('_Static_assert (%(symbol)s %(op)s %(value)s, '
-                    '"value constraint");\n'
+            text = ('STATIC_ASSERT (%(symbol)s %(op)s %(value)s, '
+                    'value_constraint);\n'
                     % vars(self))
             self.subtests.append(CompileSubTest(
                 'Value of symbol %s' % self.symbol,
@@ -552,6 +552,16 @@ class HeaderTests(object):
         self.skipped += 1
         sys.stdout.flush()
 
+    def common_definitions(self):
+        """Add any required common definition for the compilation tests."""
+        text = ('#define __STR(pre,post) pre ## post\n'
+                '#define _STR(pre,post) __STR(pre, post)\n'
+                '#define STATIC_ASSERT(cond, msg) \\\n'
+                '  typedef struct {\\\n'
+                '    int _STR (static_assertion_failed_, msg) : !!(cond);\\\n'
+                '  } _STR (static_assertion_failed_, __COUNTER__)\n')
+        return text
+
     def compile_test(self, name, text):
         """Run a compilation test; return True if it passes."""
         self.total += 1
@@ -565,7 +575,8 @@ class HeaderTests(object):
         c_file = os.path.join(self.temp_dir, 'test.c')
         o_file = os.path.join(self.temp_dir, 'test.o')
         with open(c_file, 'w') as c_file_out:
-            c_file_out.write('#include <%s>\n%s' % (self.header, text))
+            c_file_out.write('#include <%s>\n%s\n%s' %
+                    (self.header, self.common_definitions(), text))
         cmd = ('%s %s -c %s -o %s' % (self.cc, self.cflags, c_file, o_file))
         try:
             subprocess.check_call(cmd, shell=True)


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [glibc/azanella/clang] conform: Replace _Static_assert with macro
@ 2022-04-04 12:58 Adhemerval Zanella
  0 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2022-04-04 12:58 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=877a753e7526cf9b74bbb6271cac16aee6517880

commit 877a753e7526cf9b74bbb6271cac16aee6517880
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Mar 29 16:06:13 2022 -0300

    conform: Replace _Static_assert with macro
    
    clang does not allow non integral constant expression in
    _Static_assert.  Replace with a macro that uses name bit-field
    where an invalid constant expression sets its size to 0, resulting
    in a error.

Diff:
---
 conform/conformtest.py | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/conform/conformtest.py b/conform/conformtest.py
index 3d2b9cec03..abdfd40d11 100644
--- a/conform/conformtest.py
+++ b/conform/conformtest.py
@@ -157,9 +157,9 @@ class ConstantTest(object):
                     '%s'
                     '# define conformtest_%d_value (%s)\n'
                     '#endif\n'
-                    '_Static_assert (((%s < 0) == conformtest_%d_negative) '
+                    'STATIC_ASSERT (((%s < 0) == conformtest_%d_negative) '
                     '&& (%s == conformtest_%d_value), '
-                    '"value match inside and outside #if");\n'
+                    'value_match_inside_and_outside_if);\n'
                     % (self.symbol, self.num, sym_bits_def_neg, self.num,
                        sym_bits_or_neg, self.num, sym_bits_def_pos, self.num,
                        sym_bits_or_pos, self.symbol, self.num, self.symbol,
@@ -179,8 +179,8 @@ class ConstantTest(object):
                 'Type of symbol %s' % self.symbol,
                 text))
         if self.op is not None:
-            text = ('_Static_assert (%(symbol)s %(op)s %(value)s, '
-                    '"value constraint");\n'
+            text = ('STATIC_ASSERT (%(symbol)s %(op)s %(value)s, '
+                    'value_constraint);\n'
                     % vars(self))
             self.subtests.append(CompileSubTest(
                 'Value of symbol %s' % self.symbol,
@@ -552,6 +552,16 @@ class HeaderTests(object):
         self.skipped += 1
         sys.stdout.flush()
 
+    def common_definitions(self):
+        """Add any required common definition for the compilation tests."""
+        text = ('#define __STR(pre,post) pre ## post\n'
+                '#define _STR(pre,post) __STR(pre, post)\n'
+                '#define STATIC_ASSERT(cond, msg) \\\n'
+                '  typedef struct {\\\n'
+                '    int _STR (static_assertion_failed_, msg) : !!(cond);\\\n'
+                '  } _STR (static_assertion_failed_, __COUNTER__)\n')
+        return text
+
     def compile_test(self, name, text):
         """Run a compilation test; return True if it passes."""
         self.total += 1
@@ -565,7 +575,8 @@ class HeaderTests(object):
         c_file = os.path.join(self.temp_dir, 'test.c')
         o_file = os.path.join(self.temp_dir, 'test.o')
         with open(c_file, 'w') as c_file_out:
-            c_file_out.write('#include <%s>\n%s' % (self.header, text))
+            c_file_out.write('#include <%s>\n%s\n%s' %
+                    (self.header, self.common_definitions(), text))
         cmd = ('%s %s -c %s -o %s' % (self.cc, self.cflags, c_file, o_file))
         try:
             subprocess.check_call(cmd, shell=True)


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [glibc/azanella/clang] conform: Replace _Static_assert with macro
@ 2022-03-31 19:11 Adhemerval Zanella
  0 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2022-03-31 19:11 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=1230f63d29c58cd1f62dd5869ec3bfaa30c5e632

commit 1230f63d29c58cd1f62dd5869ec3bfaa30c5e632
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Mar 29 16:06:13 2022 -0300

    conform: Replace _Static_assert with macro
    
    clang does not allow non integral constant expression in
    _Static_assert.  Replace with a macro that uses name bit-field
    where an invalid constant expression sets its size to 0, resulting
    in a error.

Diff:
---
 conform/conformtest.py | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/conform/conformtest.py b/conform/conformtest.py
index 3d2b9cec03..abdfd40d11 100644
--- a/conform/conformtest.py
+++ b/conform/conformtest.py
@@ -157,9 +157,9 @@ class ConstantTest(object):
                     '%s'
                     '# define conformtest_%d_value (%s)\n'
                     '#endif\n'
-                    '_Static_assert (((%s < 0) == conformtest_%d_negative) '
+                    'STATIC_ASSERT (((%s < 0) == conformtest_%d_negative) '
                     '&& (%s == conformtest_%d_value), '
-                    '"value match inside and outside #if");\n'
+                    'value_match_inside_and_outside_if);\n'
                     % (self.symbol, self.num, sym_bits_def_neg, self.num,
                        sym_bits_or_neg, self.num, sym_bits_def_pos, self.num,
                        sym_bits_or_pos, self.symbol, self.num, self.symbol,
@@ -179,8 +179,8 @@ class ConstantTest(object):
                 'Type of symbol %s' % self.symbol,
                 text))
         if self.op is not None:
-            text = ('_Static_assert (%(symbol)s %(op)s %(value)s, '
-                    '"value constraint");\n'
+            text = ('STATIC_ASSERT (%(symbol)s %(op)s %(value)s, '
+                    'value_constraint);\n'
                     % vars(self))
             self.subtests.append(CompileSubTest(
                 'Value of symbol %s' % self.symbol,
@@ -552,6 +552,16 @@ class HeaderTests(object):
         self.skipped += 1
         sys.stdout.flush()
 
+    def common_definitions(self):
+        """Add any required common definition for the compilation tests."""
+        text = ('#define __STR(pre,post) pre ## post\n'
+                '#define _STR(pre,post) __STR(pre, post)\n'
+                '#define STATIC_ASSERT(cond, msg) \\\n'
+                '  typedef struct {\\\n'
+                '    int _STR (static_assertion_failed_, msg) : !!(cond);\\\n'
+                '  } _STR (static_assertion_failed_, __COUNTER__)\n')
+        return text
+
     def compile_test(self, name, text):
         """Run a compilation test; return True if it passes."""
         self.total += 1
@@ -565,7 +575,8 @@ class HeaderTests(object):
         c_file = os.path.join(self.temp_dir, 'test.c')
         o_file = os.path.join(self.temp_dir, 'test.o')
         with open(c_file, 'w') as c_file_out:
-            c_file_out.write('#include <%s>\n%s' % (self.header, text))
+            c_file_out.write('#include <%s>\n%s\n%s' %
+                    (self.header, self.common_definitions(), text))
         cmd = ('%s %s -c %s -o %s' % (self.cc, self.cflags, c_file, o_file))
         try:
             subprocess.check_call(cmd, shell=True)


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [glibc/azanella/clang] conform: Replace _Static_assert with macro
@ 2022-03-29 20:35 Adhemerval Zanella
  0 siblings, 0 replies; 21+ messages in thread
From: Adhemerval Zanella @ 2022-03-29 20:35 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=c83e8ff0b2b8f3759804d518462c764d4ccad771

commit c83e8ff0b2b8f3759804d518462c764d4ccad771
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Mar 29 16:06:13 2022 -0300

    conform: Replace _Static_assert with macro
    
    clang does not allow non integral constant expression in
    _Static_assert.  Replace with a macro that uses name bit-field
    where an invalid constant expression sets its size to 0, resulting
    in a error.

Diff:
---
 conform/conformtest.py | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/conform/conformtest.py b/conform/conformtest.py
index 3d2b9cec03..abdfd40d11 100644
--- a/conform/conformtest.py
+++ b/conform/conformtest.py
@@ -157,9 +157,9 @@ class ConstantTest(object):
                     '%s'
                     '# define conformtest_%d_value (%s)\n'
                     '#endif\n'
-                    '_Static_assert (((%s < 0) == conformtest_%d_negative) '
+                    'STATIC_ASSERT (((%s < 0) == conformtest_%d_negative) '
                     '&& (%s == conformtest_%d_value), '
-                    '"value match inside and outside #if");\n'
+                    'value_match_inside_and_outside_if);\n'
                     % (self.symbol, self.num, sym_bits_def_neg, self.num,
                        sym_bits_or_neg, self.num, sym_bits_def_pos, self.num,
                        sym_bits_or_pos, self.symbol, self.num, self.symbol,
@@ -179,8 +179,8 @@ class ConstantTest(object):
                 'Type of symbol %s' % self.symbol,
                 text))
         if self.op is not None:
-            text = ('_Static_assert (%(symbol)s %(op)s %(value)s, '
-                    '"value constraint");\n'
+            text = ('STATIC_ASSERT (%(symbol)s %(op)s %(value)s, '
+                    'value_constraint);\n'
                     % vars(self))
             self.subtests.append(CompileSubTest(
                 'Value of symbol %s' % self.symbol,
@@ -552,6 +552,16 @@ class HeaderTests(object):
         self.skipped += 1
         sys.stdout.flush()
 
+    def common_definitions(self):
+        """Add any required common definition for the compilation tests."""
+        text = ('#define __STR(pre,post) pre ## post\n'
+                '#define _STR(pre,post) __STR(pre, post)\n'
+                '#define STATIC_ASSERT(cond, msg) \\\n'
+                '  typedef struct {\\\n'
+                '    int _STR (static_assertion_failed_, msg) : !!(cond);\\\n'
+                '  } _STR (static_assertion_failed_, __COUNTER__)\n')
+        return text
+
     def compile_test(self, name, text):
         """Run a compilation test; return True if it passes."""
         self.total += 1
@@ -565,7 +575,8 @@ class HeaderTests(object):
         c_file = os.path.join(self.temp_dir, 'test.c')
         o_file = os.path.join(self.temp_dir, 'test.o')
         with open(c_file, 'w') as c_file_out:
-            c_file_out.write('#include <%s>\n%s' % (self.header, text))
+            c_file_out.write('#include <%s>\n%s\n%s' %
+                    (self.header, self.common_definitions(), text))
         cmd = ('%s %s -c %s -o %s' % (self.cc, self.cflags, c_file, o_file))
         try:
             subprocess.check_call(cmd, shell=True)


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2024-04-17 20:11 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-17 20:11 [glibc/azanella/clang] conform: Replace _Static_assert with macro Adhemerval Zanella
  -- strict thread matches above, loose matches on Subject: below --
2024-04-02 15:57 Adhemerval Zanella
2024-02-09 17:36 Adhemerval Zanella
2024-02-07 14:11 Adhemerval Zanella
2024-01-29 18:01 Adhemerval Zanella
2023-12-21 18:58 Adhemerval Zanella
2023-09-28 17:56 Adhemerval Zanella
2023-08-30 12:40 Adhemerval Zanella
2023-02-09 19:52 Adhemerval Zanella
2022-10-28 17:45 Adhemerval Zanella
2022-10-04 13:03 Adhemerval Zanella
2022-06-09 21:24 Adhemerval Zanella
2022-06-09 13:21 Adhemerval Zanella
2022-06-03 14:10 Adhemerval Zanella
2022-05-13 14:24 Adhemerval Zanella
2022-05-12 19:38 Adhemerval Zanella
2022-05-10 18:28 Adhemerval Zanella
2022-04-29 14:08 Adhemerval Zanella
2022-04-04 12:58 Adhemerval Zanella
2022-03-31 19:11 Adhemerval Zanella
2022-03-29 20:35 Adhemerval Zanella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).