[gcc(refs/users/marxin/heads/add-better-STATIC_ASSERT)] Use STATIC_ASSERT for OVL_OP_MAX.
Martin Liska
marxin@gcc.gnu.org
Thu Mar 18 16:00:48 GMT 2021
https://gcc.gnu.org/g:a938ccd11f00c469e4497d53f3b9be6c681b7927
commit a938ccd11f00c469e4497d53f3b9be6c681b7927
Author: Martin Liska <mliska@suse.cz>
Date: Fri Mar 12 14:32:07 2021 +0100
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 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))
{
More information about the Gcc-cvs
mailing list