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/add-better-STATIC_ASSERT)] Use STATIC_ASSERT for OVL_OP_MAX.
Date: Fri, 12 Mar 2021 13:32:28 +0000 (GMT)	[thread overview]
Message-ID: <20210312133228.6F9EA398E464@sourceware.org> (raw)

https://gcc.gnu.org/g:7996d98c465775fc473552cf0712da9e6aac0b2f

commit 7996d98c465775fc473552cf0712da9e6aac0b2f
Author: Martin Liska <mliska@suse.cz>
Date:   Fri Mar 12 14:32:07 2021 +0100

    Use STATIC_ASSERT for OVL_OP_MAX.

Diff:
---
 gcc/cp/cp-tree.h | 3 +++
 gcc/cp/lex.c     | 2 --
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 81ff375f8a5..a8f72448ea9 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -5916,6 +5916,9 @@ enum ovl_op_code {
   OVL_OP_MAX
 };
 
+/* Make sure it fits in lang_decl_fn::operator_code. */
+STATIC_ASSERT (OVL_OP_MAX < (1 << 6));
+
 struct GTY(()) ovl_op_info_t {
   /* The IDENTIFIER_NODE for the operator.  */
   tree identifier;
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index 73e14b8394c..43abd019e6e 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -166,8 +166,6 @@ init_operators (void)
 
       if (op_ptr->name)
 	{
-	  /* Make sure it fits in lang_decl_fn::operator_code. */
-	  gcc_checking_assert (op_ptr->ovl_op_code < (1 << 6));
 	  tree ident = set_operator_ident (op_ptr);
 	  if (unsigned index = IDENTIFIER_CP_INDEX (ident))
 	    {


             reply	other threads:[~2021-03-12 13:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-12 13:32 Martin Liska [this message]
2021-03-18 16:00 Martin Liska
2021-04-22  8:53 Martin Liska

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=20210312133228.6F9EA398E464@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).