This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
How to walk a const_tree?
- From: Georg-Johann Lay <avr at gjlay dot de>
- To: gcc at gcc dot gnu dot org
- Date: Fri, 08 Jun 2012 13:30:54 +0200
- Subject: How to walk a const_tree?
When calling walk_tree in a hook that gets a node passed
as const_tree, the const qualifier must be kicked off
somehow in order to get get of build warning.
Currently I have the following hook implementation for
TARGET_ASM_DECLARE_CONSTANT_NAME:
static void
avr_asm_declare_constant_name (FILE *file, const char *name,
const_tree expr, HOST_WIDE_INT size)
{
/* FIXME: Is there a way to get rid of the const without using
inside knowledge of tree resp. const_tree? */
tree node = CONST_CAST (union tree_node*, expr);
walk_tree_without_duplicates (&node, avr_walk_initializer_r, NULL);
default_asm_declare_constant_name (file, name, expr, size);
}
Is there a better way without using the insides of a tree?
Thanks