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: [Patch, Fortran, OOP] PR 46313: OOP-ABI issue, ALLOCATE issue, CLASS renaming issue


>>>>>> Yes, that is expected, because the patch changes the name of the vtab
>>>>>> to "vtab$main$dt", so one needs to change the name of the subroutine
>>>>>> in the test case in the same way in order to see the failure:
>>>
>>> Sorry I'm late, but gcc has the macro ASM_FORMAT_PRIVATE_NAME which does
>>> the work of making a name collision-free. If you use it you can make the
>>> rest of the name as readable as you want.
>>
>> I think that it won't work. One needs the same assembler name for in
>> each translation unit as there is one, common, global vtable per base
>> type. My understanding is that ASM_FORMAT_PRIVATE_NAME would generate
>> several disjunct assembler names...
>
> I don't think so, it only adds a platform-dependent character to the
> variable name. ?The offered varieties cover exactly what was suggested in
> this thread so far:
>
> #ifndef ASM_PN_FORMAT
> # ifndef NO_DOT_IN_LABEL
> # ?define ASM_PN_FORMAT "%s.%lu"
> # else
> # ?ifndef NO_DOLLAR_IN_LABEL
> # ? define ASM_PN_FORMAT "%s$%lu"
> # ?else
> # ? define ASM_PN_FORMAT "__%s_%lu"
> # ?endif
> # endif
> #endif /* ! ASM_PN_FORMAT */
>
> #ifndef ASM_FORMAT_PRIVATE_NAME
> # define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
> ?do { const char *const name_ = (NAME); \
> ? ? ? char *const output_ = (OUTPUT) = \
> ? ? ? ? (char *) alloca (strlen (name_) + 32); \
> ? ? ? sprintf (output_, ASM_PN_FORMAT, name_, (unsigned long)(LABELNO)); \
> ?} while (0)
> #endif

Yes, I think it would do the job. But we actually do not need the
additional number.

Btw, what is the reason for the macro adding *two* underscores in
front, instead of just one?

Cheers,
Janus


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