C++ Compiler Options

--alternative_tokens

--no_alternative_tokens

Enables or disables recognition of alternative tokens. These are tokens that make it possible to write C++ without the use of the {, }, [, ], #, &, |, ^, and ~ characters. The alternative tokens include the operator keywords (such as and, bitand, etc.) and digraphs. Default is --no_alternative_tokens.

--array_new_and_delete

--no_array_new_and_delete

Enables or disables support for array, new, and delete. Default is --array_new_and_delete.

-asmwarn

Prints a warning for every asm statement encountered. [default]

-noasmwarn

Prevents the compiler from printing warning messages for asm statements.

--bool

--no_bool

Enables or disables recognition of bool. When bool is enabled, the preprocessor symbol _BOOL is defined, allowing code to determine when a typedef should be used to define the bool type. Default is --bool.

-dotciscxx

Interprets all files ending with .c as proper C++ source files.

--early_tiebreaker

--late_tiebreaker

Selects the way that tie breakers, or cv-qualifier differences, apply in overload resolution. In early tie breaker processing, the tie breakers are considered at the same time as other measures of the goodness of the match of an argument value and the corresponding parameter type. In late tie breaker processing, tie breakers are ignored during the initial comparison, and are considered only if two functions are otherwise equally good on all arguments; the tie breakers can then be used to choose one function over another. The default is --early_tiebreaker.

--enum_overloading

--no_enum_overloading

Enables or disables support for using operator functions to overload built-in operations on enum-typed operands. The default is --enum_overloading.

--exceptions

--no_exceptions

Enables or disables support for exception handling. Default is --no_exceptions.

--explicit

--no_explicit

Enables or disables support for the explicit specifier on constructor declarations. Default is --explicit.

--extern_inline

--no_extern_inline

Enables or disables support for inline functions with external linkage. When inline functions are allowed to have external linkage as required by the standard, then extern and inline are compatible specifiers on a non-member function declaration; the default linkage when inline appears alone is external (i.e., inline means extern inline on non-member functions); and an inline member function takes on the linkage of its class, which is usually external. However, when inline functions have only internal linkage as specified by the ARM, then extern and inline are incompatible; the default linkage when inline appears alone in internal (i.e., inline means static inline on non-member functions); and inline member functions have internal linkage no matter what the linkage of their class. Default is --extern_inline.

-gnu_c

Supports Gnu extensions, such as #import, zero size arrays, compound statements as part of expressions, inline functions and the _ _inline_ _ keyword. This is the default in C++.

-nognu_c

Does not allow Gnu C extensions. This is the default in C.

--implicit_extern_c_type_conversion

--no_implicit_extern_c_type_conversion

Enables or disables an extension to permit implicit type conversion in C++ between a pointer to an extern C function and a pointer to an extern C++ function. Default is --implicit_extern_c_type_conversion.

--inlining

Enables a reasonable level of function inlining. [default]

--inlining_unless_debug

Enables a reasonable level of function inlining, unless symbolic debug information is requested. If symbolic debug information is requested, then the effect is the same as specifying the --no_inlining option.

--keep_gen_c

The C++ source is first translated into a C source file before it is compiled. This file has a .ic extension and is normally deleted after compilation. This option causes the .ic file to not be deleted.

--long_lifetime_temps

--short_lifetime_temps

Selects the lifetime for temporaries. Short lifetimes refer to the end of full expression. Long lifetimes refer to the earliest of end of scope, end of switch clause, or next label. Short lifetimes are standard C++, and long lifetimes are what cfront uses; the cfront compatibility modes select long lifetimes by default.

--max_inlining

Enables an aggressive level of function inlining.

--max_inlining_unless_debug

Enables an aggressive level of function inlining, unless symbolic debug information is requested. If symbolic debug information is requested, then the effect is the same as specifying the --no_inlining option.

--multibyte_chars

--no_multibyte_chars

Enables or disables processing for multibyte character sequences in comments, string literals, and character constants. Multibyte encodings are used for character sets like the Japanese Shift-JIS. Default is --no_multibyte_chars.

--namespaces

--no_namespaces

Enables or disables support for namespaces. Default is --namespaces for C++, --no_namespaces for Embedded C++.

--no_forced_zero_initialization

Does not force global, uninitialized variables to be initialized to zero. This may save initialized data section space for embedded programs.

--no_inlining

Disables inlining of function calls. This may be a useful option for debugging C++ code.

--old_for_init

--new_for_init

Controls the scope of a declaration in a for-init statement. The old cfront/pre-ANSI compatible rule means the declaration is in the scope to which the for statement itself belongs. The new ANSI standard conforming rules, in effect, wrap the entire for statement in its own implicitly generated scope. Default is --old_for_init.

--pack_alignment=align

Sets the default alignment for packing classes and structs to align, which must be a power-of-2 value. The specified alignment is the default maximum alignment for nonstatic data members; it can be overridden by a #pragma pack directive.

--restrict

--no_restrict

Enables or disables recognition of the restrict keyword. Default is --no_restrict.

--rtti

--no_rtti

Enables or disables support for Runtime Type Information (RTTI). Features enabled/disabled are dynamic_cast, and typeid. Default is --rtti for C++, --no_rtti for Embedded C++.

-shortenum

Allocates enumerated types to the smallest storage possible.

-noshortenum

Does not attempt to allocate enumerated types to the smallest storage possible. [default]

-shortwchar

Specifies the size of the type wchar_t in ANSI C and C++ as two bytes.

-noshortwchar

Specifies the size of type wchar_t in ANSI C and C++ as four bytes. [default]

-signedchar

Specifies type char as signed.

-unsignedchar

Specifies type char as unsigned. [default]

-signedfield

Specifies a bit-field whose type, signed, is interpreted as a signed quantity.

-unsignedfield

Specifies all bit-fields as an unsigned quantity. [default] If the ANSI type declaration signed is used, then that bit-field is signed even if the program is compiled with the -unsignedfield option.

-signedptr

Specifies pointers and addresses as signed.

-unsignedptr

Specifies pointers and addresses as unsigned. [default]

-signedwchar

Specifies type wchar_t in ANSI C and C++ as signed. [default]

-T

Truncates all symbol names to eight characters for compatibility with older UNIX compilers and linkers.

-tmp=dir

Causes temporary files to be placed in the directory specified by dir instead of /tmp. This is useful if /tmp is on a small file system which might run out of disk space during compiles with inlining or template processing. On Win32, the default temporary directory is the current directory. This is also set with the TMPDIR environment variable. For example:

setenv TMPDIR /usr/tmp

-unsignedwchar

Specifies type wchar_t in ANSI C and C++ as unsigned.

--using_std

--no_using_std

Enables or disables implicit use of the std namespace when standard header files are included. Default is --no_using_std.

--wchar_t_keyword

--no_wchar_t_keyword

Enables or disables recognition of wchar_t as a keyword. Default is --wchar_t_keyword.

-Xnoasm

asm inline directive is not recognized. The _ _asm directive is recognized; only the asm directive without leading underscores is affected by this switch. This switch is enabled with -ANSI. See also -[no]asmwarn.

-Xwantprototype

Generates a warning if a function is referenced or called but no prototype is provided for that function. This is an extension to ANSI C and shows that the prototypes exist for all functions.

-Xneedprototype

Generates a fatal error if a function is referenced or called but no prototype is provided for that function. This is an extension to ANSI C and shows that the prototypes exist for all functions.

C++ Compatibility Options

--anachronisms

--no_anachronisms

Enables or disables anachronisms. The default is --no_anachronisms.

--cfront_2.1

-2.1

Enables compilation of C++ with compatibility with cfront version 2.1. This causes the compiler to accept language constructs that, while not part of the C++ language definition, are accepted by the AT&T C++ Language System (cfront) release 2.1.

--cfront_3.0

-3.0

Enables compilation of C++ with compatibility with cfront version 3.0. This causes the compiler to accept language constructs that, while not part of the C++ language definition, are accepted by the AT&T C++ Language System (cfront) release 3.0. This option also enables acceptance of anachronisms.

--eel

--eele

Enables extended Embedded C++. Adds templates, namespaces, mutable, new style casts enabled and the Standard Template Library (STL) to Embedded C++.

--old_for_init

--new_for_init

Controls the scope of a declaration in a for-init statement. The old cfront/pre-ANSI compatible rule means the declaration is in the scope to which the for statement itself belongs. The new ANSI standard conforming rules, in effect, wrap the entire for statement in its own implicitly generated scope. Default is --new_for_init.

--strict_warnings

--std

Enables strict Standard mode, which provides diagnostic messages when non-Standard features are used, and disables features that conflict with Standard C++. Standard violations will be issued as warnings.

--strict

--STD

Enables strict Standard mode, which provides diagnostic messages when non-Standard features are used, and disables features that conflict with Standard C++. Standard violations will be issued as errors.

C++ Library Selection Options

--eel

Engages extended Embedded C++ library without exceptions.

--eele

Engages extended Embedded C++ library with exceptions.

--el

Engages Embedded C++ library without exceptions.

--ele

Engages Embedded C++ library with exceptions.

--stdl

Engages Standard C++ library without exceptions.

--stdle

Engages Standard C++ library with exceptions.

Error Message Options

--brief_diagnostics

--no_brief_diagnostics

Enables or disables a mode in which a shorter form of the diagnostic output is used. When enabled, the original source line is not displayed and the error message text is not wrapped when too long to fit on a single line.

--diag_suppress tags

--diag_remark tags

--diag_warning tags

--diag_error tags

Overrides the normal error severity of the specified diagnostic messages. The message(s) may be specified using a mnemonic error tag, or using an error number.

--display_error_number

Displays the error message number in any diagnostic messages that are generated. The option may be used to determine the error number to be used when overriding the severity of a diagnostic message.

--for_init_diff_warning

--no_for_init_diff_warning

Enables or disables a warning that is issued when programs compiled under the new for-init scoping rules would have had a different behavior under the old rules. Default is --for_init_diff_warning.

--no_use_before_set_warnings

Suppresses warnings on local automatic variables that are used before their values are set. The compiler's algorithm for detecting such uses is conservative and is likely to miss some cases that an optimizer with sophisticated flow analysis could detect; thus, implementation might suppress the warnings from the compiler when optimization has been requested but permit them when the optimizer is not being run.

--remarks

Issues remarks, which are diagnostic messages milder than warnings.

--no_warnings

Suppresses warnings. Errors are still issued.

--wrap_diagnostics

--no_wrap_diagnostics

Enables or disables a mode in which the error message text is not wrapped when too long to fit on a single line. Default is --wrap_diagnostics.

Listing Options

--list lfile (For C++ only.) Generates raw listing information in the file lfile. This information can generate a formatted listing. The raw listing file contains raw source lines, information on transitions into and out of include files, and diagnostics generated by the compiler. Each line of the listing file begins with a key character that identifies the type of line, as follows:

N Normal line of source; the rest of the line is the text of the line.

X Expanded form of a normal line of source; the rest of the line is the text of the line. This line appears following the N line, and only if the line contains non-trivial modifications. Comments are considered trivial modifications; macro expansions, line splices, and trigraphs are considered non-trivial modifications.

S Line of source skipped by a #if or the like; the rest of the line is text. The #else, #elif, or #endif that ends a skip is marked with an N.

L Indication of a change in source position. The line has a format similar to the # line-identifying directive output by cpp, as follows:

L line-number filename key

Where key is either 1 for entry into an include file, or 2 for exit from an include file, and omitted otherwise. The first line in the raw listing file is always an L line identifying the primary input file. L lines are also output for #line directives (key is omitted). L lines indicate the source position of the following source line in the raw listing file.

R, W, E, or C
Indication of a diagnostic. The line has the form:

S filename line-number column-number message-text

where S is either R for remark, W for warning, E for error, and C for catastrophic error. Errors at the end of file indicate the last line of the primary source file and a column number of zero. Command line errors are catastrophes with an empty filename ("") and a line and column number of zero. Internal errors are catastrophes with position information as usual, and message text beginning with internal error. When a diagnostic displays a list, such as all the contending routines when there is ambiguity on an overloaded call, the initial diagnostic line is followed by one or more lines with the same overall format. This format is a code letter, filename, line number, column number, and message text, but the code letter is the lowercase version of the code letter in the initial line. The source position in such lines is the same as that in the corresponding initial line.

--xref xfile

Generates cross reference information in the file xfile. For each reference to an identifier in the source program, a line of the form:

symbol-id name X file line-num column-num

is written. X is either D for definition, d for declaration (that is, a declaration that is not a definition), M for modification, A for address taken, U for used, C for changed (but actually meaning "used and modified in a single operation" such as an increment), R for any other kind of reference, or E for an error in which the kind of reference is indeterminate. symbol-id is a unique decimal number for the symbol. The fields of the above line are separated by tab characters. (For C++ only.)

Precompiled Header Options

--create_pch file

If other conditions are satisfied, creates a precompiled header file with the specified name. This option has no effect if the option --use_pch or --pch appears after it on the command line. (For C++ only.)

--pch

Automatically uses and/or creates a precompiled header file. This option has no effect if the option --use_pch or --create_pch appears after it on the command-line. (For C++ only.)

--pch_dir dir

Specifies the directory in which to search and/or creates a precompiled header file. This option may be used with any of the other PCH options. (For C++ only.)

--pch_messages

--no_pch_messages

Enables or disables the message display that a precompiled header file was created or used in the current compilation. Default is --pch_messages. (For C++ only.)

--use_pch file

Uses a precompiled header file of the specified name as part of the current compilation. This option has no effect if the option --pch or --create_pch appears after it on the command-line. (For C++ only.)

Template Options

-archive

Just like the --prelink_objects option, except an archive is created. The library name must be specified with the -o option. (For C++ only.)

--auto_instantiation

--no_auto_instantiation

-template=auto

-template=noauto

Enables or disables automatic instantiation of templates. Default is --auto_instantiation. (For C++ only.)

--distinct_template_signatures

--no_distinct_template_signatures

Controls whether the signatures for template functions can match those for non-template functions when the functions appear in different compilation units. Default is --no_distinct_template_signatures. (For C++ only.)

--guiding_decls

--no_guiding_decls

Enables or disables recognition of "guiding declarations" of template functions. A guiding declaration is a function declaration that matches an instance of a function template but has no explicit definition (since its definition derives from the function template).

For example:

template <class T> void f(T) { ...}
void f(int);

When regarded as a guiding declaration, f(int) is an instance of the template; otherwise it is an independent function for which a definition must be supplied. If -no_guiding_decls is combined with --old_specializations, a specialization of a non-member template function is not recognized. It is treated as a definition of an independent function. Default is --guiding_decls. (For C++ only.)

--implicit_include

--no_implicit_include

Enables or disables implicit inclusion of source files as a method of finding definitions of template entities to be instantiated. Default is --implicit_include. (For C++ only.)

--implicit_typename

--no_implicit_typename

Enables or disables implicit determination, from context, whether a template parameter dependent name is a type or a nontype. Default is --implicit_typename. (For C++ only.)

--instantiation_dir=directory

When --one_instantiation_per_object is used, this option can be used to specify the directory into which the generated object files should be put. The default instantiation directory is ./template_dir.

--nonstd_qualifier_deduction

--no_nonstd_qualifier_deduction

Controls whether nonstandard template argument deduction should be performed in the qualifier portion of a qualified name. With this feature enabled, a template argument for the template parameter T can be deduced in contexts like A<T>::B or T::B. The standard deduction mechanism treats these as nondeduced contexts that use the values of template parameters that were either explicitly specified or deduced elsewhere. The default is --no_nonstd_qualifier_deduction.

--one_instantiation_per_object

Puts each template instantiation in this compilation (function or static data member) in a separate object file. The primary object file (the object file corresponding to the original source file) contains everything else in the compilation, i.e. everything that isn't an instantiation. Having each instantiation in a separate object file is useful and recommended when creating libraries, because it allows you to pull in only the instantiations that are needed, thus reducing code size. This is also essential if two different libraries include some of the same instantiations to avoid multiple defined symbol problems.

--old_specializations

--no_old_specializations

Enables or disables acceptance of old style template specializations; that is, specializations that do not use the template<> syntax. Default is --old_specializations. (For C++ only.)

--prelink_objects

Causes the driver to invoke the C++ prelink utility to instantiate templates, but not to invoke the linker or archiver. The effect is similar to invoking the driver with -c in that only object files are created, but no link is performed. The difference is that the object files contain all template instantiations required by this set of object files. Therefore, they can be linked later without concern for template requirements. This option should not be used with any options that prevent the linker from being run, such as -E, -P, -S, or -c, nor with the option -template=noauto (or --no_auto_instantiation) which prevents prelink from being run. This option is used by the clearmake process (For C++ only.).

-tmode

Controls instantiation of external template entities. External template entities are external (i.e., non-inline and non-static) template functions and template static data members. The instantiation mode determines the template entities for which code should be generated based on the template definition. (For C++ only.)

all Instantiates all template entities whether or not they are used.

local Instantiates only the template entities that are used in this compilation, and force those entities to be local to this compilation.

none Instantiates no template entities. [default]

used Instantiates only the template entities that are used in this compilation.

--typename

--no_typename

Enables or disables recognition of typename. Default is --typename. (For C++ only.)

Virtual Table Control Options

--force_vtbl

Forces definition of virtual function tables where the heuristic used by the compiler provides no guidance in deciding on definition of virtual function tables. See --suppress_vtbl. (For C++ only.)

--suppress_vtbl

Suppresses definition of virtual function tables where the heuristic used by the compiler provides no guidance in deciding on definitions of virtual function tables. The virtual function table for a class is defined in a compilation if the compilation contains a definition of the first non-inline non-pure virtual function of the class. For classes that contain no such function, the default is to define the virtual function table (but to define it as a local static entity). This option suppresses the definition of the virtual function tables for such classes, and the --force_vtbl option forces the definition of the virtual function table for such classes. --force_vtbl differs from the default behavior in that it does not force the definition to be local. (For C++ only.)

The following table lists single dash equivalents for double dash options that are not documented in this manual.
Double Dash Options Single Dash Options
--comments
-C
--compile
-c
--debug
-g
--define_macro name=string
-Dname=string
--dependencies
-Make
--driver_debug
-dryrun
--error_limit num
-errmax=num
--include_directory
-I
--instantiate mode
-tmode
--library_directory dir
-Ldir
--no_code_gen
-syntax
--no_line_commands
-P
--no_warnings
-w
--optimize
-O
--output
-o
--preprocess
-E
--signed_chars
-signed_char
--undefine_macro name
-Uname
--unsigned_chars
-unsigned_char
--version
-V


Previous

Next



Copyright © 1999, Green Hills Software. All rights reserved.