This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Could you mention this in the documentation of DECL_ASSEMBLER_NAME inYes.
c-tree.texi?
Yes, I mean the addresses of the trees. If that makes PCH unhappy, then we use DECL_UID. (Much though I think that wasting a word in every DECL for a UID when the address is *already* a UID is goofy. The EDG front end is a worked example demonstrating that you can use pointers as indices and still make PCH work by swizzling the pointers on the way in. We really should do that; it would allow us to save memory and would make PCH more robust.)To check for whether two declarations are the same, just compare their
addresses.
You mean, the addresses of the trees
Yes -- but that's the user's issue.If a front end creates two FUNCTION_DECLs or VAR_DECLs
that happen to have the same DECL_ASSEMBLER_NAME that's either a bug
or an intentional trick on the part of the front end: by the time
things get to the middle end there should be only one DECL for each
declared entity.
I don't believe that the frontends actually ensure this. For instance,
extern int x; extern int y asm ("x");
will produce two DECLs that refer to the same integer.
The point of Zack's changes was (in part) to eliminate having multiple copies of a FUNCTION_DECL for foo.Likewise, I believe with Zack's c-decl changes, I believe that it always returns the new DECL, which means that in code like:
extern int foo(); int bar(void) { return foo(1); } extern int foo(int); int baz(void) { return foo(2); }
bar will reference one DECL of foo, and baz will reference a different
one. I think there are cases (perhaps even this example) where it'll
do this even without Zack's changes.
-- Mark Mitchell CodeSourcery, LLC (916) 791-8304 mark@codesourcery.com
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |