public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/marxin/heads/fold-GCC_VERSION-for-old)] Remove conditional STATIC_ASSERT.
@ 2022-05-04 19:19 Martin Liska
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Liska @ 2022-05-04 19:19 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:b08e7e270868a1c5492b8e288cd65a309ccead0c

commit b08e7e270868a1c5492b8e288cd65a309ccead0c
Author: Martin Liska <mliska@suse.cz>
Date:   Wed May 4 21:17:54 2022 +0200

    Remove conditional STATIC_ASSERT.
    
    As we require a c++11 compliant compiler, the #if __cplusplus >= 201103L
    conditional build is always true.
    
    gcc/ChangeLog:
    
            * basic-block.h (STATIC_ASSERT): Use normal STATIC_ASSERT.
            * system.h (STATIC_ASSERT): Define always as static_assert.

Diff:
---
 gcc/basic-block.h | 5 +----
 gcc/system.h      | 9 +--------
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index e3fff1f6975..21a9b24dbf9 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -158,10 +158,7 @@ struct GTY((chain_next ("%h.next_bb"), chain_prev ("%h.prev_bb"))) basic_block_d
 /* This ensures that struct gimple_bb_info is smaller than
    struct rtl_bb_info, so that inlining the former into basic_block_def
    is the better choice.  */
-typedef int __assert_gimple_bb_smaller_rtl_bb
-              [(int) sizeof (struct rtl_bb_info)
-               - (int) sizeof (struct gimple_bb_info)];
-
+STATIC_ASSERT (sizeof (rtl_bb_info) >= sizeof (gimple_bb_info));
 
 #define BB_FREQ_MAX 10000
 
diff --git a/gcc/system.h b/gcc/system.h
index 1688b763ef5..48145951337 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -801,14 +801,7 @@ extern void fancy_abort (const char *, int, const char *)
 
 #define STATIC_CONSTANT_P(X) (__builtin_constant_p (X) && (X))
 
-/* static_assert (COND, MESSAGE) is available in C++11 onwards.  */
-#if __cplusplus >= 201103L
-#define STATIC_ASSERT(X) \
-  static_assert ((X), #X)
-#else
-#define STATIC_ASSERT(X) \
-  typedef int assertion1[(X) ? 1 : -1] ATTRIBUTE_UNUSED
-#endif
+#define STATIC_ASSERT(X) static_assert ((X), #X)
 
 /* Provide a fake boolean type.  We make no attempt to use the
    C99 _Bool, as it may not be available in the bootstrap compiler,


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

* [gcc(refs/users/marxin/heads/fold-GCC_VERSION-for-old)] Remove conditional STATIC_ASSERT.
@ 2022-05-05 12:17 Martin Liska
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Liska @ 2022-05-05 12:17 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:56e87035326f728fc8a3ad2ce1e13b7f6b0572dc

commit 56e87035326f728fc8a3ad2ce1e13b7f6b0572dc
Author: Martin Liska <mliska@suse.cz>
Date:   Wed May 4 21:17:54 2022 +0200

    Remove conditional STATIC_ASSERT.
    
    As we require a c++11 compliant compiler, the #if __cplusplus >= 201103L
    conditional build is always true.
    
    gcc/ChangeLog:
    
            * basic-block.h (STATIC_ASSERT): Use normal STATIC_ASSERT.
            * system.h (STATIC_ASSERT): Define always as static_assert.

Diff:
---
 gcc/basic-block.h | 5 +----
 gcc/system.h      | 9 +--------
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index e3fff1f6975..21a9b24dbf9 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -158,10 +158,7 @@ struct GTY((chain_next ("%h.next_bb"), chain_prev ("%h.prev_bb"))) basic_block_d
 /* This ensures that struct gimple_bb_info is smaller than
    struct rtl_bb_info, so that inlining the former into basic_block_def
    is the better choice.  */
-typedef int __assert_gimple_bb_smaller_rtl_bb
-              [(int) sizeof (struct rtl_bb_info)
-               - (int) sizeof (struct gimple_bb_info)];
-
+STATIC_ASSERT (sizeof (rtl_bb_info) >= sizeof (gimple_bb_info));
 
 #define BB_FREQ_MAX 10000
 
diff --git a/gcc/system.h b/gcc/system.h
index 1688b763ef5..48145951337 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -801,14 +801,7 @@ extern void fancy_abort (const char *, int, const char *)
 
 #define STATIC_CONSTANT_P(X) (__builtin_constant_p (X) && (X))
 
-/* static_assert (COND, MESSAGE) is available in C++11 onwards.  */
-#if __cplusplus >= 201103L
-#define STATIC_ASSERT(X) \
-  static_assert ((X), #X)
-#else
-#define STATIC_ASSERT(X) \
-  typedef int assertion1[(X) ? 1 : -1] ATTRIBUTE_UNUSED
-#endif
+#define STATIC_ASSERT(X) static_assert ((X), #X)
 
 /* Provide a fake boolean type.  We make no attempt to use the
    C99 _Bool, as it may not be available in the bootstrap compiler,


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

end of thread, other threads:[~2022-05-05 12:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-04 19:19 [gcc(refs/users/marxin/heads/fold-GCC_VERSION-for-old)] Remove conditional STATIC_ASSERT Martin Liska
2022-05-05 12:17 Martin Liska

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).