]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/doc/cpp.texi
Fix minor doc bugs, signalling typo, major version changes rare.
[thirdparty/gcc.git] / gcc / doc / cpp.texi
index 230d32bdfc0ba156497b616e9b35922e858dc681..9f914b2759d3e1dbbebbf92e7bd8dce97804f4d3 100644 (file)
 
 @copying
 @c man begin COPYRIGHT
-Copyright @copyright{} 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996,
-1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-2008, 2009, 2010, 2011
-Free Software Foundation, Inc.
+Copyright @copyright{} 1987-2016 Free Software Foundation, Inc.
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -278,11 +275,11 @@ the character in the source character set that they represent, then
 converted to the execution character set, just like unescaped
 characters.
 
-Unless the experimental @option{-fextended-identifiers} option is used,
-GCC does not permit the use of characters outside the ASCII range, nor
-@samp{\u} and @samp{\U} escapes, in identifiers.  Even with that
-option, characters outside the ASCII range can only be specified with
-the @samp{\u} and @samp{\U} escapes, not used directly in identifiers.
+In identifiers, characters outside the ASCII range can only be
+specified with the @samp{\u} and @samp{\U} escapes, not used
+directly.  If strict ISO C90 conformance is specified with an option
+such as @option{-std=c90}, or @option{-fno-extended-identifiers} is
+used, then those escapes are not permitted in identifiers.
 
 @node Initial processing
 @section Initial processing
@@ -507,10 +504,8 @@ In the 1999 C standard, identifiers may contain letters which are not
 part of the ``basic source character set'', at the implementation's
 discretion (such as accented Latin letters, Greek letters, or Chinese
 ideograms).  This may be done with an extended character set, or the
-@samp{\u} and @samp{\U} escape sequences.  The implementation of this
-feature in GCC is experimental; such characters are only accepted in
-the @samp{\u} and @samp{\U} forms and only if
-@option{-fextended-identifiers} is used.
+@samp{\u} and @samp{\U} escape sequences.  GCC only accepts such
+characters in the @samp{\u} and @samp{\U} forms.
 
 As an extension, GCC treats @samp{$} as a letter.  This is for
 compatibility with some systems, such as VMS, where @samp{$} is commonly
@@ -856,13 +851,14 @@ requested with @code{@w{#include <@var{file}>}} in:
 /usr/include
 @end smallexample
 
-For C++ programs, it will also look in @file{/usr/include/g++-v3},
+For C++ programs, it will also look in
+@file{@var{libdir}/../include/c++/@var{version}},
 first.  In the above, @var{target} is the canonical name of the system
 GCC was configured to compile code for; often but not always the same as
 the canonical name of the system it runs on.  @var{version} is the
 version of GCC in use.
 
-You can add to this list with the @option{-I@var{dir}} command line
+You can add to this list with the @option{-I@var{dir}} command-line
 option.  All the directories named by @option{-I} are searched, in
 left-to-right order, @emph{before} the default directories.  The only
 exception is when @file{dir} is already searched by default.  In
@@ -1151,7 +1147,7 @@ Normally, only the headers found in specific directories are considered
 system headers.  These directories are determined when GCC is compiled.
 There are, however, two ways to make normal headers into system headers.
 
-The @option{-isystem} command line option adds its argument to the list of
+The @option{-isystem} command-line option adds its argument to the list of
 directories to search for headers, just like @option{-I}.  Any headers
 found in that directory will be considered system headers.
 
@@ -1928,11 +1924,14 @@ facilities of the standard C library available.
 This macro is defined when the C++ compiler is in use.  You can use
 @code{__cplusplus} to test whether a header is compiled by a C compiler
 or a C++ compiler.  This macro is similar to @code{__STDC_VERSION__}, in
-that it expands to a version number.  A fully conforming implementation
-of the 1998 C++ standard will define this macro to @code{199711L}.  The
-GNU C++ compiler is not yet fully conforming, so it uses @code{1}
-instead.  It is hoped to complete the implementation of standard C++
-in the near future.
+that it expands to a version number.  Depending on the language standard
+selected, the value of the macro is
+@code{199711L} for the 1998 C++ standard,
+@code{201103L} for the 2011 C++ standard,
+@code{201402L} for the 2014 C++ standard,
+or an unspecified value strictly larger than @code{201402L} for the
+experimental languages enabled by @option{-std=c++1z} and
+@option{-std=gnu++1z}.
 
 @item __OBJC__
 This macro is defined, with value 1, when the Objective-C compiler is in
@@ -1985,7 +1984,7 @@ by GCC, or a non-GCC compiler that claims to accept the GNU C dialects,
 you can simply test @code{__GNUC__}.  If you need to write code
 which depends on a specific version, you must be more careful.  Each
 time the minor version is increased, the patch level is reset to zero;
-each time the major version is increased (which happens rarely), the
+each time the major version is increased, the
 minor version and patch level are reset.  If you wish to use the
 predefined macros directly in the conditional, you will need to write it
 like this:
@@ -2020,8 +2019,8 @@ testing @code{@w{(__GNUC__ && __cplusplus)}}.
 
 @item __STRICT_ANSI__
 GCC defines this macro if and only if the @option{-ansi} switch, or a
-@option{-std} switch specifying strict conformance to some version of ISO C,
-was specified when GCC was invoked.  It is defined to @samp{1}.
+@option{-std} switch specifying strict conformance to some version of ISO C
+or ISO C++, was specified when GCC was invoked.  It is defined to @samp{1}.
 This macro exists primarily to direct GNU libc's header files to
 restrict their definitions to the minimal set found in the 1989 C
 standard.
@@ -2351,6 +2350,18 @@ use.
 This macro is defined, with value 2, when @option{-fstack-protector-all} is
 in use.
 
+@item __SSP_STRONG__
+This macro is defined, with value 3, when @option{-fstack-protector-strong} is
+in use.
+
+@item __SSP_EXPLICIT__
+This macro is defined, with value 4, when @option{-fstack-protector-explicit} is
+in use.
+
+@item __SANITIZE_ADDRESS__
+This macro is defined, with value 1, when @option{-fsanitize=address}
+or @option{-fsanitize=kernel-address} are in use.
+
 @item __TIMESTAMP__
 This macro expands to a string constant that describes the date and time
 of the last modification of the current source file. The string constant
@@ -2371,7 +2382,7 @@ These macros are defined when the target processor supports atomic compare
 and swap operations on operands 1, 2, 4, 8 or 16 bytes in length, respectively.
 
 @item __GCC_HAVE_DWARF2_CFI_ASM
-This macro is defined when the compiler is emitting Dwarf2 CFI directives
+This macro is defined when the compiler is emitting DWARF CFI directives
 to the assembler.  When this is defined, it is possible to emit those same
 directives in inline assembly.
 
@@ -2383,6 +2394,44 @@ These macros are defined with value 1 if the backend supports the
 the include file @file{math.h} can define the macros
 @code{FP_FAST_FMA}, @code{FP_FAST_FMAF}, and @code{FP_FAST_FMAL}
 for compatibility with the 1999 C standard.
+
+@item __GCC_IEC_559
+This macro is defined to indicate the intended level of support for
+IEEE 754 (IEC 60559) floating-point arithmetic.  It expands to a
+nonnegative integer value.  If 0, it indicates that the combination of
+the compiler configuration and the command-line options is not
+intended to support IEEE 754 arithmetic for @code{float} and
+@code{double} as defined in C99 and C11 Annex F (for example, that the
+standard rounding modes and exceptions are not supported, or that
+optimizations are enabled that conflict with IEEE 754 semantics).  If
+1, it indicates that IEEE 754 arithmetic is intended to be supported;
+this does not mean that all relevant language features are supported
+by GCC.  If 2 or more, it additionally indicates support for IEEE
+754-2008 (in particular, that the binary encodings for quiet and
+signaling NaNs are as specified in IEEE 754-2008).
+
+This macro does not indicate the default state of command-line options
+that control optimizations that C99 and C11 permit to be controlled by
+standard pragmas, where those standards do not require a particular
+default state.  It does not indicate whether optimizations respect
+signaling NaN semantics (the macro for that is
+@code{__SUPPORT_SNAN__}).  It does not indicate support for decimal
+floating point or the IEEE 754 binary16 and binary128 types.
+
+@item __GCC_IEC_559_COMPLEX
+This macro is defined to indicate the intended level of support for
+IEEE 754 (IEC 60559) floating-point arithmetic for complex numbers, as
+defined in C99 and C11 Annex G.  It expands to a nonnegative integer
+value.  If 0, it indicates that the combination of the compiler
+configuration and the command-line options is not intended to support
+Annex G requirements (for example, because @option{-fcx-limited-range}
+was used).  If 1 or more, it indicates that it is intended to support
+those requirements; this does not mean that all relevant language
+features are supported by GCC.
+
+@item __NO_MATH_ERRNO__
+This macro is defined if @option{-fno-math-errno} is used, or enabled
+by another option such as @option{-ffast-math} or by default.
 @end table
 
 @node System-specific Predefined Macros
@@ -2397,7 +2446,7 @@ type of system and machine is in use.  They are obviously different on
 each target supported by GCC@.  This manual, being for all systems and
 machines, cannot tell you what their names are, but you can use
 @command{cpp -dM} to see them all.  @xref{Invocation}.  All system-specific
-predefined macros expand to the constant 1, so you can test them with
+predefined macros expand to a constant value, so you can test them with
 either @samp{#ifdef} or @samp{#if}.
 
 The C standard requires that all system-specific macros be part of the
@@ -3171,11 +3220,11 @@ using a system feature on a machine where it is not implemented.
 
 @item
 Macros can be defined or undefined with the @option{-D} and @option{-U}
-command line options when you compile the program.  You can arrange to
+command-line options when you compile the program.  You can arrange to
 compile the same source file into two different programs by choosing a
 macro name to specify which program you want, writing conditionals to
 test whether or how this macro is defined, and then controlling the
-state of the macro with command line options, perhaps set in the
+state of the macro with command-line options, perhaps set in the
 Makefile.  @xref{Invocation}.
 
 @item
@@ -3420,8 +3469,8 @@ the installation in a consistent way, you can use conditionals to detect
 an inconsistency and report it with @samp{#error}.  For example,
 
 @smallexample
-#if !defined(UNALIGNED_INT_ASM_OP) && defined(DWARF2_DEBUGGING_INFO)
-#error "DWARF2_DEBUGGING_INFO requires UNALIGNED_INT_ASM_OP."
+#if !defined(FOO) && defined(BAR)
+#error "BAR requires FOO."
 #endif
 @end smallexample
 
@@ -3634,6 +3683,15 @@ This pragma takes no arguments.  It causes the rest of the code in the
 current file to be treated as if it came from a system header.
 @xref{System Headers}.
 
+@item #pragma GCC warning
+@itemx #pragma GCC error
+@code{#pragma GCC warning "message"} causes the preprocessor to issue
+a warning diagnostic with the text @samp{message}.  The message
+contained in the pragma must be a single string literal.  Similarly,
+@code{#pragma GCC error "message"} issues an error message.  Unlike
+the @samp{#warning} and @samp{#error} directives, these pragmas can be
+embedded in preprocessor macros using @samp{_Pragma}.
+
 @end ftable
 
 @node Other Directives
@@ -3849,7 +3907,7 @@ produce a single token.
 
 Normally comments are removed from the replacement text after the
 macro is expanded, but if the @option{-CC} option is passed on the
-command line comments are preserved.  (In fact, the current
+command-line comments are preserved.  (In fact, the current
 implementation removes comments even before saving the macro
 replacement text, but it careful to do it in such a way that the
 observed effect is identical even in the function-like macro case.)
@@ -4051,9 +4109,7 @@ be controlled using the @option{-fexec-charset} and
 The C and C++ standards allow identifiers to be composed of @samp{_}
 and the alphanumeric characters.  C++ and C99 also allow universal
 character names, and C99 further permits implementation-defined
-characters.  GCC currently only permits universal character names if
-@option{-fextended-identifiers} is used, because the implementation of
-universal character names in identifiers is experimental.
+characters.
 
 GCC allows the @samp{$} character in identifiers as an extension for
 most targets.  This is true regardless of the @option{std=} switch,
@@ -4272,7 +4328,7 @@ leaving out the answer:
 In either form, if no such assertion has been made, @samp{#unassert} has
 no effect.
 
-You can also make or cancel assertions using command line options.
+You can also make or cancel assertions using command-line options.
 @xref{Invocation}.
 
 @node Differences from previous versions
@@ -4380,7 +4436,7 @@ file.
 @emph{Note:} Whether you use the preprocessor by way of @command{gcc}
 or @command{cpp}, the @dfn{compiler driver} is run first.  This
 program's purpose is to translate your command into invocations of the
-programs that do the actual work.  Their command line interfaces are
+programs that do the actual work.  Their command-line interfaces are
 similar but not identical to the documented interface, and may change
 without notice.
 
@@ -4460,7 +4516,7 @@ configuration of GCC@.
 @node Option Index
 @unnumbered Option Index
 @noindent
-CPP's command line options and environment variables are indexed here
+CPP's command-line options and environment variables are indexed here
 without any initial @samp{-} or @samp{--}.
 @printindex op