aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2025-03-19 15:02:23 +0100
committerRichard Biener <rguenth@gcc.gnu.org>2025-03-20 10:07:54 +0100
commit56145ae79b89b823f306c2c241f6a1fe5d604816 (patch)
treedb63c9d4689d4f5bf1e2e78ebc5507b70ad909c1 /gcc
parent8d236c53c679ca920092ce9200785fcccd97d971 (diff)
downloadgcc-56145ae79b89b823f306c2c241f6a1fe5d604816.zip
gcc-56145ae79b89b823f306c2c241f6a1fe5d604816.tar.gz
gcc-56145ae79b89b823f306c2c241f6a1fe5d604816.tar.bz2
Make function_decl_type a scoped enum
The enum currently has a member named NONE which pollutes the global namespace unnecessarily. Use a scoped enum instead. gcc/ * tree-core.h (function_decl_type): Make a scoped enum. * tree.h (set_function_decl_type): Adjust. (DECL_IS_OPERATOR_NEW_P): Likewise. (DECL_SET_IS_OPERATOR_NEW): Likewise. (DECL_IS_OPERATOR_DELETE_P): Likewise. (DECL_SET_IS_OPERATOR_DELETE): Likewise. (DECL_LAMBDA_FUNCTION_P): Likewise. (DECL_SET_LAMBDA_FUNCTION): Likewise. * lto-streamer-out.cc (hash_tree): Hash all of FUNCTION_DECL_DECL_TYPE. * tree-streamer-out.cc (pack_ts_function_decl_value_fields): Adjust. * config/aarch64/aarch64-simd-pragma-builtins.def (vcombine_mf8): Use literal zero instead of NONE. gcc/cp/ * module.cc (trees_out::core_bools): Convert scoped enum explicitly.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/aarch64/aarch64-simd-pragma-builtins.def2
-rw-r--r--gcc/cp/module.cc2
-rw-r--r--gcc/lto-streamer-out.cc2
-rw-r--r--gcc/tree-core.h2
-rw-r--r--gcc/tree-streamer-out.cc2
-rw-r--r--gcc/tree.h22
6 files changed, 19 insertions, 13 deletions
diff --git a/gcc/config/aarch64/aarch64-simd-pragma-builtins.def b/gcc/config/aarch64/aarch64-simd-pragma-builtins.def
index 2c0dc11..7768236 100644
--- a/gcc/config/aarch64/aarch64-simd-pragma-builtins.def
+++ b/gcc/config/aarch64/aarch64-simd-pragma-builtins.def
@@ -203,7 +203,7 @@ ENTRY_TERNARY (vbslq_mf8, mf8q, u8q, mf8q, mf8q, UNSPEC_BSL, QUIET)
#undef REQUIRED_EXTENSIONS
// combine
-#define REQUIRED_EXTENSIONS nonstreaming_only (NONE)
+#define REQUIRED_EXTENSIONS nonstreaming_only (0)
ENTRY_BINARY (vcombine_mf8, mf8q, mf8, mf8, UNSPEC_COMBINE, QUIET)
#undef REQUIRED_EXTENSIONS
diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index 0d9e50b..beceafe 100644
--- a/gcc/cp/module.cc
+++ b/gcc/cp/module.cc
@@ -5757,7 +5757,7 @@ trees_out::core_bools (tree t, bits_out& bits)
WB (t->function_decl.replaceable_operator);
/* decl_type is a (misnamed) 2 bit discriminator. */
- unsigned kind = t->function_decl.decl_type;
+ unsigned kind = (unsigned)t->function_decl.decl_type;
WB ((kind >> 0) & 1);
WB ((kind >> 1) & 1);
}
diff --git a/gcc/lto-streamer-out.cc b/gcc/lto-streamer-out.cc
index 96eb79b..d5b6ee7 100644
--- a/gcc/lto-streamer-out.cc
+++ b/gcc/lto-streamer-out.cc
@@ -1333,7 +1333,7 @@ hash_tree (struct streamer_tree_cache_d *cache, hash_map<tree, hashval_t> *map,
hstate.add_int (DECL_BUILT_IN_CLASS (t));
hstate.add_flag (DECL_STATIC_CONSTRUCTOR (t));
hstate.add_flag (DECL_STATIC_DESTRUCTOR (t));
- hstate.add_flag (FUNCTION_DECL_DECL_TYPE (t));
+ hstate.add_int ((unsigned)FUNCTION_DECL_DECL_TYPE (t));
hstate.add_flag (DECL_UNINLINABLE (t));
hstate.add_flag (DECL_POSSIBLY_INLINED (t));
hstate.add_flag (DECL_IS_NOVOPS (t));
diff --git a/gcc/tree-core.h b/gcc/tree-core.h
index 6e76d2b..bd19c99 100644
--- a/gcc/tree-core.h
+++ b/gcc/tree-core.h
@@ -2023,7 +2023,7 @@ struct GTY(()) tree_decl_non_common {
/* Classify a special function declaration type. */
-enum function_decl_type
+enum class function_decl_type : unsigned
{
NONE,
OPERATOR_NEW,
diff --git a/gcc/tree-streamer-out.cc b/gcc/tree-streamer-out.cc
index 0b61422..3422725 100644
--- a/gcc/tree-streamer-out.cc
+++ b/gcc/tree-streamer-out.cc
@@ -306,7 +306,7 @@ pack_ts_function_decl_value_fields (struct bitpack_d *bp, tree expr)
bp_pack_value (bp, DECL_IS_NOVOPS (expr), 1);
bp_pack_value (bp, DECL_IS_RETURNS_TWICE (expr), 1);
bp_pack_value (bp, DECL_IS_MALLOC (expr), 1);
- bp_pack_value (bp, FUNCTION_DECL_DECL_TYPE (expr), 2);
+ bp_pack_value (bp, (unsigned)FUNCTION_DECL_DECL_TYPE (expr), 2);
bp_pack_value (bp, DECL_IS_OPERATOR_DELETE_P (expr), 1);
bp_pack_value (bp, DECL_DECLARED_INLINE_P (expr), 1);
bp_pack_value (bp, DECL_STATIC_CHAIN (expr), 1);
diff --git a/gcc/tree.h b/gcc/tree.h
index 6f45359..55f97f9 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -3424,12 +3424,12 @@ set_function_decl_type (tree decl, function_decl_type t, bool set)
{
if (set)
{
- gcc_assert (FUNCTION_DECL_DECL_TYPE (decl) == NONE
+ gcc_assert (FUNCTION_DECL_DECL_TYPE (decl) == function_decl_type::NONE
|| FUNCTION_DECL_DECL_TYPE (decl) == t);
FUNCTION_DECL_DECL_TYPE (decl) = t;
}
else if (FUNCTION_DECL_DECL_TYPE (decl) == t)
- FUNCTION_DECL_DECL_TYPE (decl) = NONE;
+ FUNCTION_DECL_DECL_TYPE (decl) = function_decl_type::NONE;
}
/* Nonzero in a FUNCTION_DECL means this function is a replaceable
@@ -3441,21 +3441,25 @@ set_function_decl_type (tree decl, function_decl_type t, bool set)
C++ operator new, meaning that it returns a pointer for which we
should not use type based aliasing. */
#define DECL_IS_OPERATOR_NEW_P(NODE) \
- (FUNCTION_DECL_DECL_TYPE (FUNCTION_DECL_CHECK (NODE)) == OPERATOR_NEW)
+ (FUNCTION_DECL_DECL_TYPE (FUNCTION_DECL_CHECK (NODE)) \
+ == function_decl_type::OPERATOR_NEW)
#define DECL_IS_REPLACEABLE_OPERATOR_NEW_P(NODE) \
(DECL_IS_OPERATOR_NEW_P (NODE) && DECL_IS_REPLACEABLE_OPERATOR (NODE))
#define DECL_SET_IS_OPERATOR_NEW(NODE, VAL) \
- set_function_decl_type (FUNCTION_DECL_CHECK (NODE), OPERATOR_NEW, VAL)
+ set_function_decl_type (FUNCTION_DECL_CHECK (NODE), \
+ function_decl_type::OPERATOR_NEW, VAL)
/* Nonzero in a FUNCTION_DECL means this function should be treated as
C++ operator delete. */
#define DECL_IS_OPERATOR_DELETE_P(NODE) \
- (FUNCTION_DECL_DECL_TYPE (FUNCTION_DECL_CHECK (NODE)) == OPERATOR_DELETE)
+ (FUNCTION_DECL_DECL_TYPE (FUNCTION_DECL_CHECK (NODE)) \
+ == function_decl_type::OPERATOR_DELETE)
#define DECL_SET_IS_OPERATOR_DELETE(NODE, VAL) \
- set_function_decl_type (FUNCTION_DECL_CHECK (NODE), OPERATOR_DELETE, VAL)
+ set_function_decl_type (FUNCTION_DECL_CHECK (NODE), \
+ function_decl_type::OPERATOR_DELETE, VAL)
/* Nonzero in a FUNCTION_DECL means this function may return more
than once. */
@@ -3603,10 +3607,12 @@ extern vec<tree, va_gc> **decl_debug_args_insert (tree);
/* In FUNCTION_DECL, this is set if this function is a lambda function. */
#define DECL_LAMBDA_FUNCTION_P(NODE) \
- (FUNCTION_DECL_DECL_TYPE (FUNCTION_DECL_CHECK (NODE)) == LAMBDA_FUNCTION)
+ (FUNCTION_DECL_DECL_TYPE (FUNCTION_DECL_CHECK (NODE)) \
+ == function_decl_type::LAMBDA_FUNCTION)
#define DECL_SET_LAMBDA_FUNCTION(NODE, VAL) \
- set_function_decl_type (FUNCTION_DECL_CHECK (NODE), LAMBDA_FUNCTION, VAL)
+ set_function_decl_type (FUNCTION_DECL_CHECK (NODE), \
+ function_decl_type::LAMBDA_FUNCTION, VAL)
/* In FUNCTION_DECL that represent an virtual method this is set when
the method is final. */