aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc/extend.texi
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/doc/extend.texi')
-rw-r--r--gcc/doc/extend.texi423
1 files changed, 269 insertions, 154 deletions
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 9a0f04cb0af..f65690429df 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -1,4 +1,5 @@
-@c Copyright (C) 1988,1989,1992,1993,1994,1996,1998,1999,2000,2001,2002 Free Software Foundation, Inc.
+@c Copyright (C) 1988,1989,1992,1993,1994,1996,1998,1999,2000,2001,2002, 2003
+@c Free Software Foundation, Inc.
@c This is part of the GCC manual.
@c For copying conditions, see the file gcc.texi.
@@ -435,9 +436,9 @@ extensions, accepted by GCC in C89 mode and in C++.
* Hex Floats:: Hexadecimal floating-point constants.
* Zero Length:: Zero-length arrays.
* Variable Length:: Arrays whose length is computed at run time.
+* Empty Structures:: Structures with no members.
* Variadic Macros:: Macros with a variable number of arguments.
* Escaped Newlines:: Slightly looser rules for escaped newlines.
-* Multi-line Strings:: String literals with embedded newlines.
* Subscripting:: Any array can be subscripted, even if not an lvalue.
* Pointer Arith:: Arithmetic on @code{void}-pointers and function pointers.
* Initializers:: Non-constant initializers.
@@ -485,7 +486,6 @@ extensions, accepted by GCC in C89 mode and in C++.
@c the above section title wrapped and causes an underfull hbox.. i
@c changed it from "within" to "in". --mew 4feb93
-
A compound statement enclosed in parentheses may appear as an expression
in GNU C@. This allows you to use loops, switches, and local variables
within an expression.
@@ -886,19 +886,6 @@ the containing function. You should specify, for @var{result}, a value
returned by @code{__builtin_apply}.
@end deftypefn
-@cindex underscores in variables in macros
-@cindex @samp{_} in variables in macros
-@cindex local variables in macros
-@cindex variables, local, in macros
-@cindex macros, local variables in
-
-The reason for using names that start with underscores for the local
-variables is to avoid conflicts with variable names that occur within the
-expressions that are substituted for @code{a} and @code{b}. Eventually we
-hope to design a new form of declaration syntax that allows you to declare
-variables whose scopes start only after their initializers; this will be a
-more reliable way to prevent such conflicts.
-
@node Typeof
@section Referring to a Type with @code{typeof}
@findex typeof
@@ -949,6 +936,19 @@ arithmetic type and evaluates each of its arguments exactly once:
_a > _b ? _a : _b; @})
@end example
+@cindex underscores in variables in macros
+@cindex @samp{_} in variables in macros
+@cindex local variables in macros
+@cindex variables, local, in macros
+@cindex macros, local variables in
+
+The reason for using names that start with underscores for the local
+variables is to avoid conflicts with variable names that occur within the
+expressions that are substituted for @code{a} and @code{b}. Eventually we
+hope to design a new form of declaration syntax that allows you to declare
+variables whose scopes start only after their initializers; this will be a
+more reliable way to prevent such conflicts.
+
@noindent
Some more examples of the use of @code{typeof}:
@@ -1032,6 +1032,7 @@ This will work with all versions of GCC@.
@cindex lvalues, generalized
@cindex extensions, @code{?:}
@cindex @code{?:} extensions
+
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.
@@ -1357,6 +1358,22 @@ struct bar c = @{ @{ 1, @{ @} @} @}; // @r{Valid.}
struct foo d[1] = @{ @{ 1 @{ 2, 3, 4 @} @} @}; // @r{Invalid.}
@end example
+@node Empty Structures
+@section Structures With No Members
+@cindex empty structures
+@cindex zero-size structures
+
+GCC permits a C structure to have no members:
+
+@example
+struct empty @{
+@};
+@end example
+
+The structure will have size zero. In C++, empty structures are part
+of the language. G++ treats empty structures as if they had a single
+member of type @code{char}.
+
@node Variable Length
@section Arrays of Variable Length
@cindex variable-length arrays
@@ -1511,27 +1528,14 @@ argument, these arguments are not macro expanded.
Recently, the preprocessor has relaxed its treatment of escaped
newlines. Previously, the newline had to immediately follow a
-backslash. The current implementation allows whitespace in the form of
-spaces, horizontal and vertical tabs, and form feeds between the
+backslash. The current implementation allows whitespace in the form
+of spaces, horizontal and vertical tabs, and form feeds between the
backslash and the subsequent newline. The preprocessor issues a
warning, but treats it as a valid escaped newline and combines the two
lines to form a single logical line. This works within comments and
-tokens, including multi-line strings, as well as between tokens.
-Comments are @emph{not} treated as whitespace for the purposes of this
-relaxation, since they have not yet been replaced with spaces.
-
-@node Multi-line Strings
-@section String Literals with Embedded Newlines
-@cindex multi-line string literals
-
-As an extension, GNU CPP permits string literals to cross multiple lines
-without escaping the embedded newlines. Each embedded newline is
-replaced with a single @samp{\n} character in the resulting string
-literal, regardless of what form the newline took originally.
-
-CPP currently allows such strings in directives as well (other than the
-@samp{#include} family). This is deprecated and will eventually be
-removed.
+tokens, as well as between tokens. Comments are @emph{not} treated as
+whitespace for the purposes of this relaxation, since they have not
+yet been replaced with spaces.
@node Subscripting
@section Non-Lvalue Arrays May Have Subscripts
@@ -2101,6 +2105,9 @@ functions where the arguments are not available to be checked (such as
@code{vprintf}), specify the third parameter as zero. In this case the
compiler only checks the format string for consistency. For
@code{strftime} formats, the third parameter is required to be zero.
+Since non-static C++ methods have an implicit @code{this} argument, the
+arguments of such methods should be counted from two, not one, when
+giving values for @var{string-index} and @var{first-to-check}.
In the example above, the format string (@code{my_format}) is the second
argument of the function @code{my_print}, and the arguments to check
@@ -2153,7 +2160,9 @@ string argument is not constant; this would generate a warning when
without the attribute.
The parameter @var{string-index} specifies which argument is the format
-string argument (starting from 1).
+string argument (starting from one). Since non-static C++ methods have
+an implicit @code{this} argument, the arguments of such methods should
+be counted from two.
The @code{format-arg} attribute allows you to identify your own
functions which modify format strings, so that GCC can check the
@@ -2283,7 +2292,7 @@ and linker.
@cindex @code{malloc} attribute
The @code{malloc} attribute is used to tell the compiler that a function
may be treated as if it were the malloc function. The compiler assumes
-that calls to malloc result in a pointers that cannot alias anything.
+that calls to malloc result in pointers that cannot alias anything.
This will often improve optimization.
@item alias ("@var{target}")
@@ -2312,12 +2321,12 @@ f () @{ /* @r{Do something.} */; @}
int i __attribute__ ((visibility ("hidden")));
@end smallexample
-See the ELF gABI for complete details, but the short story is
+See the ELF gABI for complete details, but the short story is:
@table @dfn
@item default
Default visibility is the normal case for ELF. This value is
-available for the visibiliy attribute to override other options
+available for the visibility attribute to override other options
that may change the assumed visibility of symbols.
@item hidden
@@ -2335,7 +2344,7 @@ by another module.
Internal visibility is like hidden visibility, but with additional
processor specific semantics. Unless otherwise specified by the psABI,
gcc defines internal visibility to mean that the function is @emph{never}
-called from another module. Note that hidden symbols, while then cannot
+called from another module. Note that hidden symbols, while they cannot
be referenced directly by other modules, can be referenced indirectly via
function pointers. By indicating that a symbol cannot be called from
outside the module, gcc may for instance omit the load of a PIC register
@@ -2344,16 +2353,8 @@ since it is known that the calling function loaded the correct value.
Not all ELF targets support this attribute.
-@item tls_model ("@var{tls_model}")
-@cindex @code{tls_model} attribute
-The @code{tls_model} attribute sets thread-local storage model
-(@pxref{Thread-Local}) of a particular @code{__thread} variable,
-overriding @code{-ftls-model=} command line switch on a per-variable
-basis.
-The @var{tls_model} argument should be one of @code{global-dynamic},
-@code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
-
@item regparm (@var{number})
+@cindex @code{regparm} attribute
@cindex functions that are passed arguments in registers on the 386
On the Intel 386, the @code{regparm} attribute causes the compiler to
pass up to @var{number} integer arguments in registers EAX,
@@ -2361,14 +2362,22 @@ EDX, and ECX instead of on the stack. Functions that take a
variable number of arguments will continue to be passed all of their
arguments on the stack.
+Beware that on some ELF systems this attribute is unsuitable for
+global functions in shared libraries with lazy binding (which is the
+default). Lazy binding will send the first call via resolving code in
+the loader, which might assume EAX, EDX and ECX can be clobbered, as
+per the standard calling conventions. Solaris 8 is affected by this.
+GNU systems with GLIBC 2.1 or higher, and FreeBSD, are believed to be
+safe since the loaders there save all registers. (Lazy binding can be
+disabled with the linker or the loader if desired, to avoid the
+problem.)
+
@item stdcall
@cindex functions that pop the argument stack on the 386
On the Intel 386, the @code{stdcall} attribute causes the compiler to
assume that the called function will pop off the stack space used to
pass arguments, unless it takes a variable number of arguments.
-The PowerPC compiler for Windows NT currently ignores the @code{stdcall}
-attribute.
@item cdecl
@cindex functions that do pop the argument stack on the 386
@@ -2378,9 +2387,6 @@ assume that the calling function will pop off the stack space used to
pass arguments. This is
useful to override the effects of the @option{-mrtd} switch.
-The PowerPC compiler for Windows NT currently ignores the @code{cdecl}
-attribute.
-
@item longcall/shortcall
@cindex functions called via pointer on the RS/6000 and PowerPC
On the RS/6000 and PowerPC, the @code{longcall} attribute causes the
@@ -2390,12 +2396,12 @@ attribute causes the compiler not to do this. These attributes override
both the @option{-mlongcall} switch and the @code{#pragma longcall}
setting.
-@xref{RS/6000 and PowerPC Options}, for more information on when long
-calls are and are not necessary.
+@xref{RS/6000 and PowerPC Options}, for more information on whether long
+calls are necessary.
@item long_call/short_call
@cindex indirect calls on ARM
-This attribute allows to specify how to call a particular function on
+This attribute specifies how a particular function is called on
ARM@. Both attributes override the @option{-mlong-calls} (@pxref{ARM Options})
command line switch and @code{#pragma long_calls} settings. The
@code{long_call} attribute causes the compiler to always call the
@@ -2404,31 +2410,6 @@ contents of that register. The @code{short_call} attribute always places
the offset to the function from the call site into the @samp{BL}
instruction directly.
-@item dllimport
-@cindex functions which are imported from a dll on PowerPC Windows NT
-On the PowerPC running Windows NT, the @code{dllimport} attribute causes
-the compiler to call the function via a global pointer to the function
-pointer that is set up by the Windows NT dll library. The pointer name
-is formed by combining @code{__imp_} and the function name.
-
-@item dllexport
-@cindex functions which are exported from a dll on PowerPC Windows NT
-On the PowerPC running Windows NT, the @code{dllexport} attribute causes
-the compiler to provide a global pointer to the function pointer, so
-that it can be called with the @code{dllimport} attribute. The pointer
-name is formed by combining @code{__imp_} and the function name.
-
-@item exception (@var{except-func} [, @var{except-arg}])
-@cindex functions which specify exception handling on PowerPC Windows NT
-On the PowerPC running Windows NT, the @code{exception} attribute causes
-the compiler to modify the structured exception table entry it emits for
-the declared function. The string or identifier @var{except-func} is
-placed in the third entry of the structured exception table. It
-represents a function, which is called by the exception handling
-mechanism if an exception occurs. If it was specified, the string or
-identifier @var{except-arg} is placed in the fourth entry of the
-structured exception table.
-
@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
@@ -2450,9 +2431,9 @@ 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, on the AVR interrupts will be enabled inside the function.
+Note, on the AVR, interrupts will be enabled inside the function.
-Note, for the ARM you can specify the kind of interrupt to be handled by
+Note, for the ARM, you can specify the kind of interrupt to be handled by
adding an optional parameter to the interrupt attribute like this:
@smallexample
@@ -2507,20 +2488,20 @@ slightly under 32kbytes of data.
@item signal
@cindex signal handler functions on the AVR processors
Use this attribute on the AVR to indicate that the specified
-function is an signal handler. The compiler will generate function
-entry and exit sequences suitable for use in an signal handler when this
-attribute is present. Interrupts will be disabled inside function.
+function is a signal handler. The compiler will generate function
+entry and exit sequences suitable for use in a signal handler when this
+attribute is present. Interrupts will be disabled inside the function.
@item naked
@cindex function without a prologue/epilogue code
Use this attribute on the ARM, AVR and IP2K ports to indicate that the
-specified function do not need prologue/epilogue sequences generated by
+specified function does not need prologue/epilogue sequences generated by
the compiler. It is up to the programmer to provide these sequences.
@item model (@var{model-name})
@cindex function addressability on the M32R/D
Use this attribute on the M32R/D to set the addressability of an object,
-and the code generated for a function.
+and of the code generated for a function.
The identifier @var{model-name} is one of @code{small}, @code{medium},
or @code{large}, representing each of the code models.
@@ -2537,6 +2518,91 @@ compiler will generate @code{seth/add3} instructions to load their addresses),
and may not be reachable with the @code{bl} instruction (the compiler will
generate the much slower @code{seth/add3/jl} instruction sequence).
+@item far
+@cindex functions which handle memory bank switching
+On 68HC11 and 68HC12 the @code{far} attribute causes the compiler to
+use a calling convention that takes care of switching memory banks when
+entering and leaving a function. This calling convention is also the
+default when using the @option{-mlong-calls} option.
+
+On 68HC12 the compiler will use the @code{call} and @code{rtc} instructions
+to call and return from a function.
+
+On 68HC11 the compiler will generate a sequence of instructions
+to invoke a board-specific routine to switch the memory bank and call the
+real function. The board-specific routine simulates a @code{call}.
+At the end of a function, it will jump to a board-specific routine
+instead of using @code{rts}. The board-specific return routine simulates
+the @code{rtc}.
+
+@item near
+@cindex functions which do not handle memory bank switching on 68HC11/68HC12
+On 68HC11 and 68HC12 the @code{near} attribute causes the compiler to
+use the normal calling convention based on @code{jsr} and @code{rts}.
+This attribute can be used to cancel the effect of the @option{-mlong-calls}
+option.
+
+@item dllimport
+@cindex @code{__declspec(dllimport)}
+On Windows targets, the @code{dllimport} attribute causes the compiler
+to reference a function or variable via a global pointer to a pointer
+that is set up by the Windows dll library. The pointer name is formed by
+combining @code{_imp__} and the function or variable name. The attribute
+implies @code{extern} storage.
+
+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
+@code{dllexport}.
+
+When applied to C++ classes, the attribute marks non-inlined
+member functions and static data members as imports. However, the
+attribute is ignored for virtual methods to allow creation of vtables
+using thunks.
+
+On cygwin, mingw and arm-pe targets, @code{__declspec(dllimport)} is
+recognized as a synonym for @code{__attribute__ ((dllimport))} for
+compatibility with other Windows compilers.
+
+The use of the @code{dllimport} attribute on functions is not necessary,
+but provides a small performance benefit by eliminating a thunk in the
+dll. The use of the @code{dllimport} attribute on imported variables was
+required on older versions of GNU ld, but can now be avoided by passing
+the @option{--enable-auto-import} switch to ld. As with functions, using
+the attribute for a variable eliminates a thunk in the dll.
+
+One drawback to using this attribute is that a pointer to a function or
+variable marked as dllimport cannot be used as a constant address. The
+attribute can be disabled for functions by setting the
+@option{-mnop-fun-dllimport} flag.
+
+@item dllexport
+@cindex @code{__declspec(dllexport)}
+On Windows targets the @code{dllexport} attribute causes the compiler to
+provide a global pointer to a pointer in a dll, so that it can be
+referenced with the @code{dllimport} attribute. The pointer name is
+formed by combining @code{_imp__} and the function or variable name.
+
+Currently, the @code{dllexport}attribute is ignored for inlined
+functions, but export can be forced by using the
+@option{-fkeep-inline-functions} flag. The attribute is also ignored for
+undefined symbols.
+
+When applied to C++ classes. the attribute marks defined non-inlined
+member functions and static data members as exports. Static consts
+initialized in-class are not marked unless they are also defined
+out-of-class.
+
+On cygwin, mingw and arm-pe targets, @code{__declspec(dllexport)} is
+recognized as a synonym for @code{__attribute__ ((dllexport))} for
+compatibility with other Windows compilers.
+
+Alternative methods for including the symbol in the dll's export table
+are to use a .def file with an @code{EXPORTS} section or, with GNU ld,
+using the @option{--export-all} linker flag.
+
@end table
You can specify multiple attributes in a declaration by separating them
@@ -2908,7 +2974,7 @@ This is true on many RISC machines. On more traditional machine
designs, @code{__alignof__ (double)} is 4 or even 2.
Some machines never actually require alignment; they allow reference to any
-data type even at an odd addresses. For these machines, @code{__alignof__}
+data type even at an odd address. For these machines, @code{__alignof__}
reports the @emph{recommended} alignment of a type.
If the operand of @code{__alignof__} is an lvalue rather than a type,
@@ -2934,15 +3000,13 @@ It is an error to ask for the alignment of an incomplete type.
The keyword @code{__attribute__} allows you to specify special
attributes of variables or structure fields. This keyword is followed
-by an attribute specification inside double parentheses. Ten
-attributes are currently defined for variables: @code{aligned},
-@code{mode}, @code{nocommon}, @code{packed}, @code{section},
-@code{transparent_union}, @code{unused}, @code{deprecated},
-@code{vector_size}, 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}). Other front ends might define more
-attributes (@pxref{C++ Extensions,,Extensions to the C++ Language}).
+by an attribute specification inside double parentheses. Some
+attributes are currently defined generically for variables.
+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}).
+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
@@ -3010,6 +3074,56 @@ up to a maximum of 8 byte alignment, then specifying @code{aligned(16)}
in an @code{__attribute__} will still only provide you with 8 byte
alignment. See your linker documentation for further information.
+@item cleanup (@var{cleanup_function})
+@cindex @code{cleanup} attribute
+The @code{cleanup} attribute runs a function when the variable goes
+out of scope. This attribute can only be applied to auto function
+scope variables; it may not be applied to parameters or variables
+with static storage duration. The function must take one parameter,
+a pointer to a type compatible with the variable. The return value
+of the function (if any) is ignored.
+
+If @option{-fexceptions} is enabled, then @var{cleanup_function}
+will be run during the stack unwinding that happens during the
+processing of the exception. Note that the @code{cleanup} attribute
+does not allow the exception to be caught, only to perform an action.
+It is undefined what happens if @var{cleanup_function} does not
+return normally.
+
+@item common
+@itemx nocommon
+@cindex @code{common} attribute
+@cindex @code{nocommon} attribute
+@opindex fcommon
+@opindex fno-common
+The @code{common} attribute requests GCC to place a variable in
+``common'' storage. The @code{nocommon} attribute requests the
+opposite -- to allocate space for it directly.
+
+These attributes override the default chosen by the
+@option{-fno-common} and @option{-fcommon} flags respectively.
+
+@item deprecated
+@cindex @code{deprecated} attribute
+The @code{deprecated} attribute results in a warning if the variable
+is used anywhere in the source file. This is useful when identifying
+variables that are expected to be removed in a future version of a
+program. The warning also includes the location of the declaration
+of the deprecated variable, to enable users to easily find further
+information about why the variable is deprecated, or what they should
+do instead. Note that the warning only occurs for uses:
+
+@smallexample
+extern int old_var __attribute__ ((deprecated));
+extern int old_var;
+int new_fn () @{ return old_var; @}
+@end smallexample
+
+results in a warning on line 3 but not line 2.
+
+The @code{deprecated} attribute can also be used for functions and
+types (@pxref{Function Attributes}, @pxref{Type Attributes}.)
+
@item mode (@var{mode})
@cindex @code{mode} attribute
This attribute specifies the data type for the declaration---whichever
@@ -3021,18 +3135,6 @@ indicate the mode corresponding to a one-byte integer, @samp{word} or
@samp{__word__} for the mode of a one-word integer, and @samp{pointer}
or @samp{__pointer__} for the mode used to represent pointers.
-@item nocommon
-@cindex @code{nocommon} attribute
-@opindex fno-common
-This attribute specifies requests GCC not to place a variable
-``common'' but instead to allocate space for it directly. If you
-specify the @option{-fno-common} flag, GCC will do this for all
-variables.
-
-Specifying the @code{nocommon} attribute for a variable provides an
-initialization of zeros. A variable may only be initialized in one
-source file.
-
@item packed
@cindex @code{packed} attribute
The @code{packed} attribute specifies that a variable or structure field
@@ -3101,7 +3203,7 @@ section, consider using the facilities of the linker instead.
@item shared
@cindex @code{shared} variable attribute
-On Windows NT, in addition to putting variable definitions in a named
+On Windows, in addition to putting variable definitions in a named
section, the section can also be shared among all running copies of an
executable or DLL@. For example, this small program defines shared data
by putting it in a named section @code{shared} and marking the section
@@ -3124,7 +3226,18 @@ You may only use the @code{shared} attribute along with @code{section}
attribute with a fully initialized global definition because of the way
linkers work. See @code{section} attribute for more information.
-The @code{shared} attribute is only available on Windows NT@.
+The @code{shared} attribute is only available on Windows@.
+
+@item tls_model ("@var{tls_model}")
+@cindex @code{tls_model} attribute
+The @code{tls_model} attribute sets thread-local storage model
+(@pxref{Thread-Local}) of a particular @code{__thread} variable,
+overriding @code{-ftls-model=} command line switch on a per-variable
+basis.
+The @var{tls_model} argument should be one of @code{global-dynamic},
+@code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
+
+Not all targets support this attribute.
@item transparent_union
This attribute, attached to a function parameter which is a union, means
@@ -3139,26 +3252,6 @@ This attribute, attached to a variable, means that the variable is meant
to be possibly unused. GCC will not produce a warning for this
variable.
-@item deprecated
-The @code{deprecated} attribute results in a warning if the variable
-is used anywhere in the source file. This is useful when identifying
-variables that are expected to be removed in a future version of a
-program. The warning also includes the location of the declaration
-of the deprecated variable, to enable users to easily find further
-information about why the variable is deprecated, or what they should
-do instead. Note that the warnings only occurs for uses:
-
-@smallexample
-extern int old_var __attribute__ ((deprecated));
-extern int old_var;
-int new_fn () @{ return old_var; @}
-@end smallexample
-
-results in a warning on line 3 but not line 2.
-
-The @code{deprecated} attribute can also be used for functions and
-types (@pxref{Function Attributes}, @pxref{Type Attributes}.)
-
@item vector_size (@var{bytes})
This attribute specifies the vector size for the variable, measured in
bytes. For example, the declaration:
@@ -3204,6 +3297,12 @@ Medium and large model objects may live anywhere in the 32-bit address space
(the compiler will generate @code{seth/add3} instructions to load their
addresses).
+@item dllimport
+The @code{dllimport} attribute is described in @xref{Function Attributes}.
+
+@item dlexport
+The @code{dllexport} attribute is described in @xref{Function Attributes}.
+
@end table
To specify multiple attributes, separate them by commas within the
@@ -3324,7 +3423,7 @@ alignment. See your linker documentation for further information.
@item packed
This attribute, attached to an @code{enum}, @code{struct}, or
-@code{union} type definition, specified that the minimum required memory
+@code{union} type definition, specifies that the minimum required memory
be used to represent the type.
@opindex fshort-enums
@@ -3353,7 +3452,7 @@ the referenced type must be respected, just as with normal pointer
conversions.
Second, the argument is passed to the function using the calling
-conventions of first member of the transparent union, not the calling
+conventions of the first member of the transparent union, not the calling
conventions of the union itself. All members of the union must have the
same machine representation; this is necessary for this argument passing
to work properly.
@@ -3565,8 +3664,9 @@ The definition in the header file will cause most calls to the function
to be inlined. If any uses of the function remain, they will refer to
the single copy in the library.
-For future compatibility with when GCC implements ISO C99 semantics for
-inline functions, it is best to use @code{static inline} only. (The
+Since GCC eventually will implement ISO C99 semantics for
+inline functions, it is best to use @code{static inline} only
+to guarentee 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.)
@@ -3638,7 +3738,7 @@ asm ("fsinx %[angle],%[output]"
@noindent
Note that the symbolic operand names have no relation whatsoever to
other C identifiers. You may use any name you like, even those of
-existing C symbols, but must ensure that no two operands within the same
+existing C symbols, but you must ensure that no two operands within the same
assembler construct use the same symbolic name.
Output operand expressions must be lvalues; the compiler can check this.
@@ -4482,7 +4582,7 @@ provided they are of the same size (in fact, you can also cast vectors
to and from other datatypes of the same size).
You cannot operate between vectors of different lengths or different
-signness without a cast.
+signedness without a cast.
A port that supports hardware vector operations, usually provides a set
of built-in functions that can be used to operate on vectors. For
@@ -4550,13 +4650,19 @@ v4si f (v4si a, v4si b, v4si c)
@findex memset
@findex printf
@findex printf_unlocked
+@findex putchar
+@findex puts
@findex rindex
+@findex scanf
@findex sin
@findex sinf
@findex sinl
+@findex snprintf
+@findex sprintf
@findex sqrt
@findex sqrtf
@findex sqrtl
+@findex sscanf
@findex strcat
@findex strchr
@findex strcmp
@@ -4570,6 +4676,11 @@ v4si f (v4si a, v4si b, v4si c)
@findex strrchr
@findex strspn
@findex strstr
+@findex vprintf
+@findex vscanf
+@findex vsnprintf
+@findex vsprintf
+@findex vsscanf
GCC provides a large number of built-in functions other than the ones
mentioned above. Some of these are for internal use in the processing
@@ -4607,7 +4718,8 @@ mode.
The ISO C99 functions @code{conj}, @code{conjf}, @code{conjl},
@code{creal}, @code{crealf}, @code{creall}, @code{cimag}, @code{cimagf},
-@code{cimagl}, @code{llabs} and @code{imaxabs} are handled as built-in
+@code{cimagl}, @code{imaxabs}, @code{llabs}, @code{snprintf},
+@code{vscanf}, @code{vsnprintf} and @code{vsscanf} are handled as built-in
functions except in strict ISO C90 mode. There are also built-in
versions of the ISO C99 functions @code{cosf}, @code{cosl},
@code{expf}, @code{expl}, @code{fabsf}, @code{fabsl},
@@ -4619,10 +4731,13 @@ functions have corresponding versions prefixed with @code{__builtin_}.
The ISO C90 functions @code{abs}, @code{cos}, @code{exp}, @code{fabs},
@code{fprintf}, @code{fputs}, @code{labs}, @code{log},
@code{memcmp}, @code{memcpy},
-@code{memset}, @code{printf}, @code{sin}, @code{sqrt}, @code{strcat},
+@code{memset}, @code{printf}, @code{putchar}, @code{puts}, @code{scanf},
+@code{sin}, @code{snprintf}, @code{sprintf}, @code{sqrt}, @code{sscanf},
+@code{strcat},
@code{strchr}, @code{strcmp}, @code{strcpy}, @code{strcspn},
@code{strlen}, @code{strncat}, @code{strncmp}, @code{strncpy},
-@code{strpbrk}, @code{strrchr}, @code{strspn}, and @code{strstr} are all
+@code{strpbrk}, @code{strrchr}, @code{strspn}, @code{strstr},
+@code{vprintf} and @code{vsprintf} are all
recognized as built-in functions unless @option{-fno-builtin} is
specified (or @option{-fno-builtin-@var{function}} is specified for an
individual function). All of these functions have corresponding
@@ -4864,7 +4979,7 @@ ISO C macro @code{HUGE_VAL}.
Similar to @code{__builtin_huge_val}, except the return type is @code{float}.
@end deftypefn
-@deftypefn {Built-in Function} long double __builtin_huge_vall (void)
+@deftypefn {Built-in Function} {long double} __builtin_huge_vall (void)
Similar to @code{__builtin_huge_val}, except the return
type is @code{long double}.
@end deftypefn
@@ -4879,7 +4994,7 @@ This function is suitable for implementing the ISO C99 macro @code{INFINITY}.
Similar to @code{__builtin_inf}, except the return type is @code{float}.
@end deftypefn
-@deftypefn {Built-in Function} long double __builtin_infl (void)
+@deftypefn {Built-in Function} {long double} __builtin_infl (void)
Similar to @code{__builtin_inf}, except the return
type is @code{long double}.
@end deftypefn
@@ -4888,7 +5003,7 @@ type is @code{long double}.
This is an implementation of the ISO C99 function @code{nan}.
Since ISO C99 defines this function in terms of @code{strtod}, which we
-do not implement, a desription of the parsing is in order. The string
+do not implement, a description of the parsing is in order. The string
is parsed as by @code{strtol}; that is, the base is recognized by
leading @samp{0} or @samp{0x} prefixes. The number parsed is placed
in the significand such that the least significant bit of the number
@@ -4904,7 +5019,7 @@ that it is considered a compile-time constant.
Similar to @code{__builtin_nan}, except the return type is @code{float}.
@end deftypefn
-@deftypefn {Built-in Function} long double __builtin_nanl (const char *str)
+@deftypefn {Built-in Function} {long double} __builtin_nanl (const char *str)
Similar to @code{__builtin_nan}, except the return type is @code{long double}.
@end deftypefn
@@ -4918,7 +5033,7 @@ to be a signaling NaN. The @code{nans} function is proposed by
Similar to @code{__builtin_nans}, except the return type is @code{float}.
@end deftypefn
-@deftypefn {Built-in Function} long double __builtin_nansl (const char *str)
+@deftypefn {Built-in Function} {long double} __builtin_nansl (const char *str)
Similar to @code{__builtin_nans}, except the return type is @code{long double}.
@end deftypefn
@@ -6403,7 +6518,7 @@ declarations.
The following pragmas are available for all architectures running the
Darwin operating system. These are useful for compatibility with other
-MacOS compilers.
+Mac OS compilers.
@table @code
@item mark @var{tokens}@dots{}
@@ -6465,7 +6580,8 @@ 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{__EXTERN_PREFIX} if the pragma is available.
+preprocessor defines @code{__PRAGMA_EXTERN_PREFIX} if the pragma is
+available.
@end table
@node Unnamed Fields
@@ -6638,6 +6754,7 @@ The following are a set of changes to ISO/IEC 14882:1998 (aka C++98)
that document the exact semantics of the language extension.
@itemize @bullet
+@item
@b{[intro.execution]}
New text after paragraph 4
@@ -6682,7 +6799,7 @@ Add after paragraph 4
@quotation
The storage for an object of thread storage duration shall be
-staticly initialized before the first statement of the thread startup
+statically initialized before the first statement of the thread startup
function. An object of thread storage duration shall not require
dynamic initialization.
@end quotation
@@ -6718,7 +6835,7 @@ Add @code{__thread} to the list of specifiers in paragraph 3.
New section before @b{[basic.stc.static]}
@quotation
-The keyword @code{__thread} applied to an non-local object gives the
+The keyword @code{__thread} applied to a non-local object gives the
object thread storage duration.
A local variable or class data member declared both @code{static}
@@ -7167,7 +7284,6 @@ If any calls were not inlined, you will get linker errors.
@node Template Instantiation
@section Where's the Template?
-
@cindex template instantiation
C++ templates are the first language feature to require more
@@ -7286,8 +7402,8 @@ compile it without @option{-fno-implicit-templates} so you get all of the
instances required by your explicit instantiations (but not by any
other files) without having to specify them as well.
-g++ has extended the template instantiation syntax outlined in the
-Working Paper to allow forward declaration of explicit instantiations
+g++ has extended the template instantiation syntax given in the ISO
+standard to allow forward declaration of explicit instantiations
(with @code{extern}), instantiation of the compiler support data for a
template class (i.e.@: the vtable) without instantiating any of its
members (with @code{inline}), and instantiation of only the static data
@@ -7313,7 +7429,6 @@ more discussion of these pragmas.
@node Bound member functions
@section Extracting the function pointer from a bound pointer to member function
-
@cindex pmf
@cindex pointer to member function
@cindex bound pointer to member function