public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Martin Liska <marxin@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/users/marxin/heads/fold-GCC_VERSION-for-old-v2)] Remove conditional STATIC_ASSERT.
Date: Thu,  5 May 2022 18:19:40 +0000 (GMT)	[thread overview]
Message-ID: <20220505181940.9B21B385741A@sourceware.org> (raw)

https://gcc.gnu.org/g:96cda69869bafe6a84ffb9e82d8932bdcc7f9e85

commit 96cda69869bafe6a84ffb9e82d8932bdcc7f9e85
Author: Martin Liška <mliska@suse.cz>
Date:   Thu May 5 14:18:58 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 as static_assert for C++
            and fallback to array index in C.

Diff:
---
 gcc/basic-block.h | 5 +----
 gcc/system.h      | 3 +--
 2 files changed, 2 insertions(+), 6 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..1bb12a7c62f 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -801,8 +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
+#ifdef __cplusplus
 #define STATIC_ASSERT(X) \
   static_assert ((X), #X)
 #else


                 reply	other threads:[~2022-05-05 18:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220505181940.9B21B385741A@sourceware.org \
    --to=marxin@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).