From 5c25e11dca2662765e675cc94da7f7929518fb8a Mon Sep 17 00:00:00 2001 From: Phil Edwards Date: Tue, 2 Jan 2001 02:56:01 +0000 Subject: [PATCH] extend.texi (C++ Extensions): New node for C++ attributes; describe init_priority and com_interface. 2000-12-27 Phil Edwards * 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. From-SVN: r38610 --- gcc/ChangeLog | 8 +++++++ gcc/extend.texi | 56 ++++++++++++++++++++++++++++++++++++++++++++++-- gcc/install.texi | 4 ++-- gcc/invoke.texi | 9 ++------ gcc/md.texi | 6 +++--- 5 files changed, 69 insertions(+), 14 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 04c810fa7ff..fa326306246 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2000-12-27 Phil Edwards + + * 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. + Mon Jan 1 21:28:29 2001 Richard Kenner * config.gcc (sparc64-wrs-vxworks*): New case. 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 + diff --git a/gcc/install.texi b/gcc/install.texi index 1dbdd3dd2f2..88ff711460a 100644 --- a/gcc/install.texi +++ b/gcc/install.texi @@ -1,4 +1,4 @@ -@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. @c This is part of the GCC manual. @c For copying conditions, see the file gcc.texi. @@ -942,7 +942,7 @@ AMD Am29050 used in a system running a variant of BSD Unix. @item avr ATMEL AVR-family micro controllers. These are used in embedded applications. There are no standard Unix configurations. -See @xref{AVR Options} for the list of supported MCU types. +@xref{AVR Options}, for the list of supported MCU types. @item decstation-* MIPS-based DECstations can support three different personalities: diff --git a/gcc/invoke.texi b/gcc/invoke.texi index c5559581c12..d4e79d21fe4 100644 --- a/gcc/invoke.texi +++ b/gcc/invoke.texi @@ -1,4 +1,4 @@ -@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. @c This is part of the GCC manual. @c For copying conditions, see the file gcc.texi. @@ -161,7 +161,7 @@ in the following sections. -falt-external-templates -ffor-scope -fno-for-scope -fno-gnu-keywords -fhonor-std -fhuge-objects -fno-implicit-templates --fno-implicit-inline-templates -finit-priority +-fno-implicit-inline-templates -fno-implement-inlines -fms-extensions -fname-mangling-version-@var{n} -fno-operator-names -fno-optional-diags -fpermissive @@ -1264,11 +1264,6 @@ Don't emit code for implicit instantiations of inline templates, either. The default is to handle inlines differently so that compiles with and without optimization will need the same set of explicit instantiations. -@item -finit-priority -Support @samp{__attribute__ ((init_priority (n)))} for controlling the -order of initialization of file-scope objects. On ELF targets, this -requires GNU ld 2.10 or later. - @item -fno-implement-inlines To save space, do not emit out-of-line copies of inline functions controlled by @samp{#pragma implementation}. This will cause linker diff --git a/gcc/md.texi b/gcc/md.texi index 27b57dc7782..1702a0e724a 100644 --- a/gcc/md.texi +++ b/gcc/md.texi @@ -1,4 +1,4 @@ -@c Copyright (C) 1988, 89, 92, 93, 94, 96, 1998, 2000 Free Software Foundation, Inc. +@c Copyright (C) 1988, 89, 92, 93, 94, 96, 1998, 2000, 2001 Free Software Foundation, Inc. @c This is part of the GCC manual. @c For copying conditions, see the file gcc.texi. @@ -2604,7 +2604,7 @@ that the jump optimizer will not delete the table as unreachable code. Conditional branch instruction that decrements a register and jumps if the register is non-zero. Operand 0 is the register to decrement and test; operand 1 is the label to jump to if the -register is non-zero. @xref{Looping Patterns} +register is non-zero. @xref{Looping Patterns}. This optional instruction pattern is only used by the combiner, typically for loops reversed by the loop optimizer when strength @@ -2620,7 +2620,7 @@ determined until run-time; operand 2 is the actual or estimated maximum number of iterations as a @code{const_int}; operand 3 is the number of enclosed loops as a @code{const_int} (an innermost loop has a value of 1); operand 4 is the label to jump to if the register is non-zero. -@xref{Looping Patterns} +@xref{Looping Patterns}. This optional instruction pattern should be defined for machines with low-overhead looping instructions as the loop optimizer will try to