diff options
author | pme <pme@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-01-02 02:56:01 +0000 |
---|---|---|
committer | pme <pme@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-01-02 02:56:01 +0000 |
commit | 2f1d6059b340a1aef38dafa77a53adf0f4d8464a (patch) | |
tree | e1dc9ac1ea55c353e9a2202c16997bf0e6f0ead0 /gcc/extend.texi | |
parent | 81a6a67d558d6dbbfca22077d34634752f72a538 (diff) | |
download | gcc-2f1d6059b340a1aef38dafa77a53adf0f4d8464a.tar.gz |
2000-12-27 Phil Edwards <pme@sources.redhat.com>
* extend.texi (C++ Extensions): New node for C++ attributes;
describe init_priority and com_interface.
* invoke.texi: Remove -finit-priority as it now has zero effect.
* install.texi: Fix xref syntax.
* md.texi: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@38610 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/extend.texi')
-rw-r--r-- | gcc/extend.texi | 56 |
1 files changed, 54 insertions, 2 deletions
diff --git a/gcc/extend.texi b/gcc/extend.texi index 1709980f376..811a423e7db 100644 --- a/gcc/extend.texi +++ b/gcc/extend.texi @@ -1,4 +1,4 @@ -@c Copyright (C) 1988,89,92,93,94,96,98,99,2000 Free Software Foundation, Inc. +@c Copyright (C) 1988,89,92,93,94,96,98,99,2000,01 Free Software Foundation, Inc. @c This is part of the GCC manual. @c For copying conditions, see the file gcc.texi. @@ -2022,7 +2022,8 @@ attributes are currently defined for variables: @code{aligned}, @code{transparent_union}, @code{unused}, and @code{weak}. Some other attributes are defined for variables on particular target systems. Other attributes are available for functions (@pxref{Function Attributes}) and -for types (@pxref{Type Attributes}). +for types (@pxref{Type Attributes}). Other front-ends might define more +attributes (@pxref{C++ Extensions,,Extensions to the C++ Language}). You may also specify attributes with @samp{__} preceding and following each keyword. This allows you to use them in header files without @@ -3550,6 +3551,7 @@ Predefined Macros,cpp.info,The C Preprocessor}). each needed template instantiation is emitted. * Bound member functions:: You can extract a function pointer to the method denoted by a @samp{->*} or @samp{.*} expression. +* C++ Attributes:: Variable, function, and type attributes for C++ only. @end menu @node Min and Max @@ -4059,3 +4061,53 @@ fptr p1 = (fptr)(&A::foo); You must specify @samp{-Wno-pmf-conversions} to use this extension. +@node C++ Attributes +@section C++-Specific Variable, Function, and Type Attributes + +Some attributes only make sense for C++ programs. + +@table @code +@item init_priority (@var{priority}) +@cindex init_priority attribute + + +In Standard C++, objects defined at namespace scope are guaranteed to be +initialized in an order in strict accordance with that of their definitions +@emph{in a given translation unit}. No guarantee is made for initializations +across translation units. However, GNU C++ allows users to control the +order of initialization of objects defined at namespace socpe with the +@code{init_priority} attribute by specifying a relative @var{priority}, +a constant integral expression currently bounded between 101 and 65535 +inclusive. Lower numbers indicate a higher priority. + +In the following example, @code{A} would normally be created before +@code{B}, but the @code{init_priority} attribute has reversed that order: + +@example +Some_Class A __attribute__ ((init_priority (2000))); +Some_Class B __attribute__ ((init_priority (543))); +@end example + +@noindent +Note that the particular values of @var{priority} do not matter; only their +relative ordering. + + +@item com_interface +@cindex com_interface attribute + +@c This is based on: 1) grepping the code, +@c 2) http://gcc.gnu.org/ml/gcc-bugs/1999-08n/msg01212.html +@c 3) http://gcc.gnu.org/ml/gcc-bugs/1999-08n/msg01215.html +@c and 4) a lot of guesswork. You can tell I don't use COM. -pme 21Dec00 + +This type attribute takes no parameters, and marks a class or struct as an +interface for communication via COM; the class will support the COM ABI +rather than the full C++ ABI. Currently this means that RTTI is not possible +with the resulting class heirarchy. The virtual pointer table will be +changed to be COM-compliant. Also, all classes and structs derived from one +marked with this attribute are implicitly marked with the same attribute; +thus, only the base class in a COM hierarchy needs @code{com_interface}. + +@end table + |