[PATCH] Replace CONST_CAST with const_cast<>.

From: Ingo Saitz

Date: Sat Mar 14 2026 - 09:24:56 EST


For gcc-16, this was removed in gcc trunk

see commits
c3d96ff9e916c02584aa081f03ab999292efbb50
458c7926d48959abcb2c1adaa22458e27459a551
---
scripts/gcc-plugins/gcc-common.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/gcc-plugins/gcc-common.h b/scripts/gcc-plugins/gcc-common.h
index 8f1b3500f8e2..7b3517b31e0a 100644
--- a/scripts/gcc-plugins/gcc-common.h
+++ b/scripts/gcc-plugins/gcc-common.h
@@ -309,7 +309,7 @@ typedef const gimple *const_gimple_ptr;
#define gimple gimple_ptr
#define const_gimple const_gimple_ptr
#undef CONST_CAST_GIMPLE
-#define CONST_CAST_GIMPLE(X) CONST_CAST(gimple, (X))
+#define CONST_CAST_GIMPLE(X) const_cast<gimple>((X))

/* gimple related */
static inline gimple gimple_build_assign_with_ops(enum tree_code subcode, tree lhs, tree op1, tree op2 MEM_STAT_DECL)
@@ -414,7 +414,7 @@ static inline void ipa_remove_stmt_references(symtab_node *referring_node, gimpl
#ifdef __cplusplus
static inline void debug_tree(const_tree t)
{
- debug_tree(CONST_CAST_TREE(t));
+ debug_tree(const_cast<tree>(t));
}

static inline void debug_gimple_stmt(const_gimple s)
@@ -422,7 +422,7 @@ static inline void debug_gimple_stmt(const_gimple s)
debug_gimple_stmt(CONST_CAST_GIMPLE(s));
}
#else
-#define debug_tree(t) debug_tree(CONST_CAST_TREE(t))
+#define debug_tree(t) debug_tree(const_cast<tree>(t))
#define debug_gimple_stmt(s) debug_gimple_stmt(CONST_CAST_GIMPLE(s))
#endif

--
2.53.0


--N5ytkd1BYnbboSHN--