Re: global declarations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Philip Herron <redbrain@xxxxxxxxxxx> writes:

> Been asking on irc tonight but i think many might be sensible and
> sleeping. Anyway's this has been bugging me for some time, if i create
> a VAR_DECL such as:
>
> tree test = build_decl( UNKNOWN_LOCATION, VAR_DECL,
> 			  get_identifier("test"),
> 			  integer_type_node);
>
>   TREE_CONSTANT (test) = 1;
>   DECL_ARTIFICIAL (test) = 1;
>   TREE_STATIC (test) = 1;
>   TREE_READONLY (test) = 1;
>   TREE_USED (test) = 1;
>   DECL_INITIAL (test) = build_int_cst(integer_type_node, 1234 );

By setting TREE_CONSTANT and TREE_STATIC, you are marking this decl as a
static const, more or less like a C++ const.  It will only be written
out if something else refers to it.  You probably don't want to set
TREE_CONSTANT.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux