aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2021-03-12 14:32:07 +0100
committerMartin Liska <mliska@suse.cz>2021-04-23 09:37:18 +0200
commitcbca62831cb7c1c7c20d67fcf929f156b09923bf (patch)
treea078ebf0c9493e6ef8a1722aa84dbb8c9dca9592
parent700e542971251b11623cce877075567815f72965 (diff)
downloadgcc-cbca62831cb7c1c7c20d67fcf929f156b09923bf.zip
gcc-cbca62831cb7c1c7c20d67fcf929f156b09923bf.tar.gz
gcc-cbca62831cb7c1c7c20d67fcf929f156b09923bf.tar.bz2
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.
-rw-r--r--gcc/cp/cp-tree.h3
-rw-r--r--gcc/cp/lex.c2
2 files changed, 3 insertions, 2 deletions
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 23a77a2..cb254e0 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 73e14b8..43abd01 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))
{