How to walk a const_tree?

Georg-Johann Lay avr@gjlay.de
Mon Jun 11 09:50:00 GMT 2012


Georg-Johann Lay wrote:
> 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?

Found CONST_CAST_TREE now :-)

> 
> Thanks



More information about the Gcc mailing list