OSDN Git Service

libunwind related patch from David Mosberger
[pf3gnuchains/gcc-fork.git] / gcc / doc / extend.texi
index d2f417d..4afe784 100644 (file)
@@ -884,6 +884,11 @@ and later return that value, without knowing what data type
 the function tried to return (as long as your caller expects
 that data type).
 
+However, these built-in functions may interact badly with some
+sophisticated features or other extensions of the language.  It
+is, therefore, not recommended to use them outside very simple
+functions acting as mere forwarders for their arguments.
+
 @deftypefn {Built-in Function} {void *} __builtin_apply_args ()
 This built-in function returns a pointer to data
 describing how to perform a call with the same arguments as were passed
@@ -1069,7 +1074,8 @@ This will work with all versions of GCC@.
 
 Compound expressions, conditional expressions and casts are allowed as
 lvalues provided their operands are lvalues.  This means that you can take
-their addresses or store values into them.
+their addresses or store values into them.  All these extensions are
+deprecated.
 
 Standard C++ allows compound expressions and conditional expressions
 as lvalues, and permits casts to reference type, so use of this
@@ -1101,7 +1107,8 @@ expressions are equivalent:
 (a ? b = 5 : (c = 5))
 @end example
 
-A cast is a valid lvalue if its operand is an lvalue.  A simple
+A cast is a valid lvalue if its operand is an lvalue.  This extension
+is deprecated.  A simple
 assignment whose left-hand side is a cast works by converting the
 right-hand side first to the specified type, then to the type of the
 inner left-hand side expression.  After this is stored, the value is
@@ -2020,6 +2027,10 @@ would happen if @code{fatal} ever did return.  This makes slightly
 better code.  More importantly, it helps avoid spurious warnings of
 uninitialized variables.
 
+The @code{noreturn} keyword does not affect the exceptional path when that
+applies: a @code{noreturn}-marked function may still return to the caller
+by throwing an exception.
+
 Do not assume that registers saved by the calling function are
 restored before calling the @code{noreturn} function.
 
@@ -2472,11 +2483,11 @@ instruction directly.
 
 @item function_vector
 @cindex calling functions through the function vector on the H8/300 processors
-Use this attribute on the H8/300 and H8/300H to indicate that the specified
+Use this attribute on the H8/300, H8/300H, and H8S to indicate that the specified
 function should be called through the function vector.  Calling a
 function through the function vector will reduce code size, however;
 the function vector has a limited size (maximum 128 entries on the H8/300
-and 64 entries on the H8/300H) and shares space with the interrupt vector.
+and 64 entries on the H8/300H and H8S) and shares space with the interrupt vector.
 
 You must use GAS and GLD from GNU binutils version 2.7 or later for
 this attribute to work correctly.
@@ -2488,8 +2499,8 @@ that the specified function is an interrupt handler.  The compiler will
 generate function entry and exit sequences suitable for use in an
 interrupt handler when this attribute is present.
 
-Note, interrupt handlers for the H8/300, H8/300H and SH processors can
-be specified via the @code{interrupt_handler} attribute.
+Note, interrupt handlers for the m68k, H8/300, H8/300H, H8S, and SH processors
+can be specified via the @code{interrupt_handler} attribute.
 
 Note, on the AVR, interrupts will be enabled inside the function.
 
@@ -2503,9 +2514,9 @@ void f () __attribute__ ((interrupt ("IRQ")));
 Permissible values for this parameter are: IRQ, FIQ, SWI, ABORT and UNDEF@.
 
 @item interrupt_handler
-@cindex interrupt handler functions on the H8/300 and SH processors
-Use this attribute on the H8/300, H8/300H and SH to indicate that the
-specified function is an interrupt handler.  The compiler will generate
+@cindex interrupt handler functions on the m68k, H8/300 and SH processors
+Use this attribute on the m68k, H8/300, H8/300H, H8S, and SH to indicate that
+the specified function is an interrupt handler.  The compiler will generate
 function entry and exit sequences suitable for use in an interrupt
 handler when this attribute is present.
 
@@ -2522,13 +2533,13 @@ void f () __attribute__ ((interrupt_handler,
 @end smallexample
 
 @item trap_exit
-Use this attribute on the SH for an @code{interrupt_handle} to return using
+Use this attribute on the SH for an @code{interrupt_handler} to return using
 @code{trapa} instead of @code{rte}.  This attribute expects an integer
 argument specifying the trap number to be used.
 
 @item eightbit_data
-@cindex eight bit data on the H8/300 and H8/300H
-Use this attribute on the H8/300 and H8/300H to indicate that the specified
+@cindex eight bit data on the H8/300, H8/300H, and H8S
+Use this attribute on the H8/300, H8/300H, and H8S to indicate that the specified
 variable should be placed into the eight bit data section.
 The compiler will generate more efficient code for certain operations
 on data in the eight bit data area.  Note the eight bit data area is limited to
@@ -2538,13 +2549,19 @@ You must use GAS and GLD from GNU binutils version 2.7 or later for
 this attribute to work correctly.
 
 @item tiny_data
-@cindex tiny data section on the H8/300H
-Use this attribute on the H8/300H to indicate that the specified
+@cindex tiny data section on the H8/300H and H8S
+Use this attribute on the H8/300H and H8S to indicate that the specified
 variable should be placed into the tiny data section.
 The compiler will generate more efficient code for loads and stores
 on data in the tiny data section.  Note the tiny data area is limited to
 slightly under 32kbytes of data.
 
+@item saveall
+@cindex save all registers on the H8/300, H8/300H, and H8S
+Use this attribute on the H8/300, H8/300H, and H8S to indicate that
+all registers except the stack pointer should be saved in the prologue
+regardless of whether they are used or not.
+
 @item signal
 @cindex signal handler functions on the AVR processors
 Use this attribute on the AVR to indicate that the specified
@@ -2624,7 +2641,7 @@ Currently, the attribute is ignored for inlined functions. If the
 attribute is applied to a symbol @emph{definition}, an error is reported.
 If a symbol previously declared @code{dllimport} is later defined, the
 attribute is ignored in subsequent references, and a warning is emitted.
-The attribute is also overriden by a subsequent declaration as
+The attribute is also overridden by a subsequent declaration as
 @code{dllexport}. 
 
 When applied to C++ classes, the attribute marks non-inlined
@@ -3805,7 +3822,7 @@ the single copy in the library.
 
 Since GCC eventually will implement ISO C99 semantics for
 inline functions, it is best to use @code{static inline} only
-to guarentee compatibility.  (The
+to guarantee compatibility.  (The
 existing semantics will remain available when @option{-std=gnu89} is
 specified, but eventually the default will be @option{-std=gnu99} and
 that will implement the C99 semantics, though it does not do so yet.)
@@ -4710,8 +4727,8 @@ architecture does not allow for this specific SIMD type, gcc will
 produce code that uses 4 @code{SIs}.
 
 The types defined in this manner can be used with a subset of normal C
-operations.  Currently, gcc will allow using the following operators on
-these types: @code{+, -, *, /, unary minus}@.
+operations.  Currently, gcc will allow using the following operators
+on these types: @code{+, -, *, /, unary minus, ^, |, &, ~}@.
 
 The operations behave like C++ @code{valarrays}.  Addition is defined as
 the addition of the corresponding elements of the operands.  For
@@ -4727,9 +4744,10 @@ v4si a, b, c;
 c = a + b;
 @end example
 
-Subtraction, multiplication, and division operate in a similar manner.
-Likewise, the result of using the unary minus operator on a vector type
-is a vector whose elements are the negative value of the corresponding
+Subtraction, multiplication, division, and the logical operations
+operate in a similar manner.  Likewise, the result of using the unary
+minus or complement operators on a vector type is a vector whose
+elements are the negative or complemented values of the corresponding
 elements in the operand.
 
 You can declare variables and use them in function calls and returns, as
@@ -7637,6 +7655,7 @@ Predefined Macros,cpp,The GNU C Preprocessor}).
 * 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.
+* Strong Using::      Strong using-directives for namespace composition.
 * Java Exceptions::     Tweaking exception handling to work with Java.
 * Deprecated Features:: Things will disappear from g++.
 * Backwards Compatibility:: Compatibilities with earlier definitions of C++.
@@ -8237,6 +8256,45 @@ interface table mechanism, instead of regular virtual table dispatch.
 
 @end table
 
+See also @xref{Strong Using}.
+
+@node Strong Using
+@section Strong Using
+
+A using-directive with @code{__attribute ((strong))} is stronger
+than a normal using-directive in two ways:
+
+@itemize @bullet
+@item
+Templates from the used namespace can be specialized as though they were members of the using namespace.
+
+@item
+The using namespace is considered an associated namespace of all
+templates in the used namespace for purposes of argument-dependent
+name lookup.
+@end itemize
+
+This is useful for composing a namespace transparently from
+implementation namespaces.  For example:
+
+@smallexample
+namespace std @{
+  namespace debug @{
+    template <class T> struct A @{ @};
+  @}
+  using namespace debug __attribute ((__strong__));
+  template <> struct A<int> @{ @};   // ok to specialize
+
+  template <class T> void f (A<T>);
+@}
+
+int main()
+@{
+  f (std::A<float>());             // lookup finds std::f
+  f (std::A<int>());
+@}
+@end smallexample
+
 @node Java Exceptions
 @section Java Exceptions