This is the mail archive of the gcc-patches@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]

Re: Implement pragma redefine_extname


> All I wanted to indicate was that we already have infrastructure for a
> very similar feature, and if possible it should be reused instead of adding
> a whole new mechanism.

I see. I have tried to make the existing mechanism work, which goes
like this:
- wheen parsing a declaration is completed, create a decl, and
- if it has an asm label, then
- set the decl-assembler-name of the decl

Unfortunately, for the #pragma redefine_extname, the same mechanism
won't work: the pragma appears before the declaration. So when the
compiler sees the pragma, there is no declaration to attach the
assembler name to. Instead, my implementation remembers the external
name, and puts it into the decl when the decl is seen (actually, when
somebody accesses the decl's assembler name).

One might think that it could be possible to come up with an "empty"
decl object when the pragma is parsed. I could not make this work: It
isn't even certain that the decl is a function decl, let alone knowing
what its type is.

If you can think of an alternative algorithm that operates without any
additional data structures, please let me know.

Regards,
Martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]