diff options
Diffstat (limited to 'gcc/doc/extend.texi')
-rw-r--r-- | gcc/doc/extend.texi | 80 |
1 files changed, 51 insertions, 29 deletions
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 204c64b1006..6c8ea7d0754 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -7197,8 +7197,7 @@ for further explanation. * ARM Pragmas:: * RS/6000 and PowerPC Pragmas:: * Darwin Pragmas:: -* Solaris Pragmas:: -* Tru64 Pragmas:: +* Symbol-Renaming Pragmas:: @end menu @node ARM Pragmas @@ -7282,45 +7281,68 @@ that of the @code{unused} attribute, except that this pragma may appear anywhere within the variables' scopes. @end table -@node Solaris Pragmas -@subsection Solaris Pragmas +@node Symbol-Renaming Pragmas +@subsection Symbol-Renaming Pragmas -For compatibility with the SunPRO compiler, the following pragma -is supported. +For compatibility with the Solaris and Tru64 UNIX system headers, GCC +supports two @code{#pragma} directives which change the name used in +assembly for a given declaration. These pragmas are only available on +platforms whose system headers need them. To get this effect on all +platforms supported by GCC, use the asm labels extension (@pxref{Asm +Labels}). @table @code @item redefine_extname @var{oldname} @var{newname} @cindex pragma, redefine_extname -This pragma gives the C function @var{oldname} the assembler label -@var{newname}. The pragma must appear before the function declaration. -This pragma is equivalent to the asm labels extension (@pxref{Asm -Labels}). The preprocessor defines @code{__PRAGMA_REDEFINE_EXTNAME} -if the pragma is available. -@end table - -@node Tru64 Pragmas -@subsection Tru64 Pragmas - -For compatibility with the Compaq C compiler, the following pragma -is supported. +This pragma gives the C function @var{oldname} the assembly symbol +@var{newname}. The preprocessor macro @code{__PRAGMA_REDEFINE_EXTNAME} +will be defined if this pragma is available (currently only on +Solaris). -@table @code @item extern_prefix @var{string} @cindex pragma, extern_prefix -This pragma renames all subsequent function and variable declarations -such that @var{string} is prepended to the name. This effect may be -terminated by using another @code{extern_prefix} pragma with the -empty string. - -This pragma is similar in intent to to the asm labels extension -(@pxref{Asm Labels}) in that the system programmer wants to change -the assembly-level ABI without changing the source-level API. The -preprocessor defines @code{__PRAGMA_EXTERN_PREFIX} if the pragma is -available. +This pragma causes all subsequent external function and variable +declarations to have @var{string} prepended to their assembly symbols. +This effect may be terminated with another @code{extern_prefix} pragma +whose argument is an empty string. The preprocessor macro +@code{__PRAGMA_EXTERN_PREFIX} will be defined if this pragma is +available (currently only on Tru64 UNIX). @end table +These pragmas and the asm labels extension interact in a complicated +manner. Here are some corner cases you may want to be aware of. + +@enumerate +@item Both pragmas silently apply only to declarations with external +linkage. Asm labels do not have this restriction. + +@item In C++, both pragmas silently apply only to declarations with +``C'' linkage. Again, asm labels do not have this restriction. + +@item If any of the three ways of changing the assembly name of a +declaration is applied to a declaration whose assembly name has +already been determined (either by a previous use of one of these +features, or because the compiler needed the assembly name in order to +generate code), and the new name is different, a warning issues and +the name does not change. + +@item The @var{oldname} used by @code{#pragma redefine_extname} is +always the C-language name. + +@item If @code{#pragma extern_prefix} is in effect, and a declaration +occurs with an asm label attached, the prefix is silently ignored for +that declaration. + +@item If @code{#pragma extern_prefix} and @code{#pragma redefine_extname} +apply to the same declaration, whichever triggered first wins, and a +warning issues if they contradict each other. (We would like to have +@code{#pragma redefine_extname} always win, for consistency with asm +labels, but if @code{#pragma extern_prefix} triggers first we have no +way of knowing that that happened.) +@end enumerate + @node Unnamed Fields @section Unnamed struct/union fields within structs/unions. @cindex struct |