RFC: Stricter semantics for renaming pragmas

Mark Mitchell mark@codesourcery.com
Wed May 19 22:27:00 GMT 2004


Zack Weinberg wrote:

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.)
 

Yes.

2) If #pragma extern_prefix is in effect and a declaration occurs with
  an __asm__ name, __asm__ wins.  No warning issues.
 

Yes.

3) If #pragma extern_prefix is in effect, all pending #pragma
  redefine_extname operations are ignored; a warning does issue.
 

Yes.

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.
 

Hmm.  This seems abstractly undesirable.  In C++, using 
DECL_ASSEMBELR_NAME here would allow you to uniquely name functions, of 
course.  But, given that we have the "asm" attribute already, and so 
this is only for compatibilit with other compilers, I'm OK with this.

5) In C++:

5a) Applying __asm__("name") to a declaration silently makes it extern "C".
 

Like Gaby, I don't like this one.  That changes the type of the 
function, although G++ currently isn't pedantic about that.  Using 
__asm__ should just set the mangled name, and do nothing else, IMO.

5b) #pragma redefine_extname is ignored, with a warning, if applied to
   a declaration which is not extern "C".
 

Yes.

5c) #pragma extern_prefix silently applies only to declarations which
   are extern "C".
 

Yes.

--
Mark Mitchell
CodeSourcery, LLC
(916) 791-8304
mark@codesourcery.com



More information about the Gcc mailing list