RFC: Stricter semantics for renaming pragmas
Ian Lance Taylor
ian@wasabisystems.com
Wed May 19 16:15:00 GMT 2004
Zack Weinberg <zack@codesourcery.com> writes:
> 1) If any of the three ways of changing DECL_ASSEMBLER_NAME is applied
> to a decl whose DECL_ASSEMBLER_NAME is already set, a warning
> issues and the name does not change. (The warning does not issue
> if it's a redundant operation - only if it's inconsistent.)
Sounds reasonable.
> 2) If #pragma extern_prefix is in effect and a declaration occurs with
> an __asm__ name, __asm__ wins. No warning issues.
Sounds reasonable (and is an exception to case 1 in that no warning is
issued).
> 3) If #pragma extern_prefix is in effect, all pending #pragma
> redefine_extname operations are ignored; a warning does issue.
Sounds reasonable (and is implied by case 1). Since the two #pragmas
exist to support the system header files on two different systems, I
don't think the semantics of using both of them together are very
important.
> 4) The "source name" for #pragma redefine_extname is the DECL_NAME,
> *not* the DECL_ASSEMBLER_NAME. (Current code is inconsistent -
> it's the DECL_NAME if the #pragma occurs after the declaration, the
> DECL_ASSEMBLER_NAME if the #pragma occurs before the declaration.
The #pragma is supposed to appear in the source code before the
declaration. It shouldn't be applied to declarations which appear
before the #pragma. I may misunderstand what you are saying.
Applying to the DECL_NAME sounds right in any case.
> 5) In C++:
>
> 5a) Applying __asm__("name") to a declaration silently makes it extern "C".
Sounds right--that doesn't change the calling convention in any way,
right? It just changes the name.
> 5b) #pragma redefine_extname is ignored, with a warning, if applied to
> a declaration which is not extern "C".
I don't think this is right. I think that this usage of #pragma
redefine_extname ought to be like applying __asm__("name")--it should
change the declaration to effectively be extern "C".
> 5c) #pragma extern_prefix silently applies only to declarations which
> are extern "C".
I don't think this is right either. I think that it should apply to
all external names, or at the very least it should issue a warning.
Ian
More information about the Gcc
mailing list