Jump to 
content
HP.com Home Products and Services Support and Drivers Solutions How to Buy
»  Contact HP

 

cxx(1)

cxx(1)

Name

cxx - the C++ compiler

Syntax

/usr/bin/cxx [ option ] ... file ...

The cxx command accepts the options described in this reference page.

You cannot group multiple options after a single hyphen; that is, `-pg' is different than `-p -g'.

You can specify negatable options using either the -no or -no_ prefix. For example, the compiler accepts both -noansi_alias and -no_ansi_alias. In this document, negatable options are shown with the -no prefix.

A file is one or more file specifications separated by white space. Supply complete relative or absolute path information when the source file is not in your current directory.

Description

The cxx command compiles C++ code into machine-readable instructions. The desired output is specified with an option on the command line, and can be object files or symbolic assembly language.

The compiler produces one object file for each source file compiled. Additional files can be written to the repository for template instantiations. If the linker is called, and only one source file is specified on the command line, the single object file is deleted after the linking operation.

The cxx command invokes the C++ compiler, and possibly other components of the compilation system, depending on the specified command options and files. When you start the cxx compiler, it normally performs the following tasks:

  • Preprocessing
  • Compiling
  • Linking

Use the -c option to stop compiler operation before linking, resulting in one or more output files with the .o suffix. Use the -E option to run only the preprocessor.

The detection of an error in one source file does not affect compilation of other source files specified on the same command line.

If you specify the -x cxx option, the compiler treats all files as C++ source files regardless of their suffixes, unless the file has a .a or .o suffix.

If you do not specify the -x cxx option or if you specify the -x none option, the compiler recognizes the following file name suffixes as having special significance:
.cxx, .CXX, .cpp, .CPP .cc, .CC, .C, .c++ C++ source code
.hxx C++ header file
.ixx C++ source code already processed by the preprocessor
.a Linker library. -x cxx has no effect on files with this extension
.c C source code, to be compiled with the HP C compiler
.i C source code already processed by the preprocessor
.o Linker object module. -x cxx has no effect on files with this extension
.so Shared object (shared library)

The cxx compiler recognizes the command options described in the Options section. Some of the options affect the behavior of the preprocessor. The preprocessor is invoked through the cxx command for C++ files, and is not invoked with a separate command. Any options not recognized by the cxx compiler are assumed to be linker options, and are passed through to the linker.

Default Compiler Flags and Environment Variables

To facilitate setting default compiler flags, you can create an optional configuration file named comp.config or an environment variable named DEC_CXX.

  • The comp.config file allows system administrators to establish a set of compilation flags that are applied to compilations on a system-wide basis. The compiler flags in comp.config must be specified on a single line. On Tru64 UNIX, the comp.config file is located in the compiler target directory


    /usr/lib/cmplrs/cxx 
    

    On Linux Alpha, the file is located in the directory


    /usr/lib/compaq/cxx-version/alpha-linux/bin 
    

    You can use the -comp.config option to specify a different directory.

  • The DEC_CXX environment variable allows users to establish a set of compilation flags that are applied to subsequent compilation on a per user basis.
  • The comp.config file and the DEC_CXX environment variable can contain two distinct sets of compilation flags separated by a single vertical bar ( | ). The flags before the vertical bar are known as prologue flags and the flags after the bar are known as epilogue flags. The comp.config file and the DEC_CXX environment variable can begin or end with a vertical bar, or have no vertical bar at all. If no vertical bar is present, the flags are treated as prologue flags by default. Any vertical bar found after the first vertical bar is treated as whitespace.

Compiler flags are processed in the following order during a compilation:

  1. comp.config prologue flags
  2. DEC_CXX prologue flags
  3. command line flags
  4. comp.config epilogue flags
  5. DEC_CXX epilogue flags

If -v is specified on the command line, the contents of DEC_CXX and comp.config, if present, are displayed.

If the environment variable COMP_HOST_ROOT is set, the value is used as the root directory for all compiler tools and executables rather than the default slash (/). If the environment variable COMP_TARGET_ROOT is set, the value is used as the root directory for all include files and libraries rather than the default slash (/). COMP_TARGET_ROOT affects the standard directory for include files, /usr/include, and the standard library, /usr/lib/libc.a. If COMP_TARGET_ROOT is set, $COMP_TARGET_ROOT/usr/lib is the only directory that is searched for libraries using the -lx option.

If the environment variable TMPDIR is set, the value is used as the directory to hold any temporary files rather than the default /tmp directory.

On Tru64 UNIX, if the environment variable RLS_ID_OBJECT is set and the linker is invoked, the value is used as the name of an object to link. The RLS_ID_OBJECT variable is always the last object specified to the linker.

Macro Names

The preprocessor recognizes the macro names __DATE__, __FILE__, __LINE__ __TIME__, and __cplusplus, which cannot be redefined or undefined. In addition, macro names that begin with two leading underscore characters (for example, __STD_ANSI) or a single underscore character followed by an uppercase letter (for example, _WCHAR_T) are reserved for the implementation. These names are useful in preprocessor #ifdef and #if defined directives to isolate code intended for one of the particular cases. The names can be used anywhere you use other defined names, including within macros.

For details, see HP C++ Implementation in Using HP C++ for Tru64 UNIX and Linux Alpha .

Release Notes and Documentation

For additional information about this release, see the online release notes:
[Tru64]


/usr/lib/cmplrs/cxx/CompaqCXXversion_release.ps | .txt 

[Linux]


 /usr/doc/cxx-version/readme.htm 

HTML files are provided for the release notes and some of the product manuals for use with a web browser. These files are installed on Tru64 UNIX by selecting the following subset:


HP C++ HTML documentation 

To view this documentation, point your web browser to the following file:


/usr/share/doclib/cplusplus/index.htm 

On Linux Alpha, the HTML documentation is included in the directory


/usr/doc/cxx-version/doc 

To view this documentation, point your web browser to the following file:


/usr/doc/cxx-version/doc/index.htm 

Options

HP C++ strives to maintain maximum compability of functions on Tru64 UNIX and Linux Alpha. However, options that integrate the compiler with system-specific tools like cord, atom, om, and xtaso, may produce system-specific results.

The cxx command options are grouped as follows:

Note

Options available for the cxx command on Linux Alpha are similar to those available on Tru64 UNIX. The notation [Tru64] introduces information that applies only to Tru64 UNIX; the notation [Linux] introduces information that applies only to Linux Alpha. All other information applies to both platforms.

Options Exclusive to Tru64 UNIX

The following options are exclusive to Tru64 UNIX:


-compress, -cord, -create_pch, -feedback, -gen_feedback, 
-migrate, -nocpp, -nopg, -oldcxx, -om, -omp -prof_gen, -pch, 
-pch_dir, -[no]pch_messages, -pthread, -[no]pure_cname, 
-[no]rtti, -show_mangled_name, -threads, -novtable_info, 
-xref, -xref_stdout,  -[no]use_ld_input, -use_non_shared_libcxx, 
-use_pch, -[no]use_system_libcxx, -use_shared_libcxxstd 

The -check, -oldcxx, and -nocpp options are deprecated.

General Options

The cxx command supports the general options described in this section. Optimization options are described in the following section.

-[no]alternative_tokens

The -alternative_tokens option enables use of the following operator keywords and digraphs to generate tokens:
Operator Keyword Token
and &&
and_eq &=
bitand &
bitor |
compl ~
not !
not_eq !=
or ||
or_eq |=
xor ^
xor_eq ^=
Digraph Token
:> ]
<: [
%> }
<% {
%: #

The default is -noalternative_tokens when compiling with the -std arm, -std gnu, -std ms, and -std ansi options. The default is -alternative_tokens when compiling with the -std strict_ansi and -std strict_ansi_errors options. Specifying this option defines the __ALTERNATIVE_TOKENS macro.

-c

Suppress the linking phase of the compilation and force production of one or more object file(s) with the .o suffix. If the file name argument already has the .o suffix, do nothing at all.

-call_shared

Produce a dynamic executable file that uses shareable objects during run-time. This is the default. The loader uses shareable objects to resolve undefined symbols. The run-time loader is invoked to bring in all required shareable objects and to resolve any symbols that remained undefined during static link time.

-comp.config directory

Specifies a directory for the comp.config file. Normally, the file is stored in the compiler target directory. This option is interpreted only if specified on the command line. For detailed information about comp.config file processing see the Description section.

-[no]compress

[Tru64] The -compress option causes the output object file or instantiated object file to be produced in compressed object file format, resulting in a substantially smaller object file. To produce uncompressed files, specify -nocompress. The default is -compress.

[Linux] The -compress option is ignored; the default is -nocompress and works as on Tru64 UNIX.

-cord

[Tru64] Run the procedure rearranger on the resulting file after linking. Rearrangement is performed to reduce the cache conflicts of the program's text. At least one -feedback file must be specified.

-denorm

Force denormalized constant numbers to zero when IEEE support is enabled.

-distinguish_nested_enums

Change the compiler's name mangling scheme to include the name of any class within which an enum type is nested. This allows functions to be overloaded when the only difference in the parameter types is that one parameter is an enum with a particular name while the other is an enum with the same name nested within a class (or nested within a different class). In general, if you compile one program module using this option, you should use it for the others. Specifying this option might make it difficult to link with libraries or old object files because of differences in mangled names.

-error_limit n, -noerror_limit

Specify the number of errors allowed before compilation stops for a single source file. The default value is 30.

-feedback file

[Tru64] This option is used with the -cord option to specify a feedback file. The feedback file is produced by the prof command with its -feedback option from an execution of the program produced by the pixie command.

-fprm option

Specify rounding mode. The following options are supported:
c Round toward 0 (chop).
d Set rounding mode for IEEE floating-point instructions dynamically, as determined from the contents of the floating-point control register. The dynamic rounding mode can be changed or read at execution time by a call to write_rnd(3) or read_rnd(3). If you specify this option, the IEEE floating-point rounding mode defaults to round to nearest.
m Round toward minus infinity.
n Set normal rounding mode (unbiased round to nearest). This is the default.

This option also defines the __FLT_ROUNDS macro.

-fptm option

Specify trapping mode. Only one option can be used on a command line. The following options are supported:
n Generate instructions that do not trigger floating-point underflow or inexact trapping modes. Any floating point overflow, divide-by-zero, or invalid operation will unconditionally generate a trap. This is the default.
u Generate intstructions that trap floating-point underflow, overflow, divide-by-zero, and invalid operations.

-g[n]

Determine the level of symbol table information produced, as follows:
Option Information Level
-g0 Do not produce symbol table information for symbolic debugging. This is the default.
-g1 Produce symbol table information for accurate, but limited, symbolic debugging of partially optimized code.
-g, -g2 Produce symbol table information for full symbolic debugging, but do not perform optimizations that limit full symbolic debugging. This option resets the optimization level to -O0.
-g3 Produce symbol table information for full symbolic debugging of fully optimized code. This option can affect debugger accuracy.

If the debugger describes a class as <opaque> or lacks debugging information, you may need to compile particular files using the -gall option.

-gall

Generate full symbol table information for all classes, structs, and unions. If you specify -gall, -g is assumed.

-gall_pattern pattern

Generate full symbol table information for all classes, structs, and unions if the name of the file being compiled matches the pattern. The pattern can be a list of file names (with each file name separated by a comma or colon), filename patterns, or a combination of a file name list and filename patterns. The -gall_pattern option is ignored unless -g, -g2, or -g3 is also specified. -gall_pattern can be specified more than once with an additive effect. Because -gall implies -gall_pattern*, -gall_pattern has no effect when -gall is specified.

-G num

Specify the maximum size, in bytes, of a data item that is to be accessed from the global pointer. The num argument is interpreted as a decimal number. If num is zero, data is not accessed from the global pointer. The default value for num is 8 bytes.

-gen_feedback

[Tru64] Generate accurate profile information to be used with -feedback optimizations. Such optimizations should be used in the compiling and linking phases. When compiling a program for profiling, add -gen_feedback to your existing set of command line flags.

-ieee

Support all portable features of the IEEE Standard for Binary Floating-Point Arithmetic (ANSI/IEEE Standard 754-1985), including the treatment of denormalized numbers, NaNs, infinities, and the handling of error cases. This flag also sets the _IEEE_FP macro. To flush floating point underflows to zero, add the -underflow_to_zero option.

-K

Build and use intermediate files, producing a file with the conventional extension for the type of file. These intermediate files are not removed, even when a stage encounters a fatal error. Extensions are appended to the output if the output file does not already have an extension.

-long_double_size 64 | 128

Tru64 UNIX Version 5.0 and later has a default long double size of 128 bits. Although support for 64-bit long doubles has been retired, you can use the -long_double_size 64 option to specify 64-bit long doubles if necessary. This option also defines the __X_FLOAT macro with a value of 0 instead of 1. On Linux, 64 bits is the default.

Because specifying this option makes the long doubles in your code incompatible with the long doubles in the system libraries, the following libraries are required:


 ./usr/ccs/lib/libretired_real8.a 
 ./usr/shlib/libretired_real8.so 

These libraries do not ship as part of the base OS. You must install the CMPDEVENH subset, which is available on the Tru64 Associated Products Volume 1 CD under Development_Enhancements.

Note

On Tru64 UNIX Version 4.n systems or Linux, you can use the -long_double_size 128 option to specify 128-bit long doubles. However, the program will function correctly only on systems with libraries that support 128-bit long doubles.

-machine_code

List the generated machine code in the listing file. To produce the listing file, you must also specify the -source_listing option. The default is not to list the generated machine code. This option does not generate a listing file when object file generation is disabled (using the -noobject option).

-[no]misalign

Use -misalign to specify that code generated for indirect load instructions and store instructions not generate alignment faults for arbitrarily aligned addresses. Using this flag increases the size of generated code and might have a negative impact on performance. The default condition, implied by -nomisalign is for code generated for indirect load instructions and store instructions to generate alignment faults for arbitrarily aligned addresses.

-model [ansi | arm]

[Tru64] Determines the layout of C++ classes, name mangling, and exception handling. On Tru64 UNIX, the default is -model arm; on Linux Alpha, the default is -model ansi. The -model arm option is not supported on Linux Alpha.

The -model arm option is the default and generates objects that are link compatible with all HP C++ releases prior to Version 6.3, and with all objects compiled using the -model arm option in HP C++ Version 6.3 or later. Specifying this option defines the macro __MODEL_ARM.

The -model ansi option supports the complete ISO/ANSI C++ specification, including distinct name mangling for templates. The ANSI model also reduces the size of C++ non-POD class objects. Note that this option generates objects that are not compatible with prior releases of HP C++, or with objects compiled using the -model arm option.

If you specify the -model ansi option, you must recompile your entire application, including libraries. Specifying this option defines the macro __MODEL_ANSI.

-nocleanup

Disable generation of implicit exception handlers. Procedures without explicit handlers may have implicit handlers. For example, the compiler creates a handler for each automatic object that has a destructor. The compiler also creates handlers for constructors that initialize subobjects that have destructors. In such a constructor, the compiler creates a handler for each member with a destructor, and a handler for each base class with a destructor. The -nocleanup option suppresses generation of such implicit handlers, which results in a slightly smaller executable.

The -nocleanup option results in smaller and faster programs by suppressing all runtime invocation of destructors during transfer of control out of a scope by way of throw or longjmp. You should not use the -nocleanup option to build programs that expect destructors to be invoked for local variables when the stack is unwound by a thrown exception, or a call to exc_longjmp.

-nodemangle

Causes linker messages to contain mangled names. By default, names are mangled in both Tru64 UNIX and Linux Alpha.

-noexceptions

Specify -noexceptions to disable C++ exceptions as follows:
  • The compiler diagnoses warnings for throw expressions, try blocks, and catch statements, but might generate code for these constructs.
  • The compiler does not generate cleanup code for automatic objects.
  • The compiler does not generate special code for main programs so that the terminate() function is called for unhandled exceptions.

This option undefines the __EXCEPTIONS macro, which is defined by default.

-[no]member_alignment

The -nomember_alignment option directs the compiler to byte-align data structure members, except for bit-field members.

By default (implied by -member_alignment ), data structure members are aligned on natural boundaries (that is, the next boundary appropriate to the member type) rather than the next byte. Using any of the #pragma [no]member_alignment or #pragma pack directives in the source code overrides the setting established by these flags.

Use of the -nomember_alignment option can cause conflicts between the compiler's assumptions about data layouts and the default values that were in effect when the system libraries were created. See protect_headers_setup(8c++) for details on how to avoid this conflict.

-non_shared

Do not produce a dynamic executable file. The loader uses regular archives to resolve undefined symbols and object files (.o suffix) from archives that are included in the executable produced.

-noobject

Do not produce an object file.

-novtable_info

[Tru64] Tell the demangler to suppress the display of information concerning internal symbols (specifically __vtbl and __btbl).

-o file

Name the final output file, rather than use the default a.out. The given name is used regardless of the type of file (executable, object, or other type).

-omp

Cause the compiler to recognize the OpenMP shared memory parallel programming API pragmas and pass libots3 and appropriate thread libraries to the linker. It also predefines the macro _OPENMP with a nonzero value. For more information about OpenMP, see http://www.openmp.org .

-[no]transform_loops

The -notransform_loops option disables a group of loop transformation optimizations that apply to array references within loops. This group of optimizations includes loop blocking, loop distribution, loop fusion, loop interchange, loop scalar replacement, and outer loop unrolling. This is the default at optimization levels -O3 or lower.

You must specify this option if you want this type of optimization disabled and you are also specifying -O4, because -transform_loops is performed by default at the -O4 optimization level.

The -transform_loops option enables a group of loop transformation optimizations that apply to array references within loops. This group of optimizations includes loop blocking, loop distribution, loop fusion, loop interchange, loop scalar replacement, and outer loop unrolling.

This optimization is enabled by default if you specify -O4 or -O5 and has no effect when specified with -O0.

-p

Perform profiling by periodically sampling the value of the program counter. This option affects only linking. When linking is done, this option replaces the standard run-time startup routine with the profiling run-time startup routine (mcrt0.o on Tru64 UNIX and gcrt1.o on Linux Alpha) and searches the level 1 profiling library (libprof1.a). When profiling is completed, the startup routine calls the monstartup routine and produces a mon.out file that contains execution-profiling data for use with the postprocessor prof. Same as -p1.

-p0

Do not perform profiling. This is the default.

-p1

Same as -p

-[no]pg

Perform call graph profiling using the gprof tool.

[Tru64] Specify -nopg to disable selectively profiling for individual modules when using the -pg graph profiling option.

For more information on profiling C++ code, see the Tru64 UNIX Programmer's Guide and the gprof(1) reference page.

-preempt_module

Provide module preemption, but not full symbol preemption. Module preemption allows the replacement of the definitions of all the symbols corresponding to a compilation unit (that is, a single object file generated from a .cxx file). Module preemption would take effect if you modified and recompiled a .cxx file, and linked the new .o file file into the main object, thus "replacing" all of the .cxx file's external symbols from the shared library. Unlike full symbol preemption, module preemption does not support replacing individual symbols because the compiler may perform optimizations that take advantage of information about symbols defined within a module. This is the default.

-preempt_symbol

Provide full symbol preemption. Full symbol preemption allows the replacement of the definition of an individual external symbol (function or data) in a shared library. This "replacement" occurs at runtime when the dynamic loader uses a definition of the symbol from the main object or some other shared library in preference to the definition in the original shared library. This behavior may be important when a particular symbol is defined in both the main object and in a shared library (or in multiple shared libraries).

-protect_headers [all | none | default]

Enables the protection of system header files as described in Protecting System Header Files in Using HP C++ for Tru64 UNIX and Linux Alpha . Specifying none disables protection. By default, header file protection is enabled.

-pthread

[Tru64] Direct the linker to use the threadsafe version of any library specified with the -l flag when linking programs. This flag also tells the linker to include the POSIX 1003.1c-conformant DECthreads interfaces in libpthread when linking the program. This option also defines the _REENTRANT macro.

-[no]pure_cname

[Tru64] When used in conjunction with the <cname> headers, -pure_cname defines C names in namespace std only as specified by the C++ International Standard. When used with cname.h or <cname> headers, -nopure_cname defines C names in namespace std and at global namespace scope. The -pure_cname option is enabled by default when you specify the -std strict_ansi and -std strict_ansi_errors options. The -pure_cname option also defines the __PURE_CNAME macro.

-r

Retain relocation entries in the output file. Relocation entries must be saved if the output file is to become an input file in a subsequent linker run. This option prevents final definitions from being given to common symbols; it also suppresses the diagnosis of undefined symbols.

-readonly_strings

Make all string literals readable only. This is the default. See also writable_strings.

-writable_strings

Make string literals writable.

-[no]rtti

[Tru64] Enable or disable support for RTTI (runtime type identification) features: dynamic_cast and typeid. Disabling runtime type identification may save space in your object file because static information to describe polymorphic C++ types is not generated. The default is to enable runtime type information features and generate static information in the object file. Specifying -nortti does not disable exception handling. This option also defines the __RTTI macro.

-S

Compile the specified source programs and produce symbolic assembly language in corresponding files with a .s suffix. Do not assemble these files. If the file name argument already has a .s suffix, do nothing at all.

-SD[directory]

Suppress certain warning- and informational-level diagnostic messages that are inappropriate for system header files. The suppressed messages relate to non-portable constructs in header files whose pathnames are prefixed by string directory.

The default is -SD/usr/include.

Specifying -SD without a directory string cancels the effect of any previous SD flags on the command line (including the default, -SD/usr/include). It also disables the -protect_headers feature's suppression of diagnostic messages by defining the macro __DECC_EMPTY_SD_OPTIONS. (The -protect_headers feature provides message suppression in the file __DECC_include_prologue.h.)

-shared

Produce a shared object. This includes creating all of the tables for run-time linking, and resolving references to other specified shared objects. The object created can be used by the linker to make dynamic executables.

-show keyword[,keyword,...]

Specify one or more items to be included in the listing file. When specifying multiple keywords, separate them by commas (with no intervening blanks). To use any of the -show keywords, you must also specify the -source_listing option. The -show keywords are as follows:
none Negate all options
all Enable all options
[no]expansion Places final macro expansions in the program listing. When you specify expansion, the number printed in the margin indicates the maximum depth of macro substitutions that occur on each line.
[no]header Specify whether to produce header lines at top of each page of listing
[no]include Specify whether to place contents of #include files in the program listing
[no]source Specify whether to place source program statements in the program listing
[no]statistics Places compile-time performance statistics in the program listing.

If you specify -source but do not specify -show keywords, the compiler includes header lines and source statements in the program listing.

The default is -show header,source.

-show_mangled_name

[Tru64] Tell the demangler to display encoded name in parentheses after demangled name.

-signed

Cause all char declarations to have the same machine representation and value set as signed char declarations. This is the default. This option is ignored if specified on the same command line as -unsigned.

-unsigned

Cause all char declarations to have the same machine representation and value set as unsigned char declarations. The -unsigned option overrides -signed if both are specified on the command line.

-source_listing

Produce a source code listing file of the same name as the source file, but with the suffix .lis.

-strong_volatile, -weak_volatile

These options affect the generation of code for assignments to objects that are less than or equal to 16 bits in size (for instance, char , short ) that have been declared volatile.

If -strong_volatile is specified, the generated code includes a load-locked instruction for the enclosing longword or quadword, an insertion of the new value of the object, and a store-conditional instruction for the enclosing longword or quadword. By using this locked instruction sequence, the -strong_volatile option allows byte and word accesses at byte granularity. This behavior guarantees that assignments to adjacent volatile small obects by different threads in a multi-threaded program do not cause one of the objects to receive an incorrect value.

If -weak_volatile is specified, the generated code includes a read of the enclosing longword or quadword, an insertion of the new value of the object, and a store of the enclosing longword or quadword. Because locked instructions are not generated, this behavior allows byte or word accesses to memory-like I/O devices for which layer accesses do not cause read or write side effects. And because this sequence does not ensure byte granularity, adjacent volatile data integrity can be compromised when such byte or word accesses are performed in a multithreaded environment (for example, two volatile shorts stored in a longword and accessed asynchronously). This option is the default.

-tc[c...]

The -t, -h, and -B options are used together to specify a location and/or name for one or more compiler passes, tools, libraries, or include files, other than their normal locations or names.

The -t option specifies which compiler passes (or components) the -h and -B options that follow apply to. The c characters can be one or more of the following:
Character Name of pass, tool, or component
f C++ compiling and template instantiating. Deprecated - use x instead.
a as0
b as1
k C compiling
l ld
y ftoc
z cord
i C++ header files
j cname header files
r [m]crt0.o
n libprof1.a
L om
M _main.o
x C++ compiling and template instantiating
s stdlib

To relocate the comp.config file, use the -comp.config option.

Note

If the character h is in the -t argument, a directory is added to the list of directories to be used in searching for header files. The name of this directory has the form


$COMP_TARGET_ROOT/usr/include string


This directory is to contain the header files for the string release of the compiler. The standard directory is still searched.

If -t is not specified, the -h and -B options are applied to all tools.

The -t and -h options are not processed until the next -B option is processed. If more than one -t option or more than one -h option appear on the command line before the next -B option, only the last of the previous -t and -h option arguments are used.

-hdir

Use the specified directory instead of the directory where the name specified by the -t flag is normally found.

-Bstring

Specifies a suffix to add to the normal names of any components specified with the -t option. If string is omitted, the usual component names are used.

[Linux] The linker command ld uses a -B option to specify static/dynamic/symbolic. The C++ driver does not support this ld option because it conflicts with the driver's suffix functionality.

-Hc

Halts compiling after the pass specified by the character c, producing an intermediate file for the next pass. The c character can be one of the following: [fablyzx] (see the -t option for an explanation). It selects the compiler pass in the same way as the -t option. If this option is used, the symbol table file produced and used by the passes is given the name of the last component of the source file with the suffix changed to .T, and the file is always retained after the compilation is halted.

-taso

Tell the linker that the executable file should be loaded in the lower 31-bit addressable virtual address range. You can also use the -T and -D options to the ld command to ensure that the addresses of text and data segments are loaded into low memory.

Besides setting default addresses for text and data segments, the -taso option also causes shared libraries linked outside the 31-bit address space to be appropriately relocated by the loader. If you specify -taso and also specify text and data segment addresses with -T and -D, those addresses override the -taso default addresses. The -taso option is useful for porting 32-bit programs to Tru64 UNIX.

-trapuv

Forces all uninitialized stack variables to be initialized with 0xfff58005fff58005. When this value is used as a floating-point variable, it is treated as a floating-point NaN and causes a floating-point trap. When it is used as a pointer, an address or segmentation violation usually occurs.

For programs compiled without the -trapuv option, the debugger stops only on executable statements in which the value of a specified variable changes. With the -trapuv option, the debugger stops on these statements and also stops on all local variable declarations. (The debugger treats the local variable declarations as assignment statements because the variables are initialized by the compiler.)

-underflow_to_zero

When used with the -ieee option, directs the compiler to flush floating point underflows to zero.

-use_ld_input=filespec, -nouse_ld_input

[Tru64] use_ld_input directs the compiler to record the names of requested automatic template instantiation object files in a linker options file. By default, the compiler creates the linker options file with an appropriate name in the repository. If you specify the filespec parameter, the compiler uses that file specification and does not delete the file after compilation. On subsequent calls, the compiler begins linking with all all objects listed in the options file. To prevent inclusion of these objects, you can delete the options file.

[Tru64] The compiler then adds the linker options file to the ld command line using the ld -input file option. The default behavior is -use_ld_input.

[Tru64] -nouse_ld_input directs the compiler to record the names of requested automatic template instantiation object files on the command line so that you can determine the objects with which you are linking. However, if there are many object files, you might receive Arg list too long messages.

-v

Print the names of compiler phases as they execute, along with their arguments and input and output files.

[Tru64] This option also prints resource usage in the following format: user time, system time, total elapsed time, percentage use of CPU cycles.

-V

[Tru64] Enable printing of the compiler version.

[Linux] On Linux Alpha, compilation is not performed.

-verbose

Include identifiers with diagnostic messages. These identifiers can be used with #pragma message directives, or as arguments to -msg_disable options.

-version version

Specifies an alternative compiler version, where version is the compiler ident, for example V6.5-001.

-volatile

Compile all variables as volatile.

-vptr_size

Make 64 bits the default size of virtual function and virtual base pointers in a C++ class object (64 bits is the normal default). This option also enables #pragma pointer_size and passes -taso to the linker.

-vptr_size_short

Make 32 bits the default size of virtual function and virtual base pointers in a C++ class object. This option also enables #pragma pointer_size and passes -taso to the linker.

-w

Suppress warning and informational level compiler messages, but not back-end messages. Same as -w2.

-Wall

[Linux] Same as -w0

-w0

Display all levels of compiler messages.

-w1

Suppress information-level compiler messages. This is the default.

-w2

Suppress warning- and informational-level compiler messages, but not back-end messages. Same as -w.

-Wc[c...],arg1[,arg2...]

Passes the argument, or arguments (arg1), to the compiler pass, or passes c[c...]. Each c character can be one of the following: [abfklLnrxyz] (see the -t option for an explanation). The c selects the compiler pass in the same way as the -t option.

-x language

Cause all subsequent file names to be treated as langauge source files, regardless of their suffixes. This option applies to all following file names up to the next -x, except for files with the .a or .o suffixes. The compiler interprets the language parameter as follows:
Argument Effect
c [Linux] Cause all subsequent file names to be compiled as C source files
c++ [Linux] Cause all subsequent file names to be compiled as C++ source files
cxx Cause all subsequent file names to be compiled as C++ source files
none Cause all subsequent file names to be treated according to their file name suffixes, as explained in the Description section.

In the following example, files one.cxx and two.c will be compiled as C++ source files, and file three.c will compiled as a C source file:


cxx one.cxx -x cxx two.c -x none three.c 

The -x none option is the default.

Note that because -x without any arguments is a valid option for the ld command, the C++ driver passes the option to ld even if -x is not followed by any valid arguments.

-xref, -xref_stdout

[Tru64] Direct the compiler to generate a data file that the DEC FUSE Database Manager uses to create a cross-reference database file. This database file is used by the DEC FUSE C++ Class Browser, Call Graph Browser, and Cross-Referencer.

[Tru64] Specifying the -xref_stdout option directs the compiler to output the data file to standard output.

-xtaso

Enable #pragma pointer_size and pass -taso to the linker. Note that if -xtaso_short has set the default pointer size of the compilation unit to 32 bits (64 bits is the normal default), subsequently specifying -xtaso on the command line will not reset the pointer size.

-xtaso_short

Set the default pointer size of the compilation unit to 32 bits (for all pointers except virtual function and virtual base pointers). This option also enables #pragma pointer_size and passes -taso to the linker. The 'this' pointer size is unaffected by this option, it remains the system default pointer size, which is 64 bits.

-Zp[n]

Align structure members as specified by the value of n, which can be 1, 2, 4, or 8. This flag specifies packing so that each structure member after the first is stored on the n byte boundaries specified. Specifying Zp without any integer value causes structure members to be packed on 1-byte boundaries.

Optimization Options

The following are optimization options:

-accept [no]restrict_keyword

Specifying -accept restrict_keyword option causes the compiler to recognize the restrict keyword, which may be used to inform the compiler that the pointer has no aliases. This information is an assertion by the user to assist optimization. The compiler cannot detect erroneous assertions. The restrict keyword is mangled into function signatures when appropriate; you may overload a function based on the restrict keyword.

Specifying -accept norestrict_keyword option causes the compiler not to treat restrict as a keyword. This is the default.

You can also use __restrict to qualify pointers in all dialects except -std strict_ansi or -std strict_ansi_errors. This is useful in programs where restrict is used an identifier.

The -accept [no]restrict_keyword option is applicable only in the model ansi mode of the compiler.

-[no]ansi_alias

The -ansi_alias option directs the compiler to assume the ANSI C aliasing rules. By so doing, the compiler has the freedom to generate better optimized code.

If a program does not access the same data through pointers of a different type (and for this purpose, signed and qualified versions of an otherwise same type are considered to be the same type), then assuming ANSI C aliasing rules allows the compiler to generate better optimized code.

If a program does access the same data through pointers of a different type (for example, by a "pointer to int" and a "pointer to float"), you must not allow the compiler to assume ANSI C aliasing rules, because these rules can result in the generation of incorrect code.

The default is -ansi_alias.

-arch option

Specifies the version of the Alpha architecture for which to generate instructions. All Alpha processors implement a core set of instructions and, in some cases, the following extensions: BWX (byte- and word-manipulation instructions), MVI (multimedia instructions), FIX (square root and floating-point convert extension), and CIX (count extension). (The Alpha Architecture Reference Manual describes the extensions in detail.)

The option parameter determines which instructions the compiler can generate:
generic Generate instructions that are appropriate for all Alpha processors.
host Generate instructions for the processor on which the compiler is running (for example, EV56 instructions on an EV56 processor, and EV4 instructions on an EV4 processor).
ev4,ev5 Generate instructions for the EV4 processor (21064, 20164A, 21066, and 21068 chips) and EV5 processor (some 21164 chips), respectively. (Note that the EV5 and EV56 processors both have the same chip number - 21164.)

Applications compiled with this option do not incur incur any emulation overhead on any Alpha processor.

ev56 Generate instructions for EV56 processors (some 21164 chips). This option is the default.

This option permits the compiler to generate any EV4 instruction, plus any instructions contained in the BWX extension.

Applications compiled with this option can incur emulation overhead on EV4 and EV5 processors.

[Linux] Applications compiled with this option can incur "Illegal instruction" traps on EV4 and EV5 processors.

[Tru64] Applications compiled with this option can incur emulation overhead on EV4 and EV5 processors.

ev6 Generate instructions for EV6 processors (21264 chips).

This option permits the compiler to generate any EV56 instruction, plus any instructions contained in the MVI and FIX extensions.

[Linux] Applications compiled with this option can incur "Illegal instruction" traps on EV4, EV5, and EV56 processors.

[Tru64] Applications compiled with this option can incur emulation overhead on EV4, EV5, and EV56 processors.

ev67 Generate instructions for EV67 processors (21264a chips).

This option permits the compiler to generate any EV6 instruction, plus any instructions contained in the CIX extension.

[Linux] Applications compiled with this option can incur "Illegal instruction" traps on EV4, EV5, EV56, and EV6 processors.

[Tru64] Applications compiled with this option can incur emulation overhead on EV4, EV5, EV56, and EV6 processors.

pca56 Generate instructions for PCA56 processors (21164PC chips).

This option permits the compiler to generate any EV4 instruction, plus any instructions contained in the BWX or MAX extensions.

[Linux] Applications compiled with this option can incur "Illegal instruction" traps on EV4, EV5, and EV56 processors.

[Tru64] Applications compiled with this option can incur emulation overhead on EV4, EV5, and EV56 processors.

Note that -arch ev[x] implies -tune ev[x].

[Tru64] A program compiled with any of the options runs on any Alpha processor. Beginning with Version 4.0 of the operating system and continuing with subsequent versions, the operating system kernel includes an instruction emulator. This capability allows any Alpha chip to execute and produce correct results from Alpha instructions, even if some of the instructions are not implemented on the chip. Applications using emulated instructions run correctly, but can incur significant emulation overhead at run time.

[Tru64] The psrinfo -v command can be used to determine which type of processor is installed on any given Alpha system.

-assume option

Allow the compiler to make assumptions regarding certain alignments or code transformations. The following options are supported:

[no]accuracy_sensitive

Specify whether certain code transformations that affect floating-point operations are allowed. These changes may affect the accuracy of the program's results.

The accuracy_sensitive option directs the compiler to use only certain scalar rules for calculations. This setting can prevent some optimizations. This is the default. The -nofp_reorder option is a synonym for the -assume accuracy_sensitive option.

The noaccuracy_sensitive option frees the compiler to reorder floating-point operations based on algebraic identities (inverses, associativity, and distribution). This allows the compiler to move divide operations outside loops, for improved performance. The -fp_reorder option is a synonym for the -assume noaccuracy_sensitive option.

[no]aligned_objects

The aligned_objects option causes the compiler to assume that a dereferenced object's alignment matches or exceeds the alignment indicated by the pointer to the object. This is the default. On Alpha systems, dereferencing a pointer to a longword- or quadword-aligned object is more efficient than dereferencing a pointer to a byte- or word-aligned object. Therefore, when the compiler assumes that a pointer object of an aligned pointer type does point to an aligned object, it can generate better code for pointer dereferences of aligned pointer types.

The noaligned_objects option flag causes the compiler to generate longer code sequences to perform indirect load and store operations in order to avoid hardware alignment faults for arbitrarily aligned addresses. Although this flag may generate less efficient code than the aligned_objects option, by avoiding hardware alignment faults, it speeds the execution of programs that reference unaligned data.

[no]array_parameter_restricted_pointers

Specifies whether all array parameters are restricted. The default is -assume noparameter_restricted_pointers. For more information, see -assume [no]restricted_pointers.

[no]ignore_restricted_pointers

Specifies whether the restricted attribute is ignored for all pointers. The default is -assume noignore_restricted_pointers. For more information, see -assume [no]restricted_pointers.

[no]parameter_restricted_pointers

Specifies the assumption that all pointers are or are not restricted. The default is -assume norestricted_pointers. For more information, see -assume [no]restricted_pointers.

[no]restricted_pointers

Specifies whether all pointers are assumed to be restricted. The default is -assume norestricted_pointers. For more information, see -assume [no]restricted_pointers.

For the sample declaration


foo(int * __restrict p1, int p2[], int * p3, int **p4); 

the following apply:

  • By default, only p1 is restricted.
  • If you specify -assume array_parameter_restricted_pointers, p1 and p2 are restricted.
  • If you specify -assume parameter_restricted_pointers, p1, p2, p3 and p4 are restricted, but *p4 is not restricted.
  • If you specify -assume restricted_pointers, p1, p2, p3, p4, and *p4 are restricted.
  • If you specify -assume ignore_restricted_pointers, no pointers are restricted, not even p1.

Each of these assumptions is negatable independently by prefixing a no to the assumption name. By default, all of the assumptions are in this negated state. The state of each assumption is resolved separately by processing negations in left-to-right order. For example, -assume norestricted_pointers -assume restricted_pointers is resolved to -assume restricted_pointers.

At the same time, the four assumptions have strictly-increasing strength in the order shown, such that the behavior is determined only by the strongest assumption in effect at the end of the command line, regardless of their relative placement. Thus if -ignore_restricted_pointers is in effect, the state of any other assumption is ignored. For the other assumptions, this "strength" effect is a natural result of supersetting.

The -assume norestricted_pointers option disables the __restrict keyword from all pointers. This can help detect inappropriate use of __restrict. If the code works correctly at high optimization with __restrict0 turned off, but fails with it turned on, it is likely that the compiler encountered a pointer that was restricted in error. Restricted pointers are an assertion by the programmer to aid optimization; the compiler cannot detect erroneous assertions.

gfullpath

When compiling with the -g option, causes the compiler to insert the full pathname into the object file.

[no]math_errno

Controls the compiler's assumption about a program's dependence on the setting of errno by math library routines:

By default (-assume math_errno) the compiler assumes that the program might interrogate errno after any call to a math library routine that is capable of setting errno. The definition of the ANSI C math library allows programs to depend on this behavior, which unfortunately restricts optimization because this causes most math functions to be treated as having side effects.

Specifying -assume nomath_errno instructs the compiler to assume that the program does not look at the value of errno after calls to math functions. This assumption allows the compiler to reorder or combine computations to improve the performance of those math functions that it recognizes as intrinsic functions. In practice, robust floating-point code seldom relies on errno to detect domain or range errors, so -assume nomath_errno can often be safely used to improve performance.

[no]ptrs_to_globals

Controls whether the compiler can safely assume that global variables have not had their addresses taken in code that is not visible to the current compilation.

The default is ptrs_to_globals, which directs the compiler to assume that global variables have had their addresses taken in separately compiled modules and that a pointer dereference in the module could be accessing the same memory as a global variable. This is often a significant barrier to optimization.

While the -ansi_alias option allows some resolution based on data type, ptrs_to_globals provides significant additional resolution and improved optimization in many cases.

noptrs_to_globals tells the compiler that any global variable accessed through a pointer in the compilation unit must have had its address taken within that compilation unit. The compiler can see any code that takes the address of an extern variable. If it does not see the address of the variable being taken, the compiler can assume that no pointer within this compilation unit points to the variable.

[no]trusted_short_alignment

Control the alignment assumptions for code generated for indirect load and store instructions.

The trusted_short_alignment option indicates that the compiler should assume any short accessed through a pointer is naturally aligned. This generates the fastest code, but can silently generate the wrong results when an unaligned short object crosses a quadword boundary.

The notrusted_short_alignment option tells the compiler that short objects might not be naturally aligned. The compiler generates slightly larger (and slower) code that will give the correct result, regardless of the actual alignment of the data. This is the default.

The notrusted_short_alignment option does not override the __unaligned type qualifier or the -assume noaligned_objects option.

[no]whole_program

Asserts to the compiler that except for "well-behaved library routines", the whole program consists only of the single object module being produced by this compilation. The optimizations enabled by whole_program include all those enabled by nopointer_to_globals, and possibly other optimizations.

The default is nowhole_program.

-fast

The -fast option defines the following compiler options and symbols to improve run-time performance. Note that this option overrides all conflicting options specified before it. You can adjust the optimizations by specifying the negation of any given option after the -fast option.


-ansi_alias, -assume nomath_errno, 
-assume trusted_short_alignment, -D_INTRINSICS, 
-D_INLINE_INTRINSICS, -D_FASTMATH, -fp_reorder, 
-intrinsics, -O3, -readonly_strings, -arch host 

Note that the -fast option can produce different results for floating-point arithmetic and math functions, although most programs are not sensitive to these differences.

-[no]inline keyword

Specifies whether to provide inline expansion of functions. The -noinline flag disables the inlining optimization that would otherwise be performed by default under the following compiler optimization (-O[n]) flags:


-O2, -O3, or -O4 

You can specify one of the following as the keyword to control inlining:
all Inline every call that can be inlined while still generating correct code. Recursive routines, however, do not cause an infinite loop at compile time.
manual Inline only those function calls explicitly requested for inlining by an inline keyword. This is the default when compiling with the -O1 flag.
none Do not do any inlining. This is the default when compiling with the -O0 optimization level.
size Inline all of the function calls in the manual category, plus any additional calls that the compiler determines would improve run-time performance without significantly increasing the size of the program. This is the default when compiling with either the -O2 or the -O3 flag.
speed Inline all of the function calls in the manual category, plus any additional calls that the compiler determines would improve run-time performance, even where it may significantly increase the size of the program.

For optimization level 0 (-O0) the -inline flag is ignored and no inlining is done.

-[no]fp_reorder

The -fp_reorder option is a synonym for the -assume noaccuracy_sensitive option. The -nofp_reorder option is a synonym for the -assume accuracy_sensitive option.

See the description of the -assume [no]accuracy_sensitive option for details.

-[no]intrinsics

The -intrinsics option causes the compiler to recognize intrinsic functions wherever it can automatically, based only on name and call signature. Unlike -D_INTRINSICS, this option can treat library function calls as intrinsic even when the appropriate header file is not included. Any function declaration or call site (in the case of implicit declaration) with a name matching the name of an intrinsic function is examined to see if its parameters and return result are consistent with the intrinsic function of that name. If so, calls are treated as being intrinsic. If not, a diagnostic is issued and calls are treated as ordinary external function calls.

When the compiler identifies a function as an intrinsic function, it is then free to make code optimizations (transformations) based on what it knows about the operations performed by the standardized version of that function--given an optimization level ( -On ) that enables the intrinsic treatment of that particular function.

The optimization level determines which functions can be treated as intrinsics:
-O0 or -O1 No intrinsic functions. The -intrinsics option has no effect at this optimization level.
-O2 (or -O) Memory and string functions: alloca, bcopy, bzero, memcpy, memmove, memset, strcpy, strlen
Math functions: abs, fabs, labs, atan, atan2, atan2f, atand, atand2, atanf, ceil, ceilf, cos, cosd, cosf, floor, floorf, sin, sind, sinf,
-fast (due to its supplying -assume nomath_errno, and -O3,) acos, acosd, acosf, asin, asind, asinf, cosh, coshf, exp, expf, log, log10, log10f, logf, log2, log2f, pow, powf, sqrt, sqrtf, sinh, sinhf, tan, tand, tanf, tanh

The -intrinsics option is in effect by default. To disable the default, specify the -nointrinsics option. To disable the intrinsic treatment of individual functions, specify the function names in a #pragma function directive in your source code.

[Tru64] Although -intrinsics is the default (and it generally treats calls to [f]printf as intrinsic), to have the low-level support routines for intrinsic [f]printf inlined, the compilation must include and also specify both -D_INTRINSICS and -D_INLINE_INTRINSICS on the command line.

-D_INTRINSICS

[Tru64] Affects the compilation of some system header files, causing them to compile #pragma intrinsic directives for certain functions that they declare. The exact functions affected can vary depending on the language mode and other macro definitions. See the header files math.h, stdio.h, stdlib.h, string.h, and strings.h for details. The exact effect of each #pragma intrinsic varies by function, by optimization options, and by other compile-time options. The basic effect is to inform the compiler that the function specified in the pragma is the one by that name whose behavior is known to the compiler (that is, it is a standard C or commonly-used library function rather than a user-written external function). This gives the compiler license to perform additional checks on the usage of the function and issue diagnostics, and to optimize and/or rewrite calls to it based on the compiler's understanding of what the function does. Some possible optimizations include generating complete inline code, generating partial inline code with calls to one or more different functions, or just using characteristics of the function to move the call site or avoid some of the overhead triggered by an external call.

-D_INLINE_INTRINSICS

[Tru64] Affects the compilation of stdio.h in two ways:
  • Whenever the header file would otherwise define getc and putc as preprocessor macros expanding into code to access the _cnt and _ptr members of the referenced FILE object directly, instead these macros are defined to invoke inlined static functions defined in the header file. The use of an inlined static function instead of a simple macro prevents the argument from being evaluated more than once (so arguments containing side effects do not cause a problem), and the function generally will produce better code because it uses local declarations to avoid aliasing assumptions that the compiler has to make when analyzing the traditional macro expansions of getc and putc. Note that getc and putc are not expanded inline when i/o locking is required, as is normally the case for reentrant or thread-safe compilations.
  • If -D_INTRINSICS was also specified, making printf and fprintf intrinsic functions, then certain of the low-level runtime support routines that may be called for special cases of format strings are defined as inline static functions in the header file, avoiding external calls to these routines in libc.

-O[n]

Determine the level of optimization, as follows:
Option Optimization
-O0 No optimization.
-O1 Optimization with space as the primary criterion. This is the default if no optimization option is specified.
-O2 Optimization with time as the primary criterion. This is the default if you specify -O without a level number.
-O3 Enables inline expansion of C global functions.
-O4, -O5 Additional global optimizations that improve speed at the cost of extra code size. -O4 and -O5 have the same effect.

[Tru64] In addition to affecting the generated code, the -O level is passed on to ld and is used by both ld and -om (if -om is specified).

The general guidelines for optimization are as follows:

  • If the speed of the generated code is more important than code size, specify -O (same as -O2). In some cases, -O4 may produce faster code. Using inline all at -O or -O4 can inline more calls (particularly calls to constructors) and improve speed, but this option can increase the code size for some programs beyond an acceptable limit. If you are potentially interested in this option, you should build your program both with and without the option and compare the code size.
  • If the size of the generated code is more important than speed, some experimentation may be necessary to determine the best optimization option. Whereas -O1 (default if an optimization level is not specified) is intended to optimize for code size, in some cases code that is compiled with -O (or -O2) to optimize for speed may actually be smaller. Also try -O -unroll 1 to see whether a smaller size is generated. Using -unroll 1 disables a loop unrolling optimization and generally reduces the code size when -O is used. You might also try compiling with the -noinline option both with and without -O to see whether a reduction in code size occurs.

Other options that can affect run-time size and speed are -non_shared and [Tru64] -om.

When you use -g for best debugging, optimizations are suppressed. Thus, when comparing the effects of different optimization levels, you should not specify -g or -g2. For such comparisons, specify -g0 which suppresses debugging information.

-om

[Tru64] Perform code optimization after linking, including nop (NoOperation) removal, .lita removal, and reallocation of common symbols. This flag also positions the global pointer register so the maximum addresses fall in the global pointer-accessible window. The -om flag is supported only for programs compiled with the -non_shared flag. The following options can be passed directly to -om by using the -WL compiler flag. Note that some flags that improved performance on older Alpha processors now primarily degrade performance on EV56 and later Alpha processors.

-WL,-om_compress_lita

Remove unused .lita entries after optimization, and then compress the .lita section.

-WL,-om_dead_code

Remove dead code (unreachable instructions) generated after applying optimizations. The .lita section is not compressed by this flag.

-WL,-om_ireorg_feedback,file

Use the pixie-produced information in file.Counts and file.Addrs to reorganize the instructions to reduce cache thrashing.

-WL,-om_no_inst_sched

Disable instruction scheduling.

-WL,-om_no_align_labels

Disable alignment of labels. Normally, the -om flag quadword-aligns the targets of all branches to improve loop performance.

-WL,-om_Gcommon,num

Set size threshold of "common" symbols. Every "common" symbol whose size is less than or equal to num will be allocated close to each other. This flag can be used to improve the probability that the symbol can be accessed directly from the global pointer register. Normally, the -om flag causes the compiler to try to collect all "common" symbols together.

-tune option

Select processor-specific instruction tuning for implementations of the operating system architecture. Using the -tune option causes the generated code to run correctly on all implementations of the architecture. Tuning for a specific implementation may improve run-time performance; however, code tuned for a specific target may run slower on another target. For a list of options, see the description of -arch .

Note that -tune ev[x] does not imply -arch ev[x]. Unlike -arch, -tune does not cause instruction emulation or illegal instructions on any Alpha architecture.

-unroll n

Control loop unrolling done by the optimizer. n signifies the number of times to unroll loop bodies. Specifying zero for n tells the optimizer to use its own default unroll amount. This is the default. Note that the argument n is only a suggestion to the optimizer.

Preprocessor Options

The following command options control the action of the preprocessing phase:

-cpp

Run the preprocessor on the source files before compiling. This is the default.

-C

Prohibit the preprocessor from removing comments in the source file. (Use with the -E or -M option.)

-Dname=def, -Dname

Define name to the preprocessor, as if the line #define name def were prepended to the C++ source file. There can be a space between the option and name. If name or def contains a dollar sign ($), they must be surrounded by apostrophes ('). If no =def is given, the name is defined as 1.

-E

Run only the preprocessor on the source files (regardless of whether a suffix exists), and send the result to the standard output. This sets the -cpp option.

-I

Do not search for #include files in the standard directories. Because -I can be followed by a directory, do not place a nondirectory file name on the command line immediately following -I. If -I is being used without a directory, follow it with another option or place it at the end of the command line to avoid misinterpretation.

-Idir

Define the directory name dir to the preprocessor for use in searching for quoted and angle-bracketed include files. There can be a space between the option and dir. The preprocessor searches for include file names that do not begin with a slash (/) in the following order:

Quoted file names:

  1. In the directory containing the source file with the #include directive.
  2. In the directories specified by the -I option.
  3. In the /usr/include/cxx, /usr/include/cxx_cname, and /usr/include directories on Tru64 UNIX, and in the /usr/include directory on Linux Alpha.

On Tru64 UNIX, angle-bracketed files are searched for in the list of directories specified on the command line, then in the /usr/include/cxx, /usr/include/cxx_cname, and /usr/include directories, respectively.

If -nocurrent_include is specified, the preprocessor does not search in the directory containing the source file (#1 above).

-M

Run only the compiler on the source files (regardless of whether a suffix exists), and produce makefile dependencies instead of the usual output. For each source file, the preprocessor creates one makefile entry naming the object file and listing all included files as dependencies. To identify correctly the template implementations on which the source depends, the compiler parses and analyzes the source; the source must be a valid C++ program. To disable this analysis, specify the -noimplicit_include option. This option is preferred to the deprecated -Em option.

-MD

Produce a dependency file, which has the suffix .d appended to the object file name. This dependency file is created even if the object file is not. The information and the format in the dependency file is identical to that produced by the -M flag. The -MD flag allows dependency information to be generated at the same time that a compilation is occurring.

-MDffilename

Same as the -MD option, except that dependencies are written to the specified file. If multiple sources are compiled, on the last source's dependencies are saved in the file.

-nocurrent_include

Do not search for quoted include files in the directory containing the source file with the #include line. The preprocessor searches the directories specified by the -I option and in the standard directory. See also the -Idir option.

-P

Run only the preprocessor and put the result for each source file in a corresponding .ixx file, without including line numbers. If specified after -E a .ixx file is not created. If specified before -E it overrides -E.

-Uname

Cancel any command-line definition of name to the preprocessor, as if the line #undef name were prepended to the C++ source file. There can be a space between the option and name. If name contains a dollar sign ($), name must be surrounded by apostrophes ('). The undefine operation occurs after any definitions produced by the -D options.

Language Mode Options

The cxx command supports the following Language Mode options. For detailed information about language modes, see Porting to HP C++ in Using HP C++ for Tru64 UNIX and Linux Alpha .

-std ansi

Use this option if you want an ANSI C++ compiler that supports some commonly used extensions and is somewhat less strict than the standard. This is the default compiler mode. If you find that the compiler generates too many diagnostics in this mode, you can use the -msg_quiet option to relax error checking. This option also defines the __STD_ANSI macro.

-std arm

Use this mode if you want to compile programs developed Using HP C++ Version 5.n and want to minimize source changes. This option also defines the __STD_ARM macro. Note that 'arm' refers to The Annotated C++ Reference Manual by Ellis and Stroustrup, 1990 edition.

If you usually want your compilations done in this mode and don't want to specify -std arm on each cxx command, define the environment variable DEC_CXX as follows: setenv DEC_CXX "-std arm"

-std cfront

This option is retired with Version 7.1 of the compiler.

-std gnu

Use this option if you want to compile programs developed using the GNU compiler. This option also defines the __STD_GNU macro and the namespace std .

The following changes in behavior are provided for compatibility with the GNU C++ compiler:

  • The -timplicit_local and -no_implicit_include options are enabled by default. The -tweak template mode more closely resembles the behavior of G++ on Linux. This mode is not enabled by default because of limited testing. If your code is portable across platforms, you will probably not notice the subtle difference between -tweak and -timplicit_local, the current default.
  • Digraphs are accepted by default. They can be disabled using the -noalternative_tokens option.
  • Access control is not enforced for types defined inside a class.
  • Unrecognized character escape sequences in string literals produce an informational instead of a warning message.
  • The __inline keyword is enabled and is equivalent to inline .
  • The severity of the error "incompatible parameter" (tag incompatibleprm ) is reduced to warning.
  • The severity of the error for incompatible exception specification for virtual function is reduced to warning.
  • When overloading, enum types are treated as integral types.
  • Templates can be explicitly instantiated in a namespace that is different from the namespace in which the template is defined.
  • Zero length arrays are permitted as the last element in an aggregate.
  • The compiler does not support the GNU pragmas interface and implementation.

The following known incompatibilities are not addressed in the -std gnu mode:

  • The compiler strictly enforces the requirement to define functions before they are used. This requirement also applies to built-in functions such as strlen .
  • The g++ compiler treats namespace std as a special case. Not only is the namespace predeclared, it is almost as if it is an alias for the global namespace. This is non-standard behavior with which HP C++ makes no attempt to be compatible. Although GCC provides the undocumented -fhonor-std option to disable the aliasing, namespace std is still declared.
  • Long symbol names are truncated at 1024 characters.
  • HP C++ does not support variable length arrays.
  • The compiler does not support the G++ extension for the minimum ( <? ) and maximum ( >? ) operators.

-std ms

Use this option if you want the compiler to accept additional Microsoft Visual C++ extensions. This option also defines the __STD_MS macro.

-std strict_ansi

Use this option if you want the compiler to enforce the ANSI C++ standard strictly. The default ANSI mode permits some common extensions and provides less strict error checking than the STRICT_ANSI mode. This option also defines the __STD_STRICT_ANSI and __PURE_CNAME macros.

Note

In their strict ansi modes, both the C and C++ compilers accept 0, 1, 2, or 3 parameters for function main. Both compilers display a message if you specify single parameter or more than two parameters.

-std strict_ansi_errors

Use this option if you want strict_ansi and also want errors to be issued for all ANSI violations. -std strict_ansi reports warnings for some ANSI violations. This option also defines the macros __PURE_CNAME and __STD_STRICT_ANSI_ERRORS.

Message Information and Control Options

The cxx command supports the following message control options.The options apply only to discretionary, warning, and informational messages. The tag variable can be the keyword all, a tag obtained from the -msg_display_tag option, or a number obtained from the -msg_display_number option.

-msg_inform tag,...

Reduce message(s) severity to informational.

-msg_warn tag,...

Reduce message(s) severity to warning.

-msg_error tag,...

Increase message(s) severity to error.

-msg_enable tag,...

Enable specific messages that would normally not be issued. You can also use this option to re-enable messages disabled with -msg_disable.

-msg_disable tag,...

Disable message. Can be used for any non-error message.

-msg_quiet

Be more like Version 5.n error reporting. Fewer messages are issued using this option. This is the default in arm mode. All other modes default to -nomsg_quiet. The -msg_enable option can be used with this option to enable specific messages normally disabled using -msg_quiet.

The cxx command supports the following message information options. Both are off by default.

-msg_display_number

Displays the error number at the beginning of each message. Note that "D" (meaning discretionary) indicates that the severity of the message can be controlled from the command line. The message number can be used as the tag in the message control options. If "D" is not displayed with the message number, any attempt to control the message is ignored.

-msg_display_tag

Displays a more descriptive tag at the end of each message. "D" indicates that the severity of the message can be controlled from the command line. The tag displayed can be used as the tag in the above message control options. Note that you can also change the severity of a diagnostic message if the message is discretionary. For example, -msg_inform 110 changes the severity of message 110 to an informational. These options interact with -w0 -w1 and -w2.

Standard Library Options

The following are Standard Library options. For detailed information about the Standard Library, see The C++ Standard Library in Using HP C++ for Tru64 UNIX and Linux Alpha .

-[no]global_array_new

Controls whether calls to global array new and delete are generated as specified by ANSI. Pre-ANSI global array new generated calls to operator new() and operator delete() . According to ANSI, use of global array new generate calls to operator new()[] and operator delete()[] . This option also defines the macro __GLOBAL_ARRAY_NEW.

The -global_array_new option generates calls to operator new()[] for global array new expressions such as new int[4]; this is the default when compiling with the -std ansi, -std gnu, -std strict_ansi, -std strict_ansi_errors, and -std ms options.

The -noglobal_array_new option generates calls to operator new() for global array new expressions such as new int[4] and preserves compatibility with V5.n; this is the default when compiling with the -std arm option. Note that 'arm' refers to The Annotated C++ Reference Manual by Ellis and Stroustrup, 1990 edition.

-nocxxstd

Instructs the driver not to include libcxxstd.a when linking.

-nolibcxx

Instructs the driver not to include (libcxx.a) when linking.

-nopreinst

Force the standard library template instantiations in the user's repository to be preferred at link time over the ones in the standard library. This is useful, for example, if you want debugging versions of the instantiations. This option is only useful when used in conjunction with -D__FORCE_INSTANTIATIONS.

-D__FORCE_INSTANTIATIONS

Forces the standard library template preinstantiations to be created in the user's repository. Normally these instantiations are suppressed because the library already contains them.

-D__[NO_]USE_STD_IOSTREAM

Use or don't use the standard iostreams. If -D__USE_STD_IOSTREAM is specified, this forces the inclusion of the ANSI standard version of the iostream header file. This is the default in strict_ansi and strict_ansi_errors mode of the compiler. Otherwise the pre-standard AT&T-compatible version of iostreams is used.

-rpath path, -norpath

The -rpath option is passed to the linker with its argument. The path string is a colon-separated list of directories that is meaningful to the linker only when creating an executable with shared linkage. For further details about his option, see the ld(1) reference page.

By default, the cxx command passes the location of the Standard Library directory to ld as an argument to -rpath. The linker then searches for the shared version of the Class Library in the path specified by the compiler.

If you do not want this behavior, use the -norpath option. An application produced using -norpath uses the installed C++ libraries at run time. This is the default on Tru64 UNIX 4.0G or higher and on Linux Alpha. The -norpath option does not affect any user-specified -rpath options.

-[no]stdnew

Controls whether calls are generated to the ANSI or pre-ANSI implementation of the operator new() . On memory allocation failure, the ANSI implementation throws std::bad_alloc while the pre-ANSI implementation returns 0.

The -stdnew option generates calls to the ANSI new() implementation; this is the default when compiling -std ansi, -std gnu, -std strict_ansi, and -std strict_ansi_errors. This option also defines the __STDNEW macro.

The -nostdnew option generates calls to the pre-ANSI new() implementation; this is the default when compiling -std arm and -std ms.

For information about overriding ANSI new(), pre-ANSI new(), or both, see the discussion in the C++ Standard Library chapter of Using C++ for HP Tru64 UNIX Systems.

-use_non_shared_libcxx

[Tru64] Instructs the driver to use the non-shared version of libcxx.

-[no]use_system_libcxx

[Tru64] The -nouse_system_libcxx instructs the driver not to link with the default shared C++ libraries installed on the system. The -use_system_libcxx option implies -norpath. This is the default for Tru64 UNIX Version 4.0G and higher.

-use_shared_libcxxstd

[Tru64] Instructs the driver to link with the shared C++ Standard Library libcxxstd.so instead of its archived counterpart libcxxstd.a. Linking with libcxxstd.a is the default. The -use_shared_libcxxstd option is ignored if any of the following options is specified: -nolibcxx, -use_system_libcxx, -non_shared or -use_non_shared_libcxx.

As is the case for the archived C++ Standard library, the C++ Standard library specified by the C++ driver on the link command depends on the -model and -nopreinst options and can be any of the following: libcxxstd.so, libcxxstd_noinst.so, libcxxstd_noinstma.so or libcxxstdma.so.

-[no]using_std

Controls whether standard library header files are processed as if the compiled code were written:


#include <header> 
using namespace std; 

This option is provided for compatibility for users who do not want to qualify use of each standard library name with std:: or put "using namespace std" at the top of their sources.

-using_std turns implicit using namespace std on; this is the default when compiling -std arm, -std ms, -std gnu, or -std ansi.

-nousing_std turns implicit using namespace std off; this is the default when compiling -std strict_ansi or -std strict_ansi_errors.

This option also defines the __IMPLICIT_USING_STD macro.

To access the Standard Library reference pages, type man cxxstdlib_intro.

To access the Class Library reference pages, type man cxxlib_intro.

[Tru64] Precompiled Header Options

The cxx command supports the following precompiled header options. For detailed information about precompiled headers, see Using HP C++ for Tru64 UNIX and Linux Alpha.

-create_pch file-name

If other conditions are satisfied, create a precompiled header file with the specified name. If -pch (automatic PCH mode) or -use_pch appears on the command line following this option, the last option is used. This option also defines the __PCH_ENABLED macro.

-pch

Automatically use and/or create a precompiled header file. -use_pch or -create_pch (manual PCH mode) appears on the command line following this option, the last option is used. This option also defines the __PCH_ENABLED macro.

-pch_dir dir

Specifies the directory in which to search for and/or create a precompiled header file. This option can be used with automatic PCH mode (-pch) or manual PCH mode (-create_pch) or -use_pch.

-[no]pch_messages

Enable or disable the display of a message indicating that a precompiled header file was created or used in the current compilation. The default is -pch_messages.

-use_pch file-name

Use a precompiled header file of the specified name as part of the current compilation. If -pch (automatic PCH mode) or -create_pch appears on the command line following this option, the last option is used. This option also defines the __PCH_ENABLED macro.

Template Options

HP C++ includes various template instantiation modes that control when, where, and how a template is instantiated:

  • Manual instantiation, automatic instantion, or both
  • Placing templates in the output object or into a repository
  • Using local or external linkage
  • As needed or complete instantiation

A C++ program can cause the compiler to perform a template instantiation in two ways: explicitly or implicitly. A template instantiation is explicitly requested by using #pragma define_template, #pragma instantiate, or an explicit instantiation request (see Stroustrup, section C.13.10). A template instantiation is implicitly requested by simply using the template. Requesting a template instantiation explicitly is referred to as manual instantiation, while the process by which the compiler instantiates implicit requests is referred to as automatic template instantiation.

When a template is manually instantiated, it is completely instantiated. For a template class, a complete instantiation means all its member functions and static data members are instantiated even if they were not used. Automatically instantiated templates may optionally be completely instantiated.

Each of the following modes is mutually exclusive. Only one should be specified on the command line:

-pt

Automatically instantiate templates into the repository with external linkage. Manually instantiated templates are placed in the output object with external linkage. This option is the default.

-tused

Similar to -pt, except that automatically instantiated templates are placed in the output object.

-tused_repository

Similar to -pt, except that manually instantiated templates are placed in the repository.

-nopt

Disable automatic template instantiation. Manually instantiated templates are placed in the output object with external linkage.

-define_templates
-tall

Automatically instantiate templates completely and place them in the output object with external linkage. Manually instantiated templates are also placed in the output object with external linkage.

-tall_repository

Same as -tall except that all instantiations are placed in the repository instead of the output object. This option is useful for creating a pre-instantiation library.

-tlocal

Instantiate templates automatically, placing them in the output object with internal linkage. Manually instantiated templates are also placed in the output object with internal linkage. This option provides a simple mechanism for getting started with templates, but it has a number of limitations. Because the templates have local storage, they must be instantiated in every module that uses them, and code bloat could occur. In addition, a variable that would otherwise have a single global copy can instead have many local copies that do not share the same state.

-timplicit_local

Same as -tlocal, except that manually instantiated templates are placed in the repository with external linkage. This is useful for build systems that need to have explicit control of the template instantiation mechanism. This mode can suffer the same limitations as -tlocal. The mode is the default when -std gnu is specified.

-tweak

Same as -timplicit_local, but automatically instantiated templates receive weak linkage. Weak linkage resembles external linkage, except that duplicate symbols do not result in a link error. The linker simply chooses one of the symbols. To suppress the linker diagnostics about multiple diagnostics of weak symbols, you may specify -Wl,-S on the command-line but this has the effect of suppressing all linker warnings and informationals. While compiling with -tweak can still result in code bloat, it avoids the problem of having multiple copies of the same variable not sharing the same state. Specifying -tweak automatically implies -preempt_symbol, but you may override this by specifying -preempt_module on the command-line.

The -tweak template mode more closely resembles the behavior of G++ on Linux. For details, see the description of the -std gnu option.

The cxx command supports the following additional options for the instantiation of templates:

-pending_instantiations n

Limit the depth of recursive instantiations so that infinite instantiation loops can be detected before some resource is exhausted. -pending_instantiations requires a positive non-zero value n as argument and issues an error when n instantiations are pending for the same class template. The default value for n is 64.

-ttimestamp

Used with automatic instantiation. Causes automatic instantiation to instantiate templates only if they are not already in the repository, or if the existing instantiations in the repository are older than the timestamp in the repository.

-Hf

Stops the cxx command after the prelinker runs and before the final link. Provided for compatibility with previous versions of C++. This option has no effect with the Version 6.n compiler.

-[no]implicit_include

Effective only with Version 6.0 and later. Enable or disable inclusion of source files as a method of finding definitions of template entities. Implicit inclusion is enabled by default, and it is disabled when compiling with -E or -P. The search rules for finding template definition files are the same as for include files. This option also defines the macro __IMPLICIT_INCLUDE_ENABLED. You might want to disable implicit inclusion with the -ms and -std ms options to match the behavior on Microsoft C++ more closely.

-nopragma_template

Directs the compiler to ignore any #pragma define_template directives. This option is provided for users who want to migrate quickly to automatic instantiation without having to remove all the pragma directives from their code base.

-ptr dir

Specifies a repository, with ./cxx_repository as the default. If you specify several repositories, only the first is writable, and the rest are read only. Read-only reposi- tories are used only at link time. Specifying this option at link time enables C++ to recognize and use the template instantiation information files within the specified repository. If you use this option, make sure that the repository specified at compile time is the same one specified at link time.

-ptsuf

Specifies a list of file name suffixes that are valid for template definition files. Items in the list must be separated by commas and each suffix preceded by a period. A suffix may have no more than eight characters excluding the beginning period. The default is ".cxx,.CXX,.C,.cc,.CC,.cpp,.c".

-ptv

Turns on verbose or verify mode to display each phase of instantiation as it occurs. This option is useful as a debugging aid.

Deprecated Options

Deprecated options fall into two groups:

  1. Options superseded by newer alternatives:

    -cfront

    This option was replaced by -std cfront, which in turn is retired as of Version 7.1 of the compiler.

    -Em

    Run only the preprocessor on the source files (regardless of whether a suffix exists), and produce makefile dependencies instead of the usual output. For each source file, the preprocessor creates one makefile entry naming the object file and listing all included files as dependencies. Use -M instead.

    -Hf

    Stops the cxx command after the prelinker runs and before the final link. Provided for compatibility with previous versions of C++. When compile-time instantiation is used, this option performs prelinking, but no templates are instantiated. Use
    -Hx instead.

    -migrate

    This option was provided for backward compatibility and is no longer supported. To pass this option to the C compiler, use -Wk,-migrate instead.

    -noinline_auto

    Compile only inline functions that are explicitly declared to be inline. Use -inline manual instead.

    -ms

    Interpret source programs according to some language conventions followed by Microsoft's Visual C++ implementation. This option also defines the __MS macro. Use -std ms instead.

    -oldcxx

    [Tru64] Invoke a bug fix update to the Version 5.7 compiler. This option is provided for cases where the Version 6.0 compiler requires excessive source changes or for problems in using the Version 6.0 compiler. If extensive source changes are required to correct errors, try using the -std arm option. For excessive warnings, try the -msg_quiet option. If you want -oldcxx to be the default, define the DEC_CXX environment variable as follows:


    setenv DEC_CXX "-oldcxx" 
    

    Note

    The Version 5.7 compiler's lack of support for 128-bit long doubles can cause crashes on Tru64 UNIX and Linux Alpha Version 5.0 or later. This compiler will not be included in future kits.

    -threads

    [Tru64] Direct the linker to use the thread-safe version of any library specified with the -l flag when linking programs. This flag also tells the linker to include both the DECthread interfaces that are conformant with POSIX 1003.4a Draft 4. The flag is supported only for compatibility with earlier releases of the operating system. New designs should use the -pthread flag. This option also defines the _PTHREAD_USED_D4 and _REENTRANT macro.
  2. Options available only to Version 5.n compilers (-oldcxx only)

    -check

    Perform compile-time code checking. With this option, the compiler checks for code that exhibits nonportable behavior, represents a possible unintended code sequence, or possibly affects program operation because of a quiet change in the language standard. Some of these checks traditionally have been associated with the lint utility.

    -nocpp

    Do not run the preprocessor on the source files before compiling. If both -nocpp and -cpp are included on the command line, the option specified last is in effect. If -P or -E is specified, -nocpp has no effect.

    -pts

    Direct the compiler to instantiate needed C++ templates automatically. Each member function or static data member is instantiated in its own separate file. This option has no effect on C++ Version 6.0 and later.

Examples

This section provides usage examples.


% cxx -g -DUSE_CONCENTRATOR -o netmud netmud.cxx 

This example creates an executable file named netmud with symbol table information for full symbolic debugging using (-g). The -D option defines the macro name USE_CONCENTRATOR for the preprocessor.


% cxx -o gfview -I/usr/kafka/src -I/usr/barnes/include gfview.cxx 

The above command line creates an executable file from the gfview.cxx source file. The -o option names the output file gfview. The -I option directs the preprocessing phase to search the specified directories for include files not found in the current working directory.


% cxx -c io_module.cxx 

This example preprocesses and compiles the source file io_module.cxx and produces an object file named io_module.o. Processing stops after creating the object file.


% cxx -o newsreader io_module.o ui.cxx -L/users/dave -lnews 

This example creates an executable file, and the -o option names the file newsreader. The source file ui.cxx is preprocessed and compiled, and then linked with the object file io_module.o. The link operation uses the library specified by -l (libnews.a). The linker first looks for the library in the current working directory, then in the directory specified by -L (/users/dave), and finally in the linker's default library search path.

[Tru64]


% cxx -pg a.cxx b.cxx -nopg c.cxx 

This command line enables gprof profiling for files a.cxx and b.cxx and disables profiling for file c.cxx.

Diagnostics

The error messages produced by the cxx compiler are self-explanatory. The line number and file name where the error occurred are printed along with the diagnostic.
Files  
file.cxx C++ source code input file
file.o Object file
a.out Default output file
/usr/include
/usr/include/cxx
Standard directories for include files

See Also

[Tru64] asctime(3), cxxlib_intro(3), cxxstdlib_intro(3), demangle(1), [Tru64] ladebug(1), ld(1),
[Tru64] pixie(1), [Tru64] prof(1), [Tru64] what(1), and the Tru64 UNIX Programmer's Guide.


Privacy statement Using this site means you accept its terms
© 2005 Hewlett-Packard Development Company, L.P.