(gcc.info) C Dialect Options

Info Catalog (gcc.info) Invoking G++ (gcc.info) Invoking GCC (gcc.info) C++ Dialect Options
 
 3.4 Options Controlling C Dialect
 =================================
 
 The following options control the dialect of C (or languages derived
 from C, such as C++, Objective-C and Objective-C++) that the compiler
 accepts:
 
 `-ansi'
      In C mode, this is equivalent to `-std=c89'. In C++ mode, it is
      equivalent to `-std=c++98'.
 
      This turns off certain features of GCC that are incompatible with
      ISO C90 (when compiling C code), or of standard C++ (when
      compiling C++ code), such as the `asm' and `typeof' keywords, and
      predefined macros such as `unix' and `vax' that identify the type
      of system you are using.  It also enables the undesirable and
      rarely used ISO trigraph feature.  For the C compiler, it disables
      recognition of C++ style `//' comments as well as the `inline'
      keyword.
 
      The alternate keywords `__asm__', `__extension__', `__inline__'
      and `__typeof__' continue to work despite `-ansi'.  You would not
      want to use them in an ISO C program, of course, but it is useful
      to put them in header files that might be included in compilations
      done with `-ansi'.  Alternate predefined macros such as `__unix__'
      and `__vax__' are also available, with or without `-ansi'.
 
      The `-ansi' option does not cause non-ISO programs to be rejected
      gratuitously.  For that, `-pedantic' is required in addition to
      `-ansi'.   Warning Options.
 
      The macro `__STRICT_ANSI__' is predefined when the `-ansi' option
      is used.  Some header files may notice this macro and refrain from
      declaring certain functions or defining certain macros that the
      ISO standard doesn't call for; this is to avoid interfering with
      any programs that might use these names for other things.
 
      Functions that would normally be built in but do not have semantics
      defined by ISO C (such as `alloca' and `ffs') are not built-in
      functions when `-ansi' is used.   Other built-in functions
      provided by GCC Other Builtins, for details of the functions
      affected.
 
 `-std='
      Determine the language standard.  Language Standards
      Supported by GCC Standards, for details of these standard
      versions.  This option is currently only supported when compiling
      C or C++.
 
      The compiler can accept several base standards, such as `c89' or
      `c++98', and GNU dialects of those standards, such as `gnu89' or
      `gnu++98'.  By specifying a base standard, the compiler will
      accept all programs following that standard and those using GNU
      extensions that do not contradict it.  For example, `-std=c89'
      turns off certain features of GCC that are incompatible with ISO
      C90, such as the `asm' and `typeof' keywords, but not other GNU
      extensions that do not have a meaning in ISO C90, such as omitting
      the middle term of a `?:' expression. On the other hand, by
      specifying a GNU dialect of a standard, all features the compiler
      support are enabled, even when those features change the meaning
      of the base standard and some strict-conforming programs may be
      rejected.  The particular standard is used by `-pedantic' to
      identify which features are GNU extensions given that version of
      the standard. For example `-std=gnu89 -pedantic' would warn about
      C++ style `//' comments, while `-std=gnu99 -pedantic' would not.
 
      A value for this option must be provided; possible values are
 
     `c89'
     `iso9899:1990'
           Support all ISO C90 programs (certain GNU extensions that
           conflict with ISO C90 are disabled). Same as `-ansi' for C
           code.
 
     `iso9899:199409'
           ISO C90 as modified in amendment 1.
 
     `c99'
     `c9x'
     `iso9899:1999'
     `iso9899:199x'
           ISO C99.  Note that this standard is not yet fully supported;
           see `http://gcc.gnu.org/gcc-4.4/c99status.html' for more
           information.  The names `c9x' and `iso9899:199x' are
           deprecated.
 
     `gnu89'
           GNU dialect of ISO C90 (including some C99 features). This is
           the default for C code.
 
     `gnu99'
     `gnu9x'
           GNU dialect of ISO C99.  When ISO C99 is fully implemented in
           GCC, this will become the default.  The name `gnu9x' is
           deprecated.
 
     `c++98'
           The 1998 ISO C++ standard plus amendments. Same as `-ansi' for
           C++ code.
 
     `gnu++98'
           GNU dialect of `-std=c++98'.  This is the default for C++
           code.
 
     `c++0x'
           The working draft of the upcoming ISO C++0x standard. This
           option enables experimental features that are likely to be
           included in C++0x. The working draft is constantly changing,
           and any feature that is enabled by this flag may be removed
           from future versions of GCC if it is not part of the C++0x
           standard.
 
     `gnu++0x'
           GNU dialect of `-std=c++0x'. This option enables experimental
           features that may be removed in future versions of GCC.
 
 `-fgnu89-inline'
      The option `-fgnu89-inline' tells GCC to use the traditional GNU
      semantics for `inline' functions when in C99 mode.   An
      Inline Function is As Fast As a Macro Inline.  This option is
      accepted and ignored by GCC versions 4.1.3 up to but not including
      4.3.  In GCC versions 4.3 and later it changes the behavior of GCC
      in C99 mode.  Using this option is roughly equivalent to adding the
      `gnu_inline' function attribute to all inline functions (
      Function Attributes).
 
      The option `-fno-gnu89-inline' explicitly tells GCC to use the C99
      semantics for `inline' when in C99 or gnu99 mode (i.e., it
      specifies the default behavior).  This option was first supported
      in GCC 4.3.  This option is not supported in C89 or gnu89 mode.
 
      The preprocessor macros `__GNUC_GNU_INLINE__' and
      `__GNUC_STDC_INLINE__' may be used to check which semantics are in
      effect for `inline' functions.   Common Predefined Macros
      (cpp)Common Predefined Macros.
 
 `-aux-info FILENAME'
      Output to the given filename prototyped declarations for all
      functions declared and/or defined in a translation unit, including
      those in header files.  This option is silently ignored in any
      language other than C.
 
      Besides declarations, the file indicates, in comments, the origin
      of each declaration (source file and line), whether the
      declaration was implicit, prototyped or unprototyped (`I', `N' for
      new or `O' for old, respectively, in the first character after the
      line number and the colon), and whether it came from a declaration
      or a definition (`C' or `F', respectively, in the following
      character).  In the case of function definitions, a K&R-style list
      of arguments followed by their declarations is also provided,
      inside comments, after the declaration.
 
 `-fno-asm'
      Do not recognize `asm', `inline' or `typeof' as a keyword, so that
      code can use these words as identifiers.  You can use the keywords
      `__asm__', `__inline__' and `__typeof__' instead.  `-ansi' implies
      `-fno-asm'.
 
      In C++, this switch only affects the `typeof' keyword, since `asm'
      and `inline' are standard keywords.  You may want to use the
      `-fno-gnu-keywords' flag instead, which has the same effect.  In
      C99 mode (`-std=c99' or `-std=gnu99'), this switch only affects
      the `asm' and `typeof' keywords, since `inline' is a standard
      keyword in ISO C99.
 
 `-fno-builtin'
 `-fno-builtin-FUNCTION'
      Don't recognize built-in functions that do not begin with
      `__builtin_' as prefix.   Other built-in functions provided
      by GCC Other Builtins, for details of the functions affected,
      including those which are not built-in functions when `-ansi' or
      `-std' options for strict ISO C conformance are used because they
      do not have an ISO standard meaning.
 
      GCC normally generates special code to handle certain built-in
      functions more efficiently; for instance, calls to `alloca' may
      become single instructions that adjust the stack directly, and
      calls to `memcpy' may become inline copy loops.  The resulting
      code is often both smaller and faster, but since the function
      calls no longer appear as such, you cannot set a breakpoint on
      those calls, nor can you change the behavior of the functions by
      linking with a different library.  In addition, when a function is
      recognized as a built-in function, GCC may use information about
      that function to warn about problems with calls to that function,
      or to generate more efficient code, even if the resulting code
      still contains calls to that function.  For example, warnings are
      given with `-Wformat' for bad calls to `printf', when `printf' is
      built in, and `strlen' is known not to modify global memory.
 
      With the `-fno-builtin-FUNCTION' option only the built-in function
      FUNCTION is disabled.  FUNCTION must not begin with `__builtin_'.
      If a function is named that is not built-in in this version of
      GCC, this option is ignored.  There is no corresponding
      `-fbuiltin-FUNCTION' option; if you wish to enable built-in
      functions selectively when using `-fno-builtin' or
      `-ffreestanding', you may define macros such as:
 
           #define abs(n)          __builtin_abs ((n))
           #define strcpy(d, s)    __builtin_strcpy ((d), (s))
 
 `-fhosted'
      Assert that compilation takes place in a hosted environment.  This
      implies `-fbuiltin'.  A hosted environment is one in which the
      entire standard library is available, and in which `main' has a
      return type of `int'.  Examples are nearly everything except a
      kernel.  This is equivalent to `-fno-freestanding'.
 
 `-ffreestanding'
      Assert that compilation takes place in a freestanding environment.
      This implies `-fno-builtin'.  A freestanding environment is one in
      which the standard library may not exist, and program startup may
      not necessarily be at `main'.  The most obvious example is an OS
      kernel.  This is equivalent to `-fno-hosted'.
 
       Language Standards Supported by GCC Standards, for details
      of freestanding and hosted environments.
 
 `-fopenmp'
      Enable handling of OpenMP directives `#pragma omp' in C/C++ and
      `!$omp' in Fortran.  When `-fopenmp' is specified, the compiler
      generates parallel code according to the OpenMP Application
      Program Interface v2.5 `http://www.openmp.org/'.  This option
      implies `-pthread', and thus is only supported on targets that
      have support for `-pthread'.
 
 `-fms-extensions'
      Accept some non-standard constructs used in Microsoft header files.
 
      Some cases of unnamed fields in structures and unions are only
      accepted with this option.   Unnamed struct/union fields
      within structs/unions Unnamed Fields, for details.
 
 `-trigraphs'
      Support ISO C trigraphs.  The `-ansi' option (and `-std' options
      for strict ISO C conformance) implies `-trigraphs'.
 
 `-no-integrated-cpp'
      Performs a compilation in two passes: preprocessing and compiling.
      This option allows a user supplied "cc1", "cc1plus", or "cc1obj"
      via the `-B' option.  The user supplied compilation step can then
      add in an additional preprocessing step after normal preprocessing
      but before compiling.  The default is to use the integrated cpp
      (internal cpp)
 
      The semantics of this option will change if "cc1", "cc1plus", and
      "cc1obj" are merged.
 
 `-traditional'
 `-traditional-cpp'
      Formerly, these options caused GCC to attempt to emulate a
      pre-standard C compiler.  They are now only supported with the
      `-E' switch.  The preprocessor continues to support a pre-standard
      mode.  See the GNU CPP manual for details.
 
 `-fcond-mismatch'
      Allow conditional expressions with mismatched types in the second
      and third arguments.  The value of such an expression is void.
      This option is not supported for C++.
 
 `-flax-vector-conversions'
      Allow implicit conversions between vectors with differing numbers
      of elements and/or incompatible element types.  This option should
      not be used for new code.
 
 `-funsigned-char'
      Let the type `char' be unsigned, like `unsigned char'.
 
      Each kind of machine has a default for what `char' should be.  It
      is either like `unsigned char' by default or like `signed char' by
      default.
 
      Ideally, a portable program should always use `signed char' or
      `unsigned char' when it depends on the signedness of an object.
      But many programs have been written to use plain `char' and expect
      it to be signed, or expect it to be unsigned, depending on the
      machines they were written for.  This option, and its inverse, let
      you make such a program work with the opposite default.
 
      The type `char' is always a distinct type from each of `signed
      char' or `unsigned char', even though its behavior is always just
      like one of those two.
 
 `-fsigned-char'
      Let the type `char' be signed, like `signed char'.
 
      Note that this is equivalent to `-fno-unsigned-char', which is the
      negative form of `-funsigned-char'.  Likewise, the option
      `-fno-signed-char' is equivalent to `-funsigned-char'.
 
 `-fsigned-bitfields'
 `-funsigned-bitfields'
 `-fno-signed-bitfields'
 `-fno-unsigned-bitfields'
      These options control whether a bit-field is signed or unsigned,
      when the declaration does not use either `signed' or `unsigned'.
      By default, such a bit-field is signed, because this is
      consistent: the basic integer types such as `int' are signed types.
 
Info Catalog (gcc.info) Invoking G++ (gcc.info) Invoking GCC (gcc.info) C++ Dialect Options
automatically generated by info2html