public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-80] c++: Use STATIC_ASSERT for OVL_OP_MAX.
@ 2021-04-23 7:37 Martin Liska
0 siblings, 0 replies; only message in thread
From: Martin Liska @ 2021-04-23 7:37 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:cbca62831cb7c1c7c20d67fcf929f156b09923bf
commit r12-80-gcbca62831cb7c1c7c20d67fcf929f156b09923bf
Author: Martin Liska <mliska@suse.cz>
Date: Fri Mar 12 14:32:07 2021 +0100
c++: Use STATIC_ASSERT for OVL_OP_MAX.
gcc/cp/ChangeLog:
* cp-tree.h (STATIC_ASSERT): Prefer static assert.
* lex.c (init_operators): Remove run-time check.
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 23a77a2b2e0..cb254e0adea 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -5922,6 +5922,9 @@ enum ovl_op_code {
OVL_OP_MAX
};
+/* Make sure it fits in lang_decl_fn::ovl_op_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))
{
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-04-23 7:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-23 7:37 [gcc r12-80] c++: Use STATIC_ASSERT for OVL_OP_MAX 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).