|
You can specify command-line options to the aCC command. They allow you
to override the default actions of the compiler. Each option begins
with either a - or a + sign. Any number of options can be interspersed
anywhere in the aCC command and they are typically separated by blanks.
Unless exclusively specified, these options are supported by both, C and C++ compilers.
This section discusses the following topics:
|
| Command-Line Options Listed Alphabetically |
|
| Options to Control Code Generation |
The following options allow you to control what kind of code the compiler generates:
- -Ae - compile C source code
- -c - compile one or more source files without entering the linking phase
- +DA[architecture] - generate object code for a particular version of the PA-RISC architecture. Also specify which version of the HP-UX math library to use
- +DO[osname] - sets the target operating system for the compiler; intended for enabling optimizations that are not backward compatible
- +DDdata_model - generate object code for either the ILP32 or LP64 data model.
- +DSmodel - perform instruction scheduling tuned for a particular architecture.
- +k - generate code for programs that use a large number of global data items in shared libraries
- -S - compile to assembly language without linking
- -tmtarget - compile code for optimization with a specific machine architecture
- +z - generate position-independent code (PIC) to go into a shared library
- +Z - generate position-independent code (PIC) to go into a shared library
-c Command-Line Option
The -c option is used to compile one or more source files with out entering the linking phase.
When compiled, the compiler produces an object file (a file ending with .o) for each
source file (a file ending with .c, .C, .s, or .i).
Note that you must eventually link object files before they can be executed.
Example:
aCC -c sub.C prog.C
In this example, the compiler compiles sub.C and prog.C and puts the
relocatable object code in the files sub.o and prog.o respectively.
+DA[architecture] Command-Line Option
architecture can be one of the following:
Note: See the /opt/langtools/lib/sched.models file for a list of model numbers and their PA-RISC architecture designations.
The +DA[architecture] command-line option generates object code for a particular version of the PA-RISC architecture. Also specifies which version of
the HP-UX math library to link in when you have specified -lm. (See the HP-UX Floating-Point Guide for more
information about using math libraries.)
Note: Object code generated for PA-RISC 2.0 will not execute on PA-RISC 1.1 systems.
To generate code compatible across PA-RISC 1.1 and 2.0 workstations and servers, use the +DAportable option.
For best performance use +DA with the model number or architecture where you plan to execute the program.
If you do not specify a +DA option, the default code generation is based on that of the system on which you compile.
If you specify neither a +DA nor a
+DS option, default instruction scheduling
is based on that of the system on which you compile. If you do specify a +DA option and do not specify a
+DS option, default instruction scheduling is based on what you specify in +DA, and not based on
that of the system on which you compile.
For example, specify +DA1.1 and do not specify +DS, and instruction scheduling will be
for 1.1. Specify +DAportable and do not specify +DS, and instruction scheduling will be for
1.1. (+DAportable is currently equivalent to +DA1.1.)
Example:
The following examples generate code for various architectures, as noted:
- aCC +DA1.1 prog.C (PA-RISC 1.1)
- aCC +DA867 prog.C (PA-RISC 1.1)
- aCC +DA2.0 prog.C (PA-RISC 2.0)
- aCC +DA2.0W prog.C (64-bit wide mode for PA-RISC 2.0)
- aCC +DAportable prog.C (compatible across 1.1 and 2.0 workstations and servers)
For more information:
- Compiling for Different Versions of the PA-RISC Architecture
- See the file /opt/langtools/lib/sched.models for model numbers and their architectures.
Use the command uname -m to determine the model number of your system.
Compiling for Different Versions of the PA-RISC Architecture
The instruction set on PA-RISC 2.0 is a superset of the instruction set on PA-RISC 1.1. Code generated for HP 9000
PA-RISC 1.1 systems will run on HP 9000 PA-RISC 2.0 systems, though possibly less efficiently than if it were specifically
generated for PA-RISC 2.0.
Code generated for PA-RISC 2.0 will not run on PA-RISC 1.1 systems.
Using +DA to Generate Code for a Specific Version of PA-RISC
When you use the +DA option depends on your particular circumstances.
- If you plan to run your program on the same system where you are compiling, you don't need to use +DA.
- If you plan to run your program on one particular model of the HP 9000 and that model is different from the one
where you compile your program, use +DAarchitecture with the model number of the target system.
- For example, if you are compiling on a 720 and your program will run on an 855, use +DA855.
- If you plan to run your program on PA-RISC 2.0 and 1.1 models of the HP 9000, use +DAportable.
Compiling in Networked Environments
When compiles are performed using diskless workstations or NFS-mounted file systems, it is important to note that
the default code generation and scheduling are based on the local host processor. The system model numbers of the
hosts where the source or object files reside do not affect the default code generation and scheduling.
+DO[osname] Command-Line Option
This option sets the target operating system for the compiler, and is
intended for enabling optimizations that are not backward compatible.
For instance, the 11.23 compiler introduces new optimized math library
functions that require library support not available in prior operating
systems. +DO option can be used at any level of optimization.
The default value
for osname is the operating system version on which the compiler is invoked.
The syntax for this option is +DOosname, where osname is one of :
Example:
The following example generates code for the HP-UX 11.22 (or later)
operating system. Binary incompatible features introduced in later
OS versions are inhibited.
aCC +DO11.22 +O3 app.C
+DDdata_model Command-Line Option
This option specifies the data model for the compiler.
data_model can be one of the following:
- 32 (this generates ILP32 code and is the default)
- 64 (this generates LP64 code)
| ILP32 Data Model |
LP64 Data Model |
- The size of an int, long, or pointer data type is 32 bits.
- The preprocessor predefined macro _ILP32 is defined.
|
- The size of an int data type is 32 bits. The size of a long or pointer data type is 64 bits.
- The preprocessor predefined macro, __LP64__ is defined. Also __LP64__ and _LP64.
|
Examples:
- The following example generates code for the 64-bit data model:
aCC +DD64 app.C
- The following example generates code for the 32-bit data model:
aCC app.C
+DSmodel Command-Line Option
+DSmodel
model can be either a model number of an HP 9000 system (such as 725,
890, or G40), PA-RISC architecture designation 1.1 or 2.0, or one of the
PA-RISC processor names such as PA7000, PA7100,
PA7100LC, or PA8000. See the file /opt/langtools/lib/sched.models for model numbers and
processor names.
Performs instruction scheduling tuned for a particular implementation of the
PA-RISC architecture.
Object code with scheduling tuned for a particular model will
execute on other HP 9000 systems, although possibly less efficiently.
If you specify neither a +DA nor a +DS option, default instruction
scheduling is based on that of the system on which you compile.
If you do specify a +DA option and do not
specify a +DS option,
default instruction scheduling is based on what you
specify in +DA, and not based on that of the system on which you compile.
For example, specify +DA1.1 and do not specify +DS, and
instruction scheduling will be for 1.1. Specify +DAportable
and do not specify +DS, and instruction scheduling will be for 1.1.
(+DAportable is currently equivalent to +DA1.1.)
If you plan to run your program
on both PA-RISC 1.1 and 2.0 systems, use the
+DS2.0 designation.
Examples:
+DS720: Performs instruction scheduling tuned for one implementation of PA-RISC 1.1.
+DS745: Performs instruction scheduling for another implementation of PA-RISC 1.1.
+DSPA8000: Performs instruction scheduling for systems based on the PA-RISC 8000 processor.
For More Information:
Using +DS to Specify Instruction Scheduling
Instruction scheduling is different on different implementations
of PA-RISC architectures. You can improve performance on a particular model
or processor of the HP 9000 by requesting that the compiler use instruction
scheduling tuned to that particular model or processor. Using scheduling for
one model or processor does not prevent your program from executing on
another model or processor.
By default, the compiler performs scheduling tuned for the system on which you
are compiling, or, if specified, tuned for the setting of the
+DA option.
Use the +DS option to change this default behavior and
to specify instruction scheduling tuned to a particular
implementation of PA-RISC. For example, to specify instruction scheduling
for the model 867, use +DS867. To specify instruction scheduling for the
PA-RISC 8000 processor, use +DSPA8000. See the file
/opt/langtools/lib/sched.models for model numbers and processor names.
When you use the +DS option depends on your particular circumstances.
- If you plan to run your program on the same system where you are compiling,
you don't need to use the +DS option. The compiler
generates code tuned for your system.
- If you plan to run your program on one particular model of the HP 9000 and
that model is different from the one where you compile your program, use
+DSmodel with either the model number of the target system or
the processor name of the target system.
For example, if you are compiling on a system with a PA7100 processor and your
program will run on a system with a PA7100LC processor, you can use
+DSPA7100LC. This will give you the best performance
on the PA7100LC system.
Compiling in Networked Environments
When compiles are performed using diskless workstations or NFS-mounted
file systems, it is important to note that the default code generation
and scheduling are based on the local host processor. The system model
numbers of the hosts where the source or object files reside do not
affect the default code generation and scheduling.
+k Command-Line Option
By default, the HP aC++ compiler generates short-displacement code sequences for programs that reference global data in shared libraries. For nearly all programs this is sufficient.
If your program references a large amount of global data in shared libraries, the default code generation for referencing that global data may not be sufficient. If this is the case, when you link your program the linker gives an error message indicating that you need to recompile with the +k option. The +k option generates long-displacement code sequences so a program can reference large amounts of global data in shared libraries. Use +k only when the linker generates a message indicating you need to do so.
Example:
aCC +k prog.C mylib.sl
Compiles prog.C, generates code for accessing a large number of global data items in the shared library mylib.sl,
and links with mylib.sl.
+Olit Command-Line Option
+Olit=level
This option places the data items that do not require load time or runtime initialization in a
read-only data section.
The defined values for level are:
| all |
All string literals and all const-qualified variables that do not require
load-time or run-time initialization will be placed in a read-only data
section. +Olit=all replaces the deprecated +ESlit option. |
| none |
No constants are placed in a read-only data section. +Olit=none replaces
the deprecated +ESnolit option. |
+Olit=all is the default.
+Oprofile Command-Line Option
+Oprofile=[use|collect|prediction:static]
This option instructs the compiler to instrument the object code for collecting run-time profile
data. The profiling information can then be used by the linker to perform profile-based
optimization.
Using prediction:static selects static branch prediction for the
executable. This is a synonym for
+Ostatic_prediction.
+Oprofile=collect is equivalent to +I.
+Oprofile=use[:filename] causes the compiler to look for
a profile database file. This option overrides the FLOW_DATA environment variable.
It is equivalent to +df and +P.
After compiling and linking with +Oprofile=collect, run the resultant program using
representative input data to collect execution profile data. Finally, recompile with the
+Oprofile=use option to perform profile-based optimization.
Profile data is stored in flow.data by default. See the +Oprofile=use:filename
option for information on controlling the name and location of this data file.
Example:
aCC +Oprofile=collect -O -c prog.C
aCC +Oprofile=collect -O -o prog.pbo prog.o
Compiles prog.C with optimization, prepares the object code for data collection, and creates the executable file prog.pbo. Running prog.pbo collects run-time information in the file flow.data in preparation for optimization with +Oprofile=use.
+Oprofile=collect [:<qualifiers>]
In the absence of <qualifiers>, +Oprofile=collect is same as +I.
<qualifiers> are a comma-separated list of profile collection qualifiers.
The following table lists the supported profile collection qualifiers:
| arc |
Enable collection of arc counts (synonym to +Oprofile=collect). This is the default value.
|
| stride |
Enable collection of stride data. |
| all |
Enable collection of all types of profile data. This is equivalent to
+Oprofile=collect:arc,stride. This is the default. |
Interactions and dependencies are not changes with respect to +Oprofile=collect.
+O[no]static_prediction Command-Line Option
+O[no]static_prediction
This option enables [disables]the static branch prediction.
This optimization can occur at optimization
levels 2, 3, and 4. This option is allowed as an amplifier
to +P. It is silently ignored when used with +I.
The default is +Onostatic_prediction.
+tmtarget Command-Line Option
+tmtarget specifies the target machine architecture for which compilation is to be performed.
Using this option causes the compiler to perform architecture-specific optimizations. target takes one of the
following values:
- K7200 to specify K-Class servers using PA-7200 processors
- K8000 to specify K-Class servers using PA-8000 processors
- V2200 to specify V2200 servers
Using the +tm target option implies +DAarchitecture and +DSmodel settings as
described in the following table:
| specified target value |
+DAarchitecture implied |
+DSmodel implied |
| K7200 |
1.1 |
1.1 |
| K8000 |
2.0 |
2.0 |
| V2200 |
2.0 |
2.0 |
Note:If you specify +DA or +DS on the aCC command line, your setting takes precedence over the setting implied by +tm target.
Usage:
Use +tm target at optimization levels 0, 1, 2, 3, and 4. The default target value corresponds to the
machine on which you invoke the compiler.
+z Command Line Option
Causes the compiler to generate position-independent code (PIC),
necessary for building a shared library.
Use -b to create a shared library.
+z is similar to the +Z option.
Use +z
unless the linker generates an error message indicating that you should
use +Z.
The -G option is ignored if either +z or
+Z is used.
Example:
aCC -c +z utils.C
Compiles utils.C and generates position-independent code in utils.o.
utils.o can be placed into a shared library with the -b option.
For More Information:
For more information on shared libraries, see the tutorial
Creating and Using Shared Libraries and the
HP-UX Online Linker and Libraries User's Guide.
+Z Command Line Option
Causes the compiler to generate position-independent code (PIC), necessary
for building shared libraries.
Use -b to create a shared library.
+Z is the same as the +z option except that it allows
for more imported symbols than does +z.
Use the +Z option only if errors are generated when you use +z.
The -G option is ignored if either +z
or +Z is used.
64-bit Mode Only:
+Z is the default when +DA2.0W is specified.
|
| Data Alignment and Storage |
Use the following options for default data strorage and alignment:
- +hugesize=n - Set the threshold for huge data.
- +unum - Allows pointers to access non-natively aligned data.
- -fshort-enums - Allocates only as many bytes as required for the enum type.
- +rodata_array_init - memory efficient initialization for local arrays
For more information:
+hugesize=n Command Line Option
+hugesize=n[M][K]
-
The maximum of n * the modifier is .5 GB.
Thus n ranges from 1 to 500000.
A reasonable value of n * modifier would be at least 32 Mb.
-
M indicates megabytes.
-
K indicates kilobytes.
M or K are optional specifiers. If neither is specified, the default is K.
This option is intended to allow you to lower the threshold for huge data.
In order for the compiler to qualify a data object as huge, its size must
equal or exceed the current setting of the hugesize threshold.
The threshold is initially set to
.5 gigabytes (2^29 bytes).
A data object whose size equals or exceeds the threshold is allocated in
huge data subspace.
The number of elements that can be declared in an array depends on the
data type of the array.
The following table lists current object size limits in 32-bit (narrow) mode:
| Data Structure |
Maximum Number of Elements in an Array of this Type |
| char arrays |
2^28 |
| float and 32-bit integer arrays |
(2^28)/4 |
| double and 64-bit integer arrays |
(2^28)/8 |
| long double arrays |
(2^28)/16 |
| structs/unions |
based on element size |
Note that limits in 64-bit mode are based on hardware, OS or resource
limitations.
The compiler itself allows higher limits.
Refer also to Default Data Storage and Alignment
Usage:
The compiler puts all small arrays into a separate subspace.
An application
with too many small arrays may run out of subspace creating an overflow
condition. In this case linking fails. One way to solve this problem
is to lower the hugesize threshold so that any array greater than or
equal to the threshold (in bytes) is put into the huge data subspace instead.
Example:
The following example lowers the threshold to 2^23 bytes (8 megabytes)
resulting in more data objects being put in huge data subspace.
aCC +DA2.0W +hugesize=8M app1.C app2.C
For More Informaiton:
+unum Command Line Option
+unum
The +u option allows pointers to access non-natively aligned data.
This option alters the way that the compiler accesses dereferenced data. Use of this option may
reduce the efficiency of generated code. num can be specified as:
- 1
-
Assume single byte alignment. Dereferences are performed with a
series of single-byte loads and stores.
- 2
-
Dereferences are performed with a series of two-byte loads and stores.
- 4
-
Dereferences are performed with a series of four-byte loads and stores.
Example:
aCC +u1 app.C
Default Data Storage and Alignment
This section describes default data storage allocation and alignment for
HP compiler data types. Data storage refers to the size of data types,
such as bool, short, int, float,
and char*.
Data alignment refers to the way the HP compiler aligns data
structures in memory. Data type alignment and storage differences
can cause problems when moving data between systems that have
different alignment and storage schemes. These differences
become apparent when a structure is exchanged between systems
using files or inter-process communication. In addition, misaligned
data addresses can cause bus errors when an attempt is made to
dereference the address.
The following table lists the sizes and alignments of the HP
compiler data types:
| Data Type |
Size (in bytes) |
Alignment |
| bool |
1 |
1-byte |
| char, unsigned char, signed char |
1 |
1 |
| wchar_t |
4 |
4 |
| short, unsigned short, signed short |
2 |
2 |
| int, unsigned int |
4 |
4 |
| long, unsigned long |
4* |
4* |
| float |
4 |
4 |
| __float80 |
16 |
16 |
| __float128 |
16 |
16 in +DD64. 8 otherwise. |
| double |
8 |
8 |
| long double |
16 |
8** |
| long long, unsigned long long |
8 |
8 |
| enum |
4 |
4 |
| arrays |
size of array element type |
alignment of array element type |
| struct |
*** |
1-, 2-, 4-, 8-, or 16-byte |
| union |
*** |
1-, 2-, 4-, 8-, or 16-byte |
| bit-fields |
size of declared type |
alignment of declared type |
| pointer |
4* |
4* |
| * |
In 64-bit mode, long, unsigned long, and pointer data
types are 8 bytes long and 8-byte aligned.
|
| ** |
In 64-bit mode, long double is 16-byte aligned.
|
| *** |
struct and union alignment is the same as the strictest alignment
of any member. Padding is done to a multiple of the alignment size.
|
|
-fshort-enums Command Line Option
-fshort-enums
This command-line option allocates only as many bytes as required for the declared
range of possible values to an enum type. The enum type is equivalent to the smallest
integral type, which has enough memory space for the declared enumerator range.
Note: Using -fshort-enums causes the compiler to generate code that may be binary
incompatible with the code generated without this option. To generate compatible code,
do not use or define external enumerators (defined or used in other source files or shared
libraries) that are compiled without this option.
+rodata_array_init Command Line Option
+rodata_array_init
The +rodata_array_init option enables memory efficient initialization for local arrays.
When you use this option, the compiler allocates the local array initializers (that it
generates for initialized local arrays) to the read-only data section.
By default, these initializers are allocated to the data section.
Note: If the array is initialized with addresses, this option can cause
an increase in run time. The increase is based on the number of addresses in the
array initializer and the number of times the array is initialized.
This overhead is normally negligible.
|
| Debugging Options |
The following debugging options enable you to use the HP WDB Debugger:
- +d - Disable all inlining of functions
- -g - Generate minimal information for debugging
- -g0 - Generate full information for debugging
- -g1 - Generate minimal information for debugging
- +[no]objdebug - Generate debug information in object files and not in the executable
+d Command-Line Option
This option prevents the expansion of inline functions. It is useful when you are
debugging your code because you cannot set breakpoints at inline functions.
This option defeats inlining thereby allowing you to set breakpoints at
functions specified as inline. See +inline_level for the default.
Also see:
+O[no]inline Command-line option
-g Command-Line Option
The -g option causes the compiler to generate minimal
information for the debugger. It uses an algorithm that attempts to
reduce duplication of debug information.
To suppress expansion of inline functions, use the +d option.
Also see:
Difference between -g, -g0 and -g1
When to Use -g, -g0, or -g1
-g, -g1 Algorithm
HP WDB Debugger Documentation
-g0 Command-Line Option
The -g0 option causes the compiler to generate complete
debug information for the debugger.
To suppress expansion of inline functions use the +d option.
-g1 Command-Line Option
Like the -g option, -g1 causes the compiler to
generate minimal information for the debugger. It uses an
algorithm that attempts to reduce duplication of debug information.
To suppress expansion of inline functions use the +d option.
Difference between -g, -g0 and -g1
The -g, -g0, and -g1 options all generate
debug information. The difference is that the -g0 option
emits full debug information about every class referenced in a file,
which can result in some redundant information.
The -g and -g1 options emit a subset of this
debug information, thereby decreasing the size of your object file.
If you compile your entire application with -g or -g1 no
debugger functionality is lost.
Note: If you compile part of an application with -g
or -g1 and part with debug off, (that is, without
-g, -g0, and -g1 options) the resulting executable may
not contain complete debug information. You will still be able to
run the executable, but in the debugger, some classes may
appear to have no members.
When to Use -g, -g0, or -g1
Use -g or -g1 when you are compiling your entire application
with debug on and your application is large, for example,
greater than 1 megabyte.
Use -g0 when either of the following is true:
-
You are compiling only a portion of your application with
debug on, for example, a subset of the files in your application.
-
You are compiling your entire application with debug on
and your application is not very large, for example, less
than 1 megabyte.
-g, -g1 Algorithm
In general, the compiler looks for the first non-inline,
non-pure (non-zero) virtual function in order to emit debug
information for a class. If there are no virtual member functions,
the compiler looks for the first non-inline member function.
If there are no non-inline member functions, debug information
is always generated. A problem occurs if all functions are inline; in this case, no debug information is generated.
+[no]objdebug Command-Line Option
This option generates [does not generate] debug information in object files and not in the
executable. The HP WDB debugger then reads the object files to construct debugging
information. +objdebug is not compatible with the HP DDE debugger.
Note: With +objdebug, the object files or archive
libraries must not be removed.
+noobjdebug is the default at compile time and is the same as versions of the compiler prior to A.01.15. +objdebug is the default at link time.
If +noobjdebug is used at link time, all debug information
goes into the executable, even if some objects were compiled with
+objdebug. This can be used to enforce the debugging paradigm prior to HP aC++ version A.01.15.
If +objdebug is used at compile time, extra debug
information is placed into each object file to help the debugger
locate the object file and to quickly find global types and constants.
Usage:
Use +objdebug option to enable faster links
and smaller executable file sizes for large applications, rather
than +noobjdebug where debug information is written
to the executable.
Use +noobjdebug with the -g, -g0, or -g1.
For More Information
See the Linker and WDB Debugger documentation.
-g, -g1 Algorithm Now it is possible to debug code optimized at +O2 in 64-bit (wide) mode using HP aC++. Use the compilation option -g +O2 +DD64 to achieve this.
Earlier, DOC was available only in 32-bit (narrow) mode.
|
| Warnings and Error Handling |
Use the following options to control how potential errors in your code are detected and handled.
- +p - Disallows all anachronistic constructs
- -w - Suppresses all compiler warning messages
- +w - Warns about all questionable constructs
- +Wargs - Selectively suppress compiler warnings
- +Weargs - Selectively interpret warnings or future errors as errors
- +Wwargs - Selectively treats compiler warnings as warnings
+p Command-Line Option
This option disallows all anachronistic constructs.
Normally, the compiler gives warnings about anachronistic constructs.
Using the +p option, the compiler gives errors for
anachronistic constructs.
Example:
aCC +p file.C
This command compiles file.C and gives errors for all
anachronistic constructs rather than just giving warnings.
-w Command-Line Option
This option suppresses all warning messages. By default, the compiler
reports all errors and warnings.
Example:
aCC -w file.C
This command compiles file.C and reports errors, but does
not report any warnings.
+w Command-Line Option
This option warns about all questionable constructs and gives pedantic warnings. The default is
to warn only about constructs that are almost certainly problems.
For example, this option warns you when calls to inline functions
cannot be expanded inline.
aCC +w file.C
This command compiles file.C and warns about both
questionable constructs and constructs almost certainly problematic.
+Wargs Command-Line Option
+Warg1[,arg2,..argn]
This option selectively suppresses any specified warning messages.
arg1 through argn are valid compiler warning
message numbers.
Example:
aCC +W600 app.C
+Weargs Command-Line Option
+Wearg1[,arg2,..,argn]
This option selectively interprets any specified warning or future
error messages as errors. arg1 through argn are valid compiler warning
message numbers.
Example:
aCC +We 600,829 app.C
+wn Command-Line Option
This option specifies the level of the warnings messages.
+w{1|2|3}
The value of n can be one of the following:
| 1 |
All warnings are issued. This includes low level warnings
that may not indicate anything wrong with the program. |
| 2 |
Only warnings indicating that code generation might
be affected are issued. This is equivalent to the compiler
default without the -w option. |
| 3 |
No warnings are issued. This is equivalent to
the -w option. This option is the same as -W c and -wn. |
+wsecurity Command-Line Option
This option enables compile time diagnostics for potential security violations.
Warnings are emitted for cases where untrusted (tainted) data may reach
a critical reference point in the program. This is based on cross-module
analysis performed by the compiler. Hence, the +wsecurity option implicitly
enables a limited form of cross module analysis, even if -ipo or +O4 options
are not specified. This may lead to a significant increase in the compile
time compared to a build without the +wsecurity option. Using this option may
result in the compiler invoking optimizations other than those which are part
of the user specified optimization level. If +wsecurity is used in addition
to -ipo or +O4, the generated code is not affected and the compile time
does not increase much.
NOTE: The +wsecurity option is only supported for IPF.
-->
+Wwargs Command-Line Option
+Wwarg1[,arg2,..,argn]
This option selectively treats compiler suggestions as warnings.
arg1 through argn are valid compiler message numbers.
Conflicts between +W, +Ww and +We are resolved
based on their severity. +We is the highest and +W is the lowest.
|
| Exception Handling |
By default, exception handling is in effect. To turn
off exception handling, you must use the following option.
+noeh Command-Line Option
+noeh
This option disables exception handling. By default, exception handling is on.
To turn off exception handling, you must use this option. With exception handling
disabled, the keywords throw and try generate an error.
Note that if your application throws no exceptions, code compiled with and without +noeh can be mixed freely. However, the mixing of code compiled with and without +noeh in an application that throws exceptions is unsupported.
Example:
aCC +noeh progex.C
This command compiles and links progex.C, which does
not use exception handling.
See Exception Handling for more information.
|
| Extensions to the Language |
The following option supports extensions to the C++ language.
- -ext - Enable HP value added features.
-ext Command-Line Option
-ext
When you specify -ext, you enable the following HP aC++
extensions to the C++ standard:
- Enable 64-bit integer data type support for:
- long long (signed 64-bit integer)
- unsigned long long (unsigned 64-bit integer)
Use this option to declare 64-bit integer literals and for
input and output of 64-bit integers.
-
Enable #assert, #unassert preprocessor directives allowing
you to set a predicate name or predicate name and token to
be tested with a #if directive.
Note: When using -ext, specify it at both compile time and link time.
Example:
aCC -ext foo.C
This command compiles foo.C, which contains a long long declaration.
#include <iostream.h>
void main(){
long long ll = 1;
cout << ll << endl;
}
|
| Floating Point Processing Options |
The following command line options are used for floating point processing:
# +FP[flags]
This option specifies how the runtime environment for floating
point operations should be initialized at program startup and
used at link time.
The following flags are supported. Upper case enables the flag, lower case disables the flag.
| V (v) |
Trap on invalid floating-point operations |
| Z (z) |
Trap on divide by zero |
| O (o) |
Trap on floating-point overflow |
| U (u) |
Trap on floating-point underflow |
| I (i) |
Trap on floating-point operations that produce inexact results. |
| D (d) |
Enable sudden underflow (flush to zero) of denormalized values. |
The default is that all trapping behaviors are disabled.
The # value specifies the rounding mode. For floating point
operations, you can specify one of the following rounding modes:
| RN |
Round to nearest. This is the default value. |
| RU |
Round upward towards +infinity. |
| RD |
Round downward toward -infinity |
| RZ |
Round toward zero, that is, truncate. |
|
| Header File Options |
The following is a list of header file options:
- -H - Dumps the include file hierarchy to stderr.
- -Idirectory - Add directory to the directories to be searched for #include files
- -I- - Override the default -Idirectory search-path.
- +m[d] and +make[d] - Output quote enclosed (" ") make(1) dependency files to stdout or to a .d file.
- +M[d] and +Make[d] - Output both quote enclosed and angle bracket enclosed (< >) make(1) dependency files to stdout or to a .d file.
For More Information:
-H Command-Line Option
-H file
The -H option prints the order and hierarchy of the include files to stderr so that the preprocessed
compiler output indicates the include file nesting.
-Idirectory Command-Line Option
-Idirectory
directory is the HP-UX directory where the compiler looks for header files.
During the compile phase, this option adds directory to the
directories to be searched for #include files during
preprocessing.
During the link phase, this option adds directory to the
directories to be searched for #include files by the
link-time template processor.
For #include files that are enclosed in double quotes
(" ") within a source file and do not begin with a /, the
preprocessor searches in the following order:
- The directory of the source file containing the #include.
- The directory named in the -I option.
- The standard include directories /opt/aCC/include and /usr/include.
For #include files that are enclosed in angle brackets (< >), the preprocessor searches in the following order:
- The directory named in the -I option.
- The standard include directories /opt/aCC/include and /usr/include.
(The current directory is not searched when angle brackets (< >) are used with #include.)
Example:
aCC -I /opt/aCC/include/SC file.C
This example directs HP aC++ to search in the directory /opt/aCC/include/SC for #include files.
-I- Command-Line Option
[-Idirs] -I- [-Idirs]
[-Idirs] indicates an optional list of -Idirectory specifications in
which a directory name cannot begin with a hyphen (-) character.
This option allows you to override the default -Idirectory search path.
This feature is called view-pathing. Specifying -I- serves two purposes:
-
It changes the compiler’s search-path for quote enclosed (" ")
file names in a #include directive to the following order:
- The directory named in the -I option.
- The standard include directories /opt/aCC/include and /usr/include.
The preprocessor does not search the directory of the including file.
-
It separates the search-path list for quoted and angle-bracketed include files.
Angle-bracket enclosed file names in a #include directive are searched for only
in the -I directories specified after -I- on the command-line.
Quoted includes are searched for in the directories that both precede
and follow the -I- option.
The standard aCC include directories
(/usr/include and /opt/aCC/include)
are always searched last for both types of include files.
Usage:
View-pathing can be particularly valuable for medium to large sized projects. For example, imagine that a project comprises two sets of directories. One set contains development versions of some of the headers that the programmer currently modifies. A mirror set contains the official sources.
Without view-pathing, there is no way to completely replace the default -Idirectory search-path with one customized specifically for project development.
With view-pathing, you can designate and separate official directories from development directories and enforce an unconventional search-path order. For quote enclosed headers, the
preprocessor can include any header files located in development directories and, in the absence of these, include headers located in the official directories.
If -I- is not specified view-pathing is turned off. This is the default.
Examples:
With view-pathing off, the following example obtains all quoted include files from dir1 only if
they are not found in the directory of a.C and from dir2 only if they are not found in dir1.
Finally, if necessary, the standard include directories are searched. Angle-bracketed includes
are searched for in dir1, then dir2, followed by the standard include directories.
aCC -Idir1 -Idir2 -c a.C
With view-pathing on, the following example searches for quoted include files in dir1 first
and dir2 next, followed by the standard include directories, ignoring the directory of a.C.
Angle-bracketed includes are searched for in dir2 first, followed by the standard include
directories.
aCC -Idir1 -I- -Idir2 -c a.C
Note:
Some of the compiler’s header files are included using double quotes. Since the
-I- option redefines the search order of such includes, if any standard headers
are used, it is your responsibility to supply the standard include directories
(/opt/aCC/include* and /usr/include) in the correct order in your -Icommand
line.
For example, when using -I- on the aCC command line, any specified -I
directory containing a quoted include file having the same name as an HP-UX
system header file, may cause the following possible conflict.
In general, if your application includes no header having the same name as an
HP-UX system header, there is no chance of a conflict.
Suppose you are compiling program, a.C, with view-pathing on. a.C includes the
file a.out.h which is a system header in /usr/include:
aCC -IDevelopmentDir -I- -IOfficialDir a.C
If a.C contains:
// This is the file a.C
#include <a.out.h>
// ...
When a.out.h is preprocessed from the /usr/include directory,
it includes other files that are quote included
(like #include "filehdr.h").
Since with view-pathing, quote enclosed headers are not searched for in the
including file’s directory, filehdr.h which is included by a.out.h will not be
searched for in a.out.h’s directory (/usr/include).
Instead, for the above command line, it is first searched for in
DevelopmentDir, then in OfficialDir and if
it is found in neither, it is finally searched
for in the standard include directories
(/opt/aCC/include* and /usr/include) in the
latter of which it will be found.
However, if you have a file named filehdr.h in DevelopmentDir
or OfficialDir, that file (the wrong file) will be found.
|
| Online Help Option |
Use the online help option to view the HP aC++ Online Programmer’s Guide.
+help Command-Line Option
+help
This option invokes the main page (index.htm) of this HP aC++/HP C Online Programmer's Guide.
If +help is used on any command line, the compiler
displays the HP aC++/HP C Online Programmer's Guide with the default
web browser and then processes any other arguments.
If $DISPLAY is set, the default web browser is used.
If the display variable is not set, set your $DISPLAY variable
as follows:
export DISPLAY=YourDisplayAddress (ksh/sh shell notation)
setenv DISPLAY YourDisplayAddress (csh shell notation)
Example:
To use a browser other than the default, first set the BROWSER
environment variable to the alternate browser’s location:
export BROWSER=AlternateBrowserLocation
To invoke the online guide, use the command:
aCC +help
|
| Inlining Options |
The following options allows you to specify the amount of source code inlining done by the HP aC++ compiler:
- +d - Disables all inlining functions.
- +inline_level - Allows you to specify the amount of source code inlining done by the HP aC++ compiler.
+inline_level[i] num Command-Line Option
+inline_level [i]num
This option controls how C++ inlining hints influence HP aC++.
Such inlining happens in addition to explicitly inlined functions. By default, this option is off.
Specifying i causes implicit inlining of small functions.
Specify num as 0, 1, 2, or 3. Refer to the tables below.
Note that +d and +inline_level 0 turn off all inlining, including implicit inlining
| num |
Description |
| 0 |
No inlining is done (same effect as the +d option). |
| 1 |
Only small functions are inlined. |
| 2 |
Only large functions are not inlined. |
| 3 |
Inlining hints are respected in all cases, except when the called function is recursive or when it has a variable number of arguments. |
The default level depends on +Oopt as shown in the following table:
| level |
num |
| 0 |
1 |
| 1 |
1 |
| 2 |
2 |
| 3 |
2 |
| 4 |
2 |
Note: This option controls functions declared with the inline keyword or within the class declaration and is effective at all optimization levels.
The options +O[no]inline and +Oinlinebudget control the high level optimizer that recognizes other opportunities in the same source file (+O3) or amongst all source files (+O4).
Example:
aCC +inline_level 3 app.C
See Also:
|
| Library Options |
The following library options allow you to create, use, and manipulate libraries:
- -AA - Enable use of Rogue Wave Standard C++ Library 2.02.01 and set all standards related options on.
- -AP - Turns off -AA mode and uses the older C++ runtime libraries
- +A - Causes the linker to link with archive libraries.
- -b - Creates a shared library.
- +k - Generate code for programs that use a large number of global data items in shared libraries.
- -lname - Specifies a library for the linker to search.
- -Ldirectory - Specifies a directory for the linker to search for libraries.
- +nostl - Suppresses searching of default -I and -L directory paths and some -l libraries.
- -Wx,args - One use of -W is to specify linking of shared or archive libraries.
- +z - Generate position-independent code (PIC) to go into a shared library.
- +Z - Generate position-independent code (PIC) to go into a shared library.
See Also:
+A Command-Line Option
+A
This option causes the linker to link with archive libraries
rather than shared libraries and creates a completely archived
executable.
This option causes the linker ld(1) to use only archive libraries
for all occurrences of the -l option. Also inform the
C++ run-time environment that no shared libraries will
be used by the program.
Note: Cannot be used when calling shl_load(3) directly
or indirectly.
The -a,archive linker option also links archive libraries but it links the shared library /usr/lib/libdld.sl. +A links in /opt/aCC/lib/cxxshl.o instead of /usr/lib/libdld.sl.
In 64-bit mode, /opt/aCC/lib/cxxshl.o is not used.
Example:
aCC +A file.o -lm
Links file.o and links in the archived version of the math library, /lib/libm.a, rather than the shared version, /lib/libm.sl, and does not link in /usr/lib/libdld.sl.
See Also:
-b Command-Line Option
-b
This option creates a shared library rather than an executable file.
The object files must have been created with the +z or +Z option to generate position-independent code (PIC).
Example:
aCC -b utils.o -o utils.sl
This command links utils.o and creates the shared library utils.sl.
For more information on shared libraries, refer to
Creating and Using Libraries, and the HP-UX Online Linker and Libraries User's Guide.
-lname Command-Line Option
-lname
The name parameter forms part of the name
of a library the linker searches for when looking for routines
called by your program.
This option causes the linker to search one of the following
default libraries, if they exist, in an attempt to resolve
unresolved external references:
- /usr/lib/libname.sl
- /usr/lib/libname.a
- /opt/langtools/lib/libname.sl
- /opt/langtools/lib/libname.a
Whether it searches the shared library (.sl) or the
archive library (.a) depends on the value of the -a
linker option or the +A compiler option.
Note:
Because a library is searched when its name is encountered, placement of a -l is significant. If a file contains an unresolved external reference, the library containing the definition must be placed after the file on the command line. For details, refer to the description of ld in the HP-UX Reference Manual or the ld(1) manpage if it is installed on your system. (If you see the message "Man page could not be formatted," ensure the manpage is installed.)
Example:
aCC file.o -lnumeric
This command directs the linker to link file.o and (by default)
search the library /usr/lib/libnumeric.sl.
See Also:
- Use the -Ldirectory option to specify additional directories for the linker to search for libraries.
- Use of the +DAarchitecture or the -G option affects the set of default libraries.
-Ldirectory Command-Line Option
-Ldirectory
The directory parameter is the HP-UX directory where
you want the linker to search for libraries your program uses
before searching the default directories.
This option causes the linker to search for libraries in
directory in addition to using the default search path.
The default search path is the directory /opt/aCC/lib.
The -L option must precede any -lname option entry on the command line; otherwise -L is ignored. This option is passed directly to the linker.
Example:
aCC -L/project/libs prog.C -lmylib1 -lmylib2
Compiles and links prog.C and directs the linker to search the directories /opt/aCC/lib and /project/libs for any libraries that prog.C uses (in this case, mylib1 and mylib2).
See Also:
+nostl Command-Line Option
+nostl
By eliminating references to the standard header files
and libraries bundled with HP aC++, this option allows experienced
users full control over the header files and libraries used in compilation
and linking of their applications, without potential complications that
arise in mixing different libraries.
+nostl suppresses linking of all default -Idirectory and -Ldirectory paths and some of the -lname libraries (-lstd and -lstream). Use the -v option to see the effect of +nostl.
For More Information:
For more information on shared libraries, see the tutorial
Creating and Using Shared Libraries and the HP-UX Online Linker and Libraries User's Guide.
|
| Linker Options |
You can specify the following linker options on the compiler command line:
- +ild/+ildrelink - The linker performs incremental linking
- -lx - The linker marks the output as sharable
- -n - The linker marks the output as sharable
- -N - The linker marks the output as unsharable
- -q - The linker marks the output as demand-loadable
- -Q - The linker marks the output as not demand-loadable
- -s - The linker strips the symbol table from the executable file it produces
- -z - The linker disallows dereferencing of null pointers at run time
- -Z - Allows dereferencing of null pointers at runtime.
In addition, you can use the -Wl,args compiler option to specify any linker option on the compiler
command line. For more information on linker options, see the ld(1) man page or the HP-UX Reference Manual.
NOTE: You must use the aCC command to link your HP aC++ programs and libraries. This ensures that all libraries and other
files needed by the linker are available.
+ild/+ildrelink Command-Line Option
+ild
+ildrelink
These incremental linking options are passed to the
linker when +DA2.0W is present. For details, see
ld(1).
-lx Command-Line Option
-lx
Arguments of the form -lx cause the linker to search the
library libx.sl or libx.a in an attempt to resolve currently
unresolved external references. Because a library is searched
when its name is encountered, placement of a -l is
significant. If a file contains an unresolved external
reference, the library containing the definition must be
placed after the file on the command line. See ld(1) for
more details.
Arguments of the form -l:libx.suffix cause the linker to
search the library libx.sl or libx.a (depending on the suffix) in
an attempt to resolve currently unresolved external
references. It is similar to the -l option except the current
state of the -Wl , -a option is not important.
-n Command-Line Option
-n
This option causes the program file produced by the linker to be marked as sharable.
For details and system defaults, refer to the description of ld in the HP-UX Reference Manual or the ld(1) manpage if it is installed on your system. (If you see the message "Man page could not be formatted," ensure the man page is installed.)
See also the -N option.
-N Command-Line Option
-N
This option causes the program file produced by the linker to be marked as unsharable.
Unsharable executable files generated with the -N option cannot be executed with exec.
For details and system defaults, refer to the ld description in the HP-UX Reference Manual or the ld(1) manpage if it is installed on your system. (If you see the message "Man page could not be formatted," ensure the man page is installed.)
See also the -n option.
-q Command-Line Option
-q
This option causes the output file from the linker to be marked as demand-loadable.
For details and system defaults, refer to the ld description in the HP-UX Reference Manual or the ld(1) manpage if it is installed on your system. (If you see the message "Man page could not be formatted," ensure the man page is installed.)
-Q Command-Line Option
-Q
This option causes the program file from the linker to be marked as not demand-loadable.
For details and system defaults, refer to the ld description in the HP-UX Reference Manual or the ld(1) manpage if it is installed on your system. (If you see the message "Man page could not be formatted," ensure the man page is installed.)
-s Command-Line Option
-s
Using this option causes the executable program file created by the linker to be
stripped of symbol table information. Specifying this option prevents using a symbolic
debugger on the resulting program.
For details and system defaults, refer to the ld description in the HP-UX Reference Manual or the ld(1) manpage if it is installed on your system. (If you see the message "Man page could not be formatted," ensure the man page is installed.)
|
| Options for Naming the Output File |
The following options allow you to name the compilation output file
something other than the default name.
- -o outfile - Specifies the name of the output file from the compilation.
- -.suffix - Specifies a file name suffix to be used for the output file from the compilation.
-o Command-Line Option
-o outfile
The outfile parameter is the name of the file containing the output of the compilation. This
option causes the output of the compilation to be placed in outfile.
Without this option the default name is a.out. When compiling a single source file with the
-c option, you can use the -o option to specify the name and location of the object file.
-.suffix Command-Line Option
-.suffix
The suffix parameter represents the character or characters to be used as the output file
name suffix. suffix cannot be the same as the original source file name suffix. Using this
option causes the compiler to direct output from the -E option into a file with the
corresponding .suffix instead of into a corresponding .c file.
Example:
aCC -E -.i prog.C
This command preprocesses the code in prog.C and puts the resulting code in the file prog.i.
|
| Native Language Support Option |
The following is an option to enable native language support:
-Y Command-Line Option
-Y
This option enables Native Language Support (NLS) of 8-bit, 16-bit and 4-byte EUC
characters in comments, string literals, and character constants.
The language value (refer to environ(5) for the LANG environment variable) is used to
initialize the correct tables for interpreting comments, string literals, and character
constants. The language value is also used to build the path name to the proper message
catalog.
Refer to hpnls, lang, and environ in the HP-UX Reference Manual for a description of the NLS model.
|
| Handling Null Pointers |
The following options control dereferencing of null pointers:
- -z - Disallows dereferencing of null pointers at runtime.
- -Z - Allows dereferencing of null pointers at runtime.
Note: Accessing the object of a NULL (zero) pointer is technically illegal,
but many systems have permitted it in the past. The following is
provided to maximize portability of code. If the hardware is able to
return zero for reads of location zero (when accessing at least 8- and
16-bit quantities), it must do so unless the -z flag is present. The
-z flag requests that SIGSEGV be generated if an access to location
zero is attempted. Writes of location zero may be detected as errors
even if reads are not. If the hardware cannot assure that location
zero acts as if it was initialized to zero or is locked at zero, the
hardware should act as if the -z flag is always set.
-z Command-Line Option
-z
This ld(1) option disallows dereferencing of null pointers at run time.
Fatal errors result if null pointers are dereferenced. If you attempt to dereference a null pointer, a SIGSEGV error occurs at run time.
Example:
aCC -z file.C
The above command compiles file.C and generates code to disallow dereferencing of null
pointers.
For more information, see signal(2) and signal(5) manpages.
-Z Command-Line Option
-Z
This option allows dereferencing of null pointers. The -z and -Z are linker options.
See ld(1) for more details.
|
| Code Optimizing Options |
Optimization options can be used to improve the execution
speed of programs compiled with the HP compiler.
To use optimization, first specify the appropriate
basic optimization level (+O1, +O2, +O3, or +O4)
on the command line followed by one or more finer
or more precise options when necessary.
For more information and examples, refer to Optimizing HP aC++ Programs.
This section discusses the following topics:
|
| Basic Optimization Level Options |
|
The following options allow you specify the basic level of optimization:
- -O - Specify level 2 optimization
- +O0 - Specify level 0 optimization
- +O1 - Specify level 1 optimization
- +O2 - Specify level 2 optimization
- +O3 - Specify level 3 optimization
- +O4 - Specify level 4 optimization
See Also:
-O Command-Line Option
-O
This option invokes the optimizer to perform level 2 optimization.
Example:
This command compiles prog.C and optimizes at level 2.
aCC -O prog.C
+O0 Command-Line Option
+O0
Use +O0 for fastest compile time or with simple programs. No optimizations are performed.
This is the default optimization level.
Example:
The following command compiles prog.C and optimizes at level 0.
aCC +O0 prog.C
+O1 Command-Line Option
+O1
This option performs level 1 optimization only. This includes branch optimization, dead code
elimination, faster register allocation, instruction scheduling, and peephole optimization.
Example:
This command compiles prog.C and optimizes at level 1.
aCC +O1 prog.C
+O2 Command-Line Option
+O2
This option performs level 2 optimization. This includes level 1 optimizations plus
optimizations performed over entire functions in a single file.
Example:
This command compiles prog.C and optimizes at level 2.
aCC +O2 prog.C
+O3 Command-Line Option
+O3
This option performs level 3 optimization. This includes level 2 optimizations plus full
optimization across all subprograms within a single file.
Example:
This command compiles prog.C and optimizes at level 3.
aCC +O3 prog.C
+O4 Command-Line Option
+O4
This option performs level 4 optimization. This includes level 3 optimizations plus full
optimizations across the entire application program.
When you link a program, the compiler brings all modules that were compiled at optimization
level 4 into virtual memory at the same time. Depending on the size and number of the
modules, compiling at +O4 can consume a large amount of virtual memory. If you are linking
a large program that was compiled with the +O4 option, you may notice a system slow down.
In the worst case, you may see an error indicating that you have run out of memory.
Example:
This command compiles prog.C and optimizes at level 4.
aCC +O4 prog.C
If you run out of memory when compiling at +O4 optimization, you can:
- Compile at +O4 only those modules that need to be compiled at optimization level 4, and
compile the remaining modules at a lower level.
- If you still run out of memory, increase the per-process data size limit. Run the System
Administrator Manager (SAM) to increase the maxdsiz process parameter from 64 MB to
128 MB. This procedure provides the process with additional data space.
Refer to the System Administration Tasks manual, Chapter 11, "Reconfiguring the HP-UX Kernel." See Appendix A for full descriptions of the different process parameters, including maxdsiz.
- If increasing the per-process data size limit does not solve the problem, increase the system swap space.
Refer to the System Administration Tasks manual, Chapter 6, "Managing Swap Space." Pay particular attention to the section "Adding File System Swap" because adding file system swap is easier than increasing the amount of device swap, which requires re-configuring your disk. However, if you find that you are consistently compiling beyond the available amount of device swap, you may not have a choice.
For a complete discussion of swap space, refer to How HP-UX Works: Concepts for the System Administrator.
See Also:
|
| Additional Optimizations for Finer Control |
Following are the additional optimizations options for finer control:
- +ESfic - Replace millicode calls with inline fast indirect calls, for applications that do not use shared libraries.
- +ES[no]lit - Place string literals into read-only memory.
- +ESplabel - Replace millicode calls with inline fast indirect calls, for applications that use shared libraries.
- +ESsfc - Replace millicode calls with inline code when performing simple function pointer comparisons.
- -fast- Selects options for optimum execution speed
- +O[no]all - Perform maximum optimization
- +O[no]aggressive - Enables optimizations that may change the behavior of code
- +O[no]clone - Provides user control to turn on [off] the cloning feature of the optimizer
- +O[no]conservative - Optimize with the minimum risk of side effects
- +O[no]failsafe - Enable [disable] failsafe optimization
- +O[no]limit - Optimize using [un]restricted compile time
- +O[no]size - Enable [disable] code expanding optimizations.
ESfic Command-Line Option
+ESfic
Replaces millicode calls with inline fast indirect calls.
The +ESfic compiler option affects how function
pointers are dereferenced in generated code. The default is to generate
low-level millicode calls for function pointer calls.
The +ESfic option generates code that calls function pointers
directly, by branching through them.
Note:
The +ESfic option should only be used in an environment where there
are no dependencies on shared libraries. The application must be linked
with archive libraries only. Using this option can improve
run-time performance.
+ES[no]lit Command-Line Option
+ES[no]lit
Places string literals into read-only memory. This is the default.
This option may reduce memory requirements and improve run-time speed in
multi-user applications.
In A.03.15, A.01.23, and prior compiler versions, only floating-point constant
values were placed in read-only memory. Other constants and literals
were placed in read-write memory.
This behavior remains available by specifying the +ESnolit
option when compiling.
As +ESlit allows the placement of string literals into
read-only memory, all users of an application share this data.
Whereas, each user is allocated a private copy of
the data stored in read-write memory. By moving additional
data from read-write storage to read-only storage,
overall system memory requirements can be reduced and run-time speed improved.
In addition, the compiler may also group identical strings, further reducing
memory usage.
Note:
When +ESlit is in effect, you should not attempt to modify
string literals, because all string literals are placed in read-only memory.
Particularly, the following C library functions should be used with care,
since they can alter the contents of a string literal
that is specified as the receiving string.
extern char *strncat(char *, const char *, size_t);
extern void *memmove(void *, const void *, size_t);
extern char *strcpy(char *, const char *);
extern char *strncpy(char *, const char *, size_t);
extern char *strcat(char *, const char *);
extern char *strtok(char *, const char *);
Following is an example of code that attempts to modify read-only memory.
A compile-time error is generated unless a cast is done, in which case
there is no message. At runtime, a SIGBUS signal is generated.
int main()
{
static const char *p = "Now is the time";
char *q;
// .....
q = (char*)p; // cast to q
// OR
// q = const_cast<char*>(p); // const cast to q
*q = 'd'; // Very bad! Application core dump
// .....
}
+ESplabel Command-Line Option
+ESplabel
Replaces millicode calls with inline fast indirect calls.
The +ESplabel option affects how function
pointers are dereferenced in generated code. The default is to generate
low-level millicode calls for function pointer calls (and virtual calls).
+ESplabel generates code that calls function pointers
directly by inlining the millicode routine.
Usage:
Using this option can improve run-time performance
at the expensive of a slight increase in code size for every call.
The option can only be used:
+ESsfc Command-Line Option
+ESsfc
Replaces millicode calls with inline code when performing simple function
pointer comparisons. The +ESsfc compiler option affects how function
pointers are compared in generated code. The default is to generate
low-level millicode calls for function pointer comparisons.
The +ESsfc option generates code that compares function pointers
directly, as if they were simple integers.
Note:
The +ESsfc option should only be used in an environment where there
are no dependencies on shared libraries. The application must be linked
with archive libraries only. Using this option can improve run-time
performance.
Example:
Following is an example of a code fragment that performs function
pointer comparisons:
int (*g)( );
int (*f)( );
int foo ( );
{
. . .
}
. . .
if (f == g)
. . .
if (f == foo)
. . .
if (f == SIG_ERR) /* SIG_ERR is defined in signal.h */
. . .
+[no]nrv Command-Line Option
+[no]nrv
or
This option disables or enables the named return value (NRV) optimization. By default
it is disabled (+nonrv).
The NRV optimization eliminates a copy-constructor call by allocating a local object of a
function directly in the caller’s context if that object is always returned by the function.
Example:
struct A{
A(A const&); //copy-constructor
};
A f(A constA x) {
A a(x);
return a; // Will not call the copy constructor if the
} // optimization is enabled.
This optimization will not be performed if the copy-constructor was not declared by the
programmer. Note that although this optimization is allowed by the ISO/ANSI C++ standard,
it may have noticeable side-effects.
Example:
aCC -Wc,+nrv_optimization,on app.C
+O[no]aggressive Command-Line Option
+O[no]aggressive
The +Oaggressive option enables aggressive optimizations. The +Onoaggressive option
disables aggressive optimizations.
Aggressive optimizations can result in significant performance improvement, but can change program behavior. They can:
- convert certain library calls to millicode and inline instructions
- alter error handling and asynchronous interrupt handling as a result of instruction scheduling optimization
- cause less precise floating-point results
- cause programs that perform comparisons between pointers to shared memory and pointers to private memory to run incorrectly
Use +Oaggressive with optimization levels 2, 3, or 4. By default, aggressive optimizations are turned off.
Example:
To enable aggressive optimizations at the second, third, or fourth optimization levels, type:
aCC +O2 +Oaggressive sourcefile.C
or:
aCC +O3 +Oaggressive sourcefile.C
or:
aCC +O4 +Oaggressive sourcefile.C
For More Information:
The +Oaggressive option invokes the following advanced optimization options:
+Oentrysched
+Onofltacc
+Onoinitcheck
+Olibcalls
+Oregionsched
+O[no]all Command-Line Option
+O[no]all
Use +Oall to obtain the best possible performance. This option should be used with stable,
well-structured code. These optimizations give you the fastest code, but are riskier than the
default optimizations.
You can use +Oall at optimization levels 2, 3, and 4.
The default is +Onoall.
Examples:
aCC +Oall prog.C
Compiles prog.C and optimizes for best performance.
aCC -O +Oall prog.C
Compiles prog.C and optimizes at level 2 with aggressive optimizations and unrestricted compile time.
For More Information:
The +Oall option without +O2, +O3, or +O4 combines the following options:
+O4
+Oaggressive
+Onolimit
+O[no]clone Command-Line Option
+O[no]clone
This option provides user control to turn on [off] the cloning feature of the optimizer.
This option is primarily for users who may see a lot of cloning adversely affecting the
performance of their code, and want more control over cloning.
Cloning is on by default, and is valid at optimization levels +O3 and
+O4. When inlining is turned off, cloning is turned off too.
+O[no]conservative Command-Line Option
+O[no]conservative
The +Oconservative option causes the optimizer to make conservative assumptions about application code and enable only conservative optimizations, a subset of basic optimizations.
Use +Oconservative at optimization levels 2, 3, or 4 when your source code is unstructured or you are unfamiliar with the source code being optimized. The default is +Onoconservative.
Example:
To enable conservative optimizations at the second, third, or fourth optimization levels, use the +Oconservative option as follows:
aCC +O2 +Oconservative sourcefile.C
or:
aCC +O3 +Oconservative sourcefile.C
or:
aCC +O4 +Oconservative sourcefile.C
+O[no]exception Command-Line Option
+O[no]exception
Enable[disable] optimizations of code regions with exception handling code sequences. This option is disabled by default.
+Oexception is allowed to be used at optimization levels 2, 3, and 4. The default is +Onoexception.
+O[no]memory[=malloc] Command-Line Option
+O[no]memory[=malloc]
Enable [disable] memory optimizations. Specifying malloc in the list will enable[disable] optimizations which
consolidate memory allocation procedure calls. This option is disabled by default. This option is incompatible with
+Oopenmp and +Oparallel, and is ignored.
+O[no]limit Command-Line Option
+O[no]limit
The +Olimit option suppresses optimizations that significantly increase compile-time or that consume a lot of memory.
The +Onolimit option enables optimizations regardless of their effect on compile
time or memory consumption.
Use +Onolimit with optimization levels 2, 3, or 4. The default is +Olimit.
Example:
To remove optimization time restrictions at the second, third, or fourth optimization levels, use +Onolimit as follows:
aCC +O2 +Onolimit sourcefile.C
or:
aCC +O3 +Onolimit sourcefile.C
or:
aCC +O4 +Onolimit sourcefile.C
+O[no]ptrs_to_globals(list) Command-Line Option
+O[no]ptrs_to_globals(list)
This option tells the optimizer whether global variables are accessed [are not accessed]
through pointers. The default is +Onoptrs_to_globals.
+O[no]size Command-Line Option
+O[no]size
While most optimizations reduce code size, the +Osize option suppresses those few optimizations that significantly increase code size. The +Onosize option enables code-expanding optimizations.
Use +Osize at all optimization levels.
The default is +Onosize.
Example:
To disable code size expanding optimizations at the second, third, and fourth optimization levels, use +Osize as follows:
aCC +O2 +Osize sourcefile.C
or:
aCC +O3 +Osize sourcefile.C
or:
aCC +O4 +Osize sourcefile.C
|
| Advanced +Ooptimization Options |
The following optimization options provide additional control for special situations.
- +O[no]dataprefetch - Enables [disables] optimizations to generate data prefetch instructions for data structures referenced within innermost loops
- +O[no]entrysched - Perform [do not perform] instruction scheduling on a subprogram's entry and exit sequences.
- +O[no]extern - Perform [do not perform] optimization for a specified set of symbols.
- +O[no]failsafe - Enable [disable] fail-safe optimization.
- +O[no]fastaccess - Enable [disable] fast access to global data items.
- +O[no]fltacc - Disables [enables] all optimizations that cause imprecise floating-point results
- +O[no]initcheck - Enables [disables] initialization of uninitialized scalar variables to null values
- +O[no]inline - Inlines [does not inline] procedure calls
- +Oinlinebudget - Controls the compile time budget for the inliner
- +Olevel - Lowers the optimization level for one or more named functions
- +O[no]libcalls - Uses [does not use] millicode routines instead of certain math library calls
- +O[no]loop_transform - Transforms [does not transform] eligible loops for improved cache and other performance
- +O[no]loop_unroll - Enables [disables] loop unrolling
- +O[no]moveflops - Moves [does not move] conditional floating-point instructions out of loops
- +O[no]multiprocessor - Enable [do not enable] multiple process optimization.
- +O[no]openmp - Enables [disables] OpenMP directives
- +O[no]parmsoverlap - Optimizes with the assumption that subprogram arguments do [do not] refer to the same memory
- +O[no]pipeline - Enable [disable] software pipelining.
- +O[no]procelim - Enables [disables] elimination of unreferenced procedures
- +O[no]promote_indirect_calls - Enables [disables] the promotion of indirect calls to direct calls
- +O[no]regionsched - Move [do not move] instructions across branches.
- +O[no]regreassoc - Enable [disable] register reassociation.
- +Oreusedir=DirectoryPath - Specify a directory in which to save intermediate object code files for reuse.
- +O[no]volatile - Treats all global variables as [not] volatile
+O[no]dataprefetch Command-Line Option
+O[no]dataprefetch=kind
The defined values for kind are:
| direct |
Enable generation of data prefetch instructions for the benefit of direct memory accesses, but not indirect memory accesses.
|
| indirect |
Enables the generation of data prefetch instructions for the benefit of both
direct and indirect memory accesses. This is the default at optimization
levels +O2 and above.
|
| none |
Disables the generation of data prefetch instructions. This is the default at
optimization levels +O1 and below.
|
When +Odataprefetch is enabled, the optimizer inserts instructions within innermost loops
to explicitly prefetch data from memory into the data cache. Data prefetch instructions are
inserted only for data structures referenced within innermost loops using simple loop varying
addresses (that is, in a simple arithmetic progression).
Use this option for applications that have high data cache miss overhead.
You can use +Odataprefetch at optimization levels 2, 3, and 4. The default is +Onodataprefetch.
+O[no]entrysched Command-Line Option
+O[no]entrysched
The +Oentrysched option optimizes instruction scheduling on a procedure's
entry and exit sequences.
Enabling this option can speed up an
application. The option has undefined behavior for applications, which
handle asynchronous interrupts. The option affects unwinding in the entry
and exit regions.
At optimization level +O2 and higher (using dataflow information), save and
restore operations become more efficient.
This option can change the behavior of programs that perform
error handling or that handle asynchronous interrupts.
The behavior of setjmp() and longjmp() is not affected.
Use +Oentrysched at optimization levels 2, 3, or 4.
The default is +Onoentrysched.
+O[no]extern Command-Line Option
+O[no]extern
The +O[no]extern option allows you to specify which accesses to symbols in an executable or shared library (a load module) can be optimized.
64-bit Mode Only: Use +Onoextern only with the 64-bit runtime model.
Note: Use of +Onoextern creates code that cannot be included in a shared library. Use +Onoextern only to build executables.
Only internal symbols (defined in the load module) can be optimized. If +Onoextern is specified, the compiler assumes that no symbols are external to the load module being compiled, and any symbol can be optimized. If +Oextern is specified, the compiler assumes that all symbols are external to the load module being compiled and thus cannot be optimized; this is the default.
Usage:
Use this option to control which symbols' accesses may be optimized. Knowledge of the shared libraries used by an application, or the exported interface of a shared library is required.
Use +O[no]extern at optimization levels 0, 1, 2, 3, or 4. The default is +Oextern with no name list.
+O[no]failsafe Command-Line Option
+O[no]failsafe
The +Ofailsafe option allows compilations with internal optimization errors to continue by issuing a warning message and restarting the compilation at a lower optimization level or at +O0, as shown in the following table.
| Specified Optimization Level |
Optimization Level when Errors Encountered |
| 1 |
0 |
| 2 |
0 |
| 3 |
2 (Note that further errors at level 2, cause the optimization level to drop to 0.) |
| 4 |
2 (Note that further errors at level 2, cause the optimization level to drop to 0.) |
You can use +Onofailsafe at optimization levels 1, 2, 3, or 4 when you want the internal optimization errors to abort your build.
The default is +Ofailsafe at levels 1, 2, 3, 4.
+O[no]fastaccess Command-Line Option
+O[no]fastaccess
The +Ofastaccess option optimizes for fast access to global data items.
Use +Ofastaccess to improve execution speed at the expense of longer
compile times.
Use +Ofastaccess at optimization levels 0, 1, 2, 3, or 4.
The default is +Onofastaccess at optimization levels 0, 1, 2, and 3, and
+Ofastaccess at optimization level 4.
+O[no]fltacc Command-Line Option
+O[no]fltacc=level
This option disables [enables] floating-point optimizations that can result in numerical differences. +Onofltacc also generates Fused Multiply-Add
(FMA) instructions, as does compiling your program at optimization level 2 or higher. FMA instructions can improve performance of floating-point applications and are available only on PA-RISC 2.0 systems or later.
If you specify neither +Ofltacc nor +Onofltacc, less optimization is performed than for +Onofltacc. If you do not specify either option at optimization level 2 or higher, the optimizer generates FMA instructions but does
not perform any expression-reordering optimizations.
Specifying +Ofltacc ensures the same result as in unoptimized code (+O0).
Usage:
The +Onofltacc option allows the compiler to make transformations which are algebraically correct, but which may slightly affect the result of computations due to the inherent imperfection of computer floating-point arithmetic. For many programs, the results obtained under +Onofltacc are adequately similar to those obtained without the optimization.
For applications in which roundoff error has been carefully studied, and the order of computation carefully crafted to control error, +Onofltacc may be unsatisfactory. To insure the same result as in unoptimized code, use +Ofltacc.
Use +Onofltacc at optimization levels 2, 3, or 4. The default is to leave this option unspecified.
Example:
+Onofltacc allows the compiler to substitute division by a multiplication using the reciprocal. For example, the following code
for (int j=1;j<5;j++)
a[j] = b[j] / x;
is transformed as follows (note that x is invariant in the loop):
x_inv = 1.0/x;
for (int j=1;j<5;j++)
a[j] = b[j] * x_inv;
Since multiplication is considerably faster than division, the optimized program runs faster.
+O[no]initcheck Command-Line Option
+O[no]initcheck
The initialization checking feature of the optimizer has three possible states:
When on (+Oinitcheck), the optimizer initializes to zero any local, non-static
variables that are uninitialized with respect to at least one path leading to a use of the
variable.
When off (+Onoinitcheck), the optimizer does not initialize uninitialized variables, but issues warning messages when it discovers them.
When unspecified, the optimizer initializes to zero any local, scalar, non-static variables that are definitely uninitialized with respect to all paths leading to a use of the variable.
Use +Oinitcheck to look for program variables that may not be initialized.
Use +Oinitcheck at any optimization level and +Onoinitcheck at optimization levels 2, 3, or 4.
+O[no]inline Command-Line Option
+O[no]inline
The +Oinline option indicates that any function can be inlined by the optimizer. +Onoinline
disables inlining of functions by the optimizer. This option does not affect functions inlined at
the source code level.
Use +Onoinline at optimization levels 2, 3, and 4.
The default is +Oinline at optimization levels 3 and 4.
See Also:
+Oinlinebudget Command-Line Option
+Oinlinebudget=n
The +Oinlinebudget option controls the aggressiveness of inlining according to the value you
specify for n, where n is an integer in the range 1 - 1000000 that specifies the level of
aggressiveness, as follows:
| n=100 |
Default level of inlining. |
| n>100 |
More aggressive inlining. The optimizer is less restricted by compilation time and code size when searching for eligible routines to inline. |
| n=2-99 |
Less aggressive inlining. The optimizer gives more weight to compilation time and code size when determining whether to inline. |
| n=1 |
Only inline if it reduces code size.
|
The +Onolimit and +Osize options also affect inlining. Specifying the +Onolimit option has
the same effect as specifying +Oinlinebudget=200. The +Osize option has the same effect as
+Oinlinebudget=1.
Note: The +Oinlinebudget option takes precedence over both of these options. This
means that you can override the effect of +Onolimit or +Osize option on
inlining by specifying the +Oinlinebudget option on the same compile line.
Use this option at optimization level 2 or higher.
The default is +Oinlinebudget=100.
For More Information:
See also the +O[no]inline option.
+Olevel Command-Line Option
+Olevel=name1[,name2,...,nameN]
This option lowers optimization to the specified level for one or more named functions.
level can be 0, 1, 2, 3, or 4.
The name parameters are names of functions in the module being compiled. Use this option
when one or more functions do not optimize well or properly. This option must be used with a
basic +Olevel or -O option.
Note: Currently only the C++ mangled name of the function is allowed for name.
This option works like the OPT_LEVEL pragma. It overrides the pragma for the
specified functions. As with the pragma, you can only lower the level of optimization; you
cannot raise it above the level specified by a basic +Olevel or -O option.
To avoid confusion, use either this option or the OPT_LEVEL pragma.
You can use this option at optimization levels 1, 2, 3, and 4. The default is to optimize all
functions at the level specified by the basic +Olevel or -O option.
Examples:
- The following command optimizes all functions at level 3, except for the functions
myfunc1 and myfunc2, which it optimizes at level 1.
aCC +O3 +O1=myfunc1,myfunc2 funcs.c main.c
- The following command optimizes all functions at level 2, except for the functions
myfunc1 and myfunc2, which it optimizes at level 0.
aCC -O +O0=myfunc1,myfunc2 funcs.c main.c
+O[no]libcalls Command-Line Option
+O[no]libcalls
+Onolibcalls=func1[,func2,...]
A number of math library functions are implemented in a special millicode library as well as in
the standard math library. The millicode versions are up to 25 percent faster than the standard
versions. However, they do not set errno and do not give an error message in the event of an exception.
The +Olibcalls option provides access to millicode routines for the following math library calls:
sin cos tan atan2 pow log10 asin acos atan exp log
Use +Olibcalls to improve the performance of these library routines only when you do not want standard error
checking. For example, you might use +Olibcalls with code that has already been debugged and runs without error.
At optimization level 2 or above, the compiler additionally inlines the function calls: memset, memcpy, abs, and modf
with profitable inlined sequences if the +Olibcalls option is specified. If this behavior is not desirable, one or more
of the functions: memset, memcpy, abs, and modf can be specified after a '=' following the +Onolibcalls option on the
same commandline. Any other argument to +Onolibcalls will be ignored with a warning. When specifying more than one of
these functions with a single +Onolibcalls option, commas can be used as the separator as shown. Alternatively, they
can also be specified using multiple +Onolibcalls options.
Use +O[no]libcalls at any optimization level.
The default is +Onolibcalls.
See Also:
Use +DOosname with +Olibcalls for improved performance.
+O[no]looptransform Command-Line Option
+O[no]looptransform
The +O[no]looptransform option enables [disables] transformation of eligible loops for improved cache
performance. The most important transformation is the reordering of nested loops to make the inner loop
unit stride, resulting in fewer cache misses.
The default is +Olooptransform at optimization levels 3 and 4. You cannot use the option at levels 0-2.
+O[no]loopunroll Command-Line Option
+O[no]loopunroll [=unroll_factor]
The +Oloopunroll option turns on loop unrolling. When you use +Oloopunroll, you can also use the
unroll factor to control the code expansion. The default unroll factor is 4, that is, four copies of the loop body. By
experimenting with different factors, you may improve the performance of your program.
You can use +Oloopunroll at optimization levels 2, 3, and 4. The default is +Oloopunroll.
+O[no]moveflops Command-Line Option
+O[no]moveflops
The +Omoveflops option allows moving conditional floating-point instructions out of loops. The behavior of
floating-point error handling may be altered by this option.
This option also allows you to enable or disable replacing integer divide by a floating-point multiply. This may
cause SIGFPE if IEEE inexact is enabled (+FPI).
Usage:
Use +Onomoveflops if floating-point traps are enabled and you do not want the behavior of floating-point
errors to be altered by the relocation of floating-point instructions.
Use +Onomoveflops at optimization levels 2, 3, and 4. The default is +Omoveflops.
+O[no]openmp Command-Line Option
+O[no]openmp
The +Oopenmp option causes the OpenMP directives to be honored. This option is effective at
any optimization level. Non OpenMP parallelization directives are ignored with warnings.
+Onoopenmp requests that OpenMP directives be silently ignored. If neither +Oopenmp nor
+Onoopenmp is specified, OpenMP directives will be ignored with warnings.
The OpenMP specification is available at http://www.openmp.org/specs.
OpenMP programs require the libomp and libcps runtime support libraries to be present on
both the compilation and runtime systems. The compiler driver will automatically include
them when linking.
It is recommended that you use the -N option when linking OpenMP programs to avoid
exhausting memory when running with large numbers of threads.
For more information, see Parallel Programming using OpenMP.
+O[no]multiprocessor Command-Line Option
+O[no]multiprocessor
If +Omultiprocessor is specified, the compiler performs optimizations appropriate for executables or shared libraries to be run in several different processes on multiprocessor machines.
If you enable this option inappropriately (for example, for an executable only run on a uniprocessor system),
performance may be degraded.
Use +O[no]multiprocessor at optimization levels 2, 3, and 4. The default is +Onomultiprocessor.
+O[no]parmsoverlap Command-Line Option
+O[no]parmsoverlap
The +Onoparmsoverlap option optimizes with the assumption that the actual arguments of function calls overlap in memory.
Use +Onoparmsoverlap if C++ programs have been literally translated from FORTRAN programs.
Use +Onoparmsoverlap at optimization levels 2, 3, and 4. The default is +Oparmsoverlap.
+O[no]pipeline Command-Line Option
+O[no]pipeline
The +Opipeline option enables software pipelining.
Use +Onopipeline to conserve code space.
Use +Onopipeline at optimization levels 2, 3, and 4. The default is +Onopipeline at
optimization level 1 and +Opipeline at levels 2, 3, and 4.
+O[no]procelim Command-Line Option
+O[no]procelim
This option enables [disables] the elimination of dead procedure code.
Use this option when linking an executable file, to remove functions not referenced by the
application. You can also use this option when building a shared library to remove functions
not exported and not referenced from within the shared library. This may be especially useful
when functions have been inlined.
Any function having symbolic debug information associated with it is not
removed.
The default is +Onoprocelim at optimization levels 1 through 3 and +Oprocelim at level 4.
Use +O[no]procelim at any optimization level.
+O[no]promote_indirect_calls Command-Line Option
+O[no]promote_indirect_calls
This option uses profile data from profile-based optimization and other information to
determine the most likely target of indirect calls and promotes them to direct calls. Indirect
calls occur with pointers to functions and virtual calls.
In all cases the optimized code tests to make sure the direct call is being taken and if not,
executes the indirect call. If +Oinline is in effect, the optimizer may also inline the promoted
calls. +Opromote_indirect_calls is only effective with profile-based optimization.
Note: The optimizer tries to determine the most likely target of indirect calls. If the
profile data is incomplete or ambiguous, the optimizer may not select the best
target. If this happens, your code’s performance may decrease.
This option can be used at optimization levels 3 and 4. At +O3, it is only effective if indirect
calls from functions within a file are mostly to target functions within the same file. This is
because +O3 optimizes only within a file whereas, +O4 optimizes across files.
The default is +Onopromote_indirect_calls.
+O[no]regionsched Command-Line Option
+O[no]regionsched
The +Oregionsched option applies aggressive scheduling techniques to move
instructions across branches.
Note: This option is incompatible with the -z option.
Using this option with -z may cause a SIGSEGV error at run-time.
See signal(2) and signal(5) for more information.
(If you see the message "Man page could not be formatted," ensure
the man page is installed.)
Use +Oregionsched to improve application run-time speed.
Use +Oregionsched at optimization levels 2, 3, and 4.
The default is +Onoregionsched.
+O[no]regreassoc_called Command-Line Option
+O[no]regreassoc
The +Onoregreassoc option turns off register reassociation.
Use +Onoregreassoc to disable register reassociation
if this optimization hinders application performance.
Use +Onoregreassoc at optimization levels 2, 3, and 4.
The default is +Oregreassoc.
+Oreusedir=DirectoryPath Command-Line Option
+Oreusedir=DirectoryPath
This option specifies a directory for the linker to save object files
created from intermediate object files when using +O4 or
profile-based optimization.
It reduces link time by not recompiling intermediate object
files when they don't need to be recompiled.
When you compile with +I, +P, or +O4, the compiler generates intermediate
code in the object file. Otherwise, the compiler generates regular object
code in the object file. When you link, the linker first compiles the
intermediate object code to regular object code, then links the object
code. With this option you can reduce link time on subsequent links by not
recompiling intermediate object files that have already been compiled to
regular object code and have not changed.
Note: When you change a source file or command line options and
recompile, a new intermediate object file will be created and compiled to
regular object code in the specified directory. The previous object file
in the directory will not be removed. You should periodically remove this
directory or the old object files since the old object files cannot be
reused and will not be automatically removed.
Use +Oreusedir=DirectoryPath at optimization
level 4 or with profile-based optimization.
The default is to use TMPDIR and remove the temporary objects after each link.
+O[no]volatile Command-Line Option
+O[no]volatile
The +Ovolatile option implies that memory references to global
variables are volatile and cannot be removed during optimization.
The +Onovolatile option implies that all globals are not of
volatile class. This means that references to global variables can be
removed during optimization.
Use this option to control the "volatile" semantics for all global variables.
Use +Ovolatile at optimization levels 1, 2, 3, or 4.
The default is +Onovolatile.
|
| Parallel Processing Options |
HP aC++ provides the following optimization options for parallel code:
- -mt - Automatically selects and sets flags for parallelization.
- +O[no]autopar - Parallelize loops that are
safe to parallelize.
- +O[no]dynsel - Enable workload-based
dynamic selection of parallelizable loops.
- +O[no]loop_block - Enable [disable] blocking of
eligible loops for improved cache performance.
- +O[no]loop_unroll_jam - Enable [disable] loop unrolling and jamming.
- +O[no]parallel - Transform [do not transform] eligible loops for parallel execution on a multiprocessor system.
- +O[no]report=reportype - Produce a Loop Report.
- +O[no]sharedgra - Enable [disable] global register allocation.
- +tmtarget - Compile code for optimization with a specific machine architecture.
-mt Command-Line Option
The -mt option enables multi-threading capability without the need to set any other flags,
such as -l and -D. HP aC++ examines your environment and automatically selects and sets
the appropriate flags. There are three possible sets of flags depending on your operating
system and which libstd you use.
The following table lists the option matrix for -mt.
old-lib
libstd 1.2.1
(-AP)
&
librwtool
7.0.x |
- -D_REENTRANT
- -DRW_MULTI_THREAD
- -DRWSTD_MULTI_THREAD
- -D_THREAD_SAFE
- -D_POSIX_C_SOURCE=199506L
- -lpthread
|
new-lib
(-AA)
libstd
2.2.1
|
- -D_REENTRANT
- -D_RW_MULTI_THREAD
- -D_RWSTD_MULTI_THREAD
- -D_POSIX_C_SOURCE=199506L
- -lpthread
|
Macros Used to Compile Multi-Thread Source Code:
- _REENTRANT: Required by system header files that provide reentrant functions (suffixed by _r).
- RW_MULTI_THREAD/_RW_MULTI_THREAD: Required by Rogue Wave toolsh++ header files and libraries. RW_MULTI_THREAD is used by toolsh++ 7.0.x. _RW_MULTI_THREAD is used by toolsh++ 8.x
(not available yet).
- RWSTD_MULTI_THREAD/_RWSTD_MULTI_THREAD: Required by Rogue Wave standard library header files and libraries. RWSTD_MULTI_THREAD is used by libstd 1.2.1. _RWSTD_MULTI_THREAD is used by libstd 2.2.1 when compiling with -AA.
- _POSIX_C_SOURCE=199506L: Required by pthread.
- _THREAD_SAFE: Required by thread safe cfront compatible libstream header files and library.
For the frequently used objects cout,
cin, cerr, and clog, you can specify the -D_THREAD_SAFE
compile time flag for any file that includes .
In this case, a new instance of the object is transparently
created for each thread that uses it. All instances
share the same file descriptor.
- libpthread: Kernel thread library used on 11.x systems.
Using -D__HPACC_THREAD_SAFE_RB_TREE
The Rogue Wave Standard C++ Library 1.2.1 (libstd) and
Tools.h++ 7.0.6 (librwtool) are not thread safe if the
underlying implementation rb_tree class is involved. In
other words, if the tree header file (which includes
tree.cc) under /opt/aCC/include/ is used, these libraries
are not thread safe. Most likely, it is indirectly referenced
by including the standard C++ library container class map
or set headers, or by including a RogueWave tools.h++
header like tvset.h, tpmset.h, tpmset.h,
tvset.h, tvmset.h, tvmset.h, and tpmap.h.
Since changing the rb_tree implementation to make it
thread safe would break binary compatibility, the
preprocessing macro __HPACC_THREAD_SAFE_RB_TREE must be
defined. Whether or not this macro is defined when
compiling a file that includes the tree header, its use
must be consistent. For example, a new object file
compiled with the macro defined should not be linked with
older ones that were compiled without the macro defined.
Library providers whose library is built with the macro
defined may need to notify their users to also compile their
source with the macro defined when the tree header is included.
This macro is not set by -mt, You must set it explicitly
on the command line.
+O[no]autopar Command-Line Option
+O[no]autopar
When used with the +Oparallel
option, +Oautopar causes the compiler to
parallelize loops that are safe to parallelize. When used
with +Oparallel, +Onoautopar
causes the compiler not to parallelize any loops.
A loop is safe to parallelize if it has an iteration
count that can be determined at runtime before loop
invocation; it must contain no loop-carried dependences,
procedure calls, or I/O operations. A loop-carried
dependence exists when one iteration of a loop assigns a
value to an address that is referenced or assigned on
another iteration.
+Oautopar is the default for all optimization levels but
is useful only at levels 3 and 4.
For More Information:
+O[no]dynsel Command Line Option
+O[no]dynsel
When specified with +Oparallel, the +Odynsel option enables workload-based dynamic selection of parallelizable
loops. +Odynsel causes the compiler to generate either a parallel or a serial version of the loop. The loop's
workload is compared to parallelization overhead, and the parallel version is run only if it is profitable to do so.
The +Odynsel option disables dynamic selection and tells the compiler that it is profitable to parallelize all parallelizable loops.
If a loop's iteration count is known at compile time,
this optimization is performed at compile time. If a loop's
iteration count is not known until runtime, the optimization
is performed at runtime.
The default is +Odynsel if +Oparallel
is enabled at optimization level(s) 3 and 4.
For More Information:
+O[no]loop_block Command-Line Option
+O[no]loop_block
The +O[no]loop_block option enables [disables]
blocking of eligible loops for improved cache performance.
The default is +Onoloop_block at
optimization level(s) 3 and 4.
For More Information:
+O[no]loop_unroll_jam Command-Line Option
+O[no]loop_unroll_jam
The +O[no]loop_unroll_jam option enables
[disables] loop unrolling and jamming. Loop unrolling and
jamming increase register exploitation.
The default is +Onoloop_unroll_jam at
optimization level(s) 3 and 4.
For More Information:
+O[no]parallel Command-Line Option
+O[no]parallel
Transform [do not transform] eligible loops for parallel
execution on a multiprocessor system.
The default is +Onoparallel at optimization
level(s) 3 and 4.
Note: If you compile one or more files
in an application using +Oparallel, the application must be
linked (using the aCC compiler driver) with the +Oparallel
option in order to link in the proper start-up files and
runtime support.
Use the MP_NUMBER_OF_THREADS environment variable, to
specify the number of processors used in executing your
parallel programs. This variable is read by your program at
runtime. If set to a positive integer n, your
program executes on n processors. n
must be less than or equal to the number of processors on
the system where the program is executing.
For introductory examples, see
Setting the Number of
Threads Used in Parallel and
Transforming Loops for
Parallel Execution (+Oparallel).
Note: +Oparallel disables the
+Ofailsafe option.
For More Information:
+O[no]report Command-Line Option
+O[no]report[=report_type]
This option causes the compiler to display[not to display] various optimization reports.
The value of report_type determines which report is displayed, as described in the following table:
| loop |
Produces the Loop Report which gives information on
optimizations performed on loops and calls.
+Oreport is equivalent to +Oreport=loop.
|
+Oreport (without = report_type) |
Produces the Loop Report.
|
| private |
Produces the loop report and privatization table, which provide information
on loop variables that are privatized by the compiler.
|
| all |
Produces all reports.
|
The +Onoreport option does not accept any of the report_type values and turns off all
reporting. The +Oreport[=report_type] option is active only at optimization levels 3 and
above.
The default is +Onoreport.
For More Information:
+O[no]sharedgra Option
+O[no]sharedgra
The +Onosharedgra option enables [disables]
global register allocation for shared-memory variables that
are visible to multiple threads. This option may help if a
variable shared among parallel threads is causing wrong
answers.
The default is +Osharedgra. This option is available at
optimization levels 2 and above.
For More Information:
|
| Profile-Based Optimization Options |
|
Profile-based optimization is a set of performance-improving code transformations based on
the run-time characteristics of your application.
The following is a list of profile-based optimization options:
- +dfname - Specifies the profile database to use with profile-based optimization
- +I - Prepares the object code for profile-based optimization data collection
- +P - Performs profile-based optimization
- +pgmname - Specifies the execution profile data to use with profile-based optimization.
For More Information:
For more information on performing profile-based optimization, see:
+df Command-Line Option
+dffilename
Specifies the path name of the profile database to use with profile-based optimization. This option can be
used with the +P command line option.
The profile database by default is named flow.data. This file stores profile information for one
or more executables. Use +df when the flow.data file has been renamed or is in a different
directory than where you are linking.
You can also use the FLOW_DATA environment variable to specify a different path and file name for
the profile database file. The +dfname command line option takes precedence over the FLOW_DATA
environment variable.
Note: The +dfname option cannot be used to redirect the instrumentation output (with the
+I option). It is only compatible with the +P option.
Example:
aCC +P +dfpbo.data prog.o -o myapp
Relinks the object file prog.o, optimizes using the run-time profile data in the file
pbo.data, and puts the executable code in the file myapp.
name Parameter
This parameter specifies the path name of the profile database to use with profile-based optimization.
+I Command-Line Option
+I
This option instructs the compiler to instrument the object code for collecting run-time profile data. The profiling
information can then be used by the linker to perform profile-based optimization. Code generation and
optimization phases are delayed until link time by this option.
After compiling and linking with +I, run the resultant program using representative input data to
collect execution profile data. Finally, relink with the +P option to perform profile-based optimization.
Profile data is stored in flow.data by default. See the +dfname option for information on
controlling the name and location of this data file.
The +I option is incompatible with the -G, +P, and -S options. And it is
incompatible with -g0 and -g1 if used to compile.
Example:
aCC +I -O -c prog.C
aCC +I -O -o prog.pbo prog.o
Compiles prog.C with optimization, prepares the object code for data collection, and creates the
executable file prog.pbo. Running prog.pbo collects run-time information in the file flow.data
in preparation for optimization with +P.
+P Command-Line Option
+P
This option directs the compiler to use profile information to guide code generation and profile-based
optimization. The compiler generates intermediate compiler code instead of compiled object code.
Code generation is done at link time.
The +P option does not affect the default optimization level, or the optimization level specified by
the +O1, +O2, +O3, or +O4 options.
Note: Source files that are compiled with the +I option do not need to be recompiled with +P
in order to use profile-based optimization. You only need to relink the object files with the +P option after
running the instrumented version of the program.
The +P option is incompatible with the +I and -S options. And it is incompatible
-g0 and -g1 if used to compile.
Example:
aCC +P -o myapp prog.o
Relinks the object file prog.o and optimizes using the run-time profile data.
+pgmname Command-Line Option
+pgmname
Specifies a program name to look up in the flow.data file to use with profile-based
optimization and the +P option.
The +pgmname option should be used when the name of the profiled executable differs
from the name of the current executable specified by the -o option.
Example:
In the following example, the instrumented program file name is sample.inst. The optimized program file
name is sample.opt. The +pgmname option is used to pass the instrumented program name,
sample.inst, to the optimizer:
aCC -c +I sample.C
aCC -o sample.inst +I -O sample.o
sample.inst < input.file1
aCC -o sample.opt +P +pgm sample.inst sample.o
+pgm name Parameter
The name parameter is the instrumented executable program name that is used when performing profile-based
optimization.
|
| Displaying Optimization Information |
The following options display informational messages about the optimization process:
- +DA - Generate object code for a
particular version of the PA-RISC architecture. Also specifies which
version of the HP-UX math library to use.
- +DS - Perform instruction scheduling
tuned for a particular implementation of the PA-RISC
architecture.
- +O[no]info - Displays informational messages about the optimization process.
+O[no]info Command-Line Option
+O[no]info
+Oinfo displays informational messages about the optimization process. This option may be
helpful in understanding what optimizations are occurring.
You can use the option at optimization levels 0-4. The default is +Onoinfo at levels 0-4.
|
| Performance Options |
The HP compiler provides a variety of options to help improve build and run-time
performance. These options are:
- -fast - Select options for optimum execution speed.
- +inline_level [i]num - Controls how C++ inlining hints influence HP aC++. Also allows implicit inlining of small functions that are not explicitly tagged with the inline keyword.
- +[no]objdebug - Generate debug information in object files and not in the executable.
- Precompiled Header File Options -
Reduce compilation time by precompiling common include (header)
files.
- +DAarchitecture - Generate
object code for a particular version of the PA-RISC architecture.
Also specify a version of the HP-UX math library.
- +DSmodel - Perform instruction scheduling tuned for a particular implementation.
- Optimization Options - Select the appropriate options to improve program execution speed.
-fast Command-Line Option
-fast
The -fast option selects a combination of optimization options for optimum execution speed
and reasonable build times. Currently chosen options are:
- +O2, +Olibcalls, and +FPD
- If +noeh occurs before -fast, then +Oentrysched is
also added.
You can override any of the options in -fast by specifying a subsequent option after it.
This option may aid in porting C++ applications compiled
on other UNIX operating systems to HP-UX.
|
| Porting Options |
Use the following options as necessary when porting your code from other operating environments to HP-UX.
- -fast - Select a set of options for optimum execution speed for reasonable build times.
- +sb - Treats unqualified bitfields as signed.
- +ub - Treats unqualified bitfields as unsigned.
- +uc - Treat an unqualified (plain) char data type as unsigned char.
+sb Command-Line Option
+sb
Unqualified bit fields are treated as signed. The default is +sb.
NOTE: +uc will override this for char bit fields.
Note: When both +sb and +uc are in effect, +uc will override this for char bit fields.
+ub Command-Line Option
+ub
Unqualified bit fields are treated as unsigned. The default is +sb.
+uc Command-Line Option
+uc
By default, all unqualified char data typs are treated as signed char. Specifying +uc
causes an unqualified (plain) char data type to be treated as unsigned char. (Overloading and
mangling are unchanged.)
Use this option to help in porting applications from environments where an unqualified
(plain) char type is treated as unsigned char.
Note: Since all unqualified char types in the compilation unit will be affected by this
option (including those headers that define external and system interfaces) it is
necessary to compile the interfaces used in a single program uniformly.
|
|
Precompiled Header Files |
You can reduce compilation time by precompiling common
include (header) files. HP aC++ provides two mechanisms,
header caching and manual precompiled headers. Note that
the mechanisms cannot be mixed.
Header Caching Options
Manual Precompiled Header Options
- +hdr_create -
Create a manual precompiled header file.
- +hdr_use -
Compile using a manual precompiled header file.
- +hdr_v -Lists verbose
information when manually precompiling a header or when
compiling a manual precompiled header file.
+hdr_cache Option
+hdr_cache
Turns header caching on.
An aCC_cache subdirectory is created to contain
precompiled header files. By default, it is in the source
file directory. To specify a different aCC_cache location
and/or name, use the +hdr_dir
option.
Usage
When used together, the manual precompiled header options (+hdr_create
and +hdr_use) override the
header caching option (+hdr_cache).
+hdr_cache can only be used when actually compiling a
source file. If used with -P or
-E, it is turned off.
Example:
aCC -c +hdr_cache header.C main.C
// Precompile and cache header.C and main.C
// (initial compile).
aCC -c +hdr_cache header.C main.C
// header.C and main.C are not precompiled
// (if no changes to compilation environment).
Note that the -c option is needed
to suppress the link step.
See Also:
+hdr_dir DirectoryPath Option
+hdr_dir DirectoryPath
When you use the +hdr_cache
option, an aCC_cache subdirectory is automatically created
to contain precompiled files. By default, it is in the
source file directory. The +hdr_dir option allows you to
specify a different directory path and directory name in
place of the aCC_cache default.
NOTE: To maximize the efficiency of the
cache mechanism, it is recommended that you specify a
directory in the compilation directory or in a subdirectory
of the compilation directory.
Usage:
You might use +hdr_dir to specify different aCC_cache
locations for debug builds versus release builds, for
instance.
Example:
aCC -c +hdr_cache header.C // Precompile and cache header.C
// in the aCC_cache directory,
// a subdirectory of that
// in which header.C is located.
aCC -c -Ddebugflag +hdr_cache +hdr_dir ./debug/aCC_debug_cache header.C
// Precompile and cache header.C
// in the ./debug/aCC_debug_cache directory,
// a subdirectory of that
// in which header.C is located.
aCC -c +hdr_cache +hdr_dir ./release/aCC_release_cache header.C
// Precompile and cache header.C
// in the ./release/aCC_release_cache
// directory, a subdirectory of that
// in which header.C is located.
See Also:
+hdr_info Option
+hdr_info
Generates a message stating whether a header is being re-used or precompiled. The default is off.
+hdr_create Option
+hdr_create
Creates a manual precompiled header file for subsequent use
when compiling an application or a library with the
+hdr_use option.
You can reduce compilation time by precompiling common
include (header) files into a precompiled header file.
Example:
aCC headers.C -c +hdr_create precomp
From headers.C, creates a precompiled header file named
precomp.
Note that the -c option is needed
to suppress the link step.
See Also:
+hdr_use Option
+hdr_use
Compiles a manual precompiled header file and its
corresponding object (.o) file. These files must have been
created by using the +hdr_create
option.
This is known as a load compile.
Example:
aCC main.C +hdr_use precomp
Compiles main.C, including a precompiled header file named
precomp.
See Also:
+hdr_v Option
+hdr_v
Provides verbose information when precompiling a header or
when compiling a precompiled header file.
Examples:
aCC headers.C -c +hdr_create precomp +hdr_v
Creates a precompiled header file named precomp and displays
what is going into the precompiled header file.
aCC main.C +hdr_use precomp +hdr_v
Compiles main.C and displays what is being used from the
precompiled header file.
See Also:
|
| Preprocessor Options |
The following options are accepted by the preprocessor:
- -Dname - Defines name to the preprocessor
- -E - Runs only the preprocessor and sends output to stdout
- +m[d] and +make[d] - Output quote enclosed (" ") make dependency files to stdout or to a .d file
- +M[d] and Make[d] - Output both quote enclosed and angle bracket enclosed (< >) make dependency files to stdout or to a .d file
- -notrigraph -
Inhibits the processing of trigraphs.
- -P - Runs only the preprocessor and sends output to a corresponding .i file
- -.suffix - Sends preprocessed output to the corresponding output file ending with .suffix
- -Uname - Undefines name in the preprocessor
-Dname Command-Line Option
-Dname[=def]
name is the symbol name that is defined for the preprocessor. def is
the definition of the symbol name (name).
This option defines a symbol name (name) to the preprocessor, as if defined by the
preprocessing directive #define.
If no definition (def) is given, the name is defined as 1.
Example:
aCC -DDEBUGFLAG file.C
Defines the preprocessor symbol DEBUGFLAG
and gives it the value 1. Following is a
program that uses this symbol.
#include <iostream.h>
void main(){
int i, j;
#ifdef DEBUGFLAG
int call_count=0;
#endif
...
}
For More Information:
-E Command-Line Option
-E
Using this option runs only the preprocessor on the named C++ files and sends the result to
standard output (stdout).
An exception to this rule when -E is used with either the +m[d] or +M[d] option,
only make(1) dependency information is output. Unlike the -P option, the output of -E
contains #line entries indicating the original file and line numbers.
Redirecting Output From This Option:
Use the -.suffix option to redirect the output of this option.
+m[d] and +make[d] Command-Line Options+m[d]
+make[d]
This option directs a list of the quote enclosed (" ") header files upon which your source code
depends to stdout. The list is in a format accepted by the make command.
If +md is specified, the list is directed to a .d file. The .d file name prefix is the same as that of
the object file. The .d file is created in the same directory as the object file.
Use +m[d] when you also specify the -E or the -P option. When used with the -E option, only
dependency information is generated.
The following table lists examples of the +m[d] option.
| command line specified |
.d file name |
.d file location |
preprocessing output |
|
aCC -c +m a.C
|
none
|
stdout
|
none
|
|
aCC -c -E -.i +md a.C
|
a.d
|
current directory
|
none
|
|
aCC -c -P +md a.C -o b.o
|
b.d
|
current directory
|
a.i
|
|
aCC -c -P +md a.C -o /tmp/c
|
c.d
|
/tmp directory
|
a.i
|
+M[d] and +Make[d] Command-Line Options+M[d]
+Make[d]
This option directs a list of both the quote enclosed (" ") and angle bracket enclosed (< >)
header files upon which your source code depends to stdout. The list is in a format accepted
by the make(1) command.
If +Md is specified, the list is directed to a .d file. The .d file name prefix is the same as that of
the object file. The .d file is created in the same directory as the object file.
Use +Md when you also specify the -E or the -P option. When used with the -E option, only
dependency information is generated.
The following table lists examples of the +M[d] option.
| command line specified |
.d file name |
.d file location |
preprocessing output |
|
aCC -c +M a.C
|
none
|
stdout
|
none
|
|
aCC -c -E -.i +Md a.C
|
a.d
|
current directory
|
none
|
|
aCC -c -P +Md a.C -o b.o
|
b.d
|
current directory
|
a.i
|
|
aCC -c -P +Md a.C -o /tmp/c
|
c.d
|
/tmp directory
|
a.i
|
-notrigraph Command-Line Option
-notrigraph
This option inhibits the processing of trigraphs. The -notrigraph
option, in previous versions, caused the legacy preprocessor
to be invoked, which ignored trigraphs. These trigraphs were
still interpreted by the compiler in the preprocessed
source.
In this version of aCC, the -notrigraph option
does not invoke the legacy preprocessor and also suppresses
the trigraphs from being interpreted.
This option is not recommended. The proper protable
solution is to quote the ? as \?.
-P Command-Line Option
-P
Only preprocesses the files named on the command line
without invoking further phases. Leaves the result in
corresponding files with the suffix .i.
Example:
aCC -P prog.C
Preprocesses the file prog.C leaving the output
in the file prog.i. Does not compile
the program.
For More Information:
-Uname Command-Line Option
-Uname
name is the symbol name whose definition is removed from the preprocessor. This option
undefines any name that has initially been defined by the preprocessing stage of compilation.
A name can be a definition set by the compiler. This is displayed when you specify the -v
option. A name can also be a definition you have specified with the -D option on the command
line.
The -D option has lower precedence than the -U option. If the same name is used in both, the
-U option and the -D option, the name is undefined regardless of the order of the options on the
command line.
For More Information:
|
| Profiling Code Options |
HP compilers provide the following options for profiling your code.
- -G - Prepare an object file for use
with
gprof.
- +pa - Request that an application be
compiled for routine-level profiling with
CXperf.
- +pal - Request that an application
be compiled for routine-level and loop-level profiling with
CXperf.
-G Command-Line Option
-G
At compile time, -G produces code that counts the number of times each arc in the call graph
is traversed. At link time, when you are building an executable (but not a shared library) -G
picks up profiled versions of certain system libraries and picks up the gprof support library.
Example:
aCC -G file.C
The above example compiles file.C and creates the executable file a.out instrumented for
use with gprof.
+pa Command-Line Option
+pa
Prepares an application for routine level profiling with CXperf.
The +pa option is invalid with the +O4 or
+O[no]all optimization options. Also, +pal is
incompatible with the +A, -G,
and -s options.
For More Information:
Refer to the CXperf(1) manpage. (If you see the message "Manpage could not be
formatted," ensure the man page is installed.)
+pal Command-Line Option
+pal
At +O2 and +O3, prepares an
application for routine level and loop-level profiling with <CXperf.
The +pal option is invalid with the +O4 or
+O[no]all optimization options. Also, +pal is
incompatible with the +A, -G,
and -s options.
For More Information:
Refer to the CXperf(1) manpage. (If you see the message "Man page could not be
formatted," ensure the man page is installed.)
|
| Standards Related Options |
The following options related to the ANSI/ISO 9899-1990 Standard for the C Programming
Language and ANSI/ISO International Standard and ISO/IEC 14882 Standard for the C++
programming Language are accepted by the compiler.
- -Aa - Enable the use of standard options (-Wc,-koenig_lookup,on and -Wc,-ansi_for_scope,on).
- -Ae - Enables ANSI C C89 mode
- -AA - Enable Rogue Wave Standard C++ Library 2.2.1 and set all standards related options on.
- -AC89 - Invokes the compiler in ANSI C89 compilation mode
- -AC99 - Invokes the compiler in ANSI C99 compilation mode
- -AP - Turns off -AA mode and uses the older C++ runtime libraries
- -Wc,-ansi_for_scope,[on][off] - Enable or disable the scoping rules for init-declarations in for statements
- -Wc,-koenig_lookup,[on][off] - Enable or disable argument-dependent lookup rules (also known as Koenig lookup)
- +hpxstd98 - Enable a new, standard compliant compilation mode
-Aa Command-Line Option
-Aa
This option instructs the compiler to use Koenig lookup and strict ANSI for scope rules. This
option is equivalent to specifying -Wc,-koenig_lookup,on and -Wc,-ansi_for_scope,on.
The default is off. Refer to -Ae option for C++ C-mode description. The standard features
enabled by -Aa are incompatible with earlier C and C++ features.
For More Information:
-AA Command-Line Option
-AA
The new -AA command line option enables use of the new 2.0
Standard C++ Library, which includes the new standard
conforming ("templatized") iostream library. This is the
first release of the 2.0 library. It conforms to the ISO C++
standard.
The 2.0 library is a new addition to the HP C++ runtime
is not compatible with the version 1.2.1 Standard C++
Library previously bundled with HP aC++. HP aC++ will
continue support for standard C++ library 1.2.1 without name
or location change. Customers should not notice any change
when -AA is not used. However, the 1.2.1 library is
deprecated and will be replaced by the new library
eventually.
If you wish to use the new 2.0 library, you must use the
-AA option consistently to compile and link all translation
units. Mixing object files within an executable is not
supported.
In order to use the new 2.0 library, you must recompile
using the -AA option and you may need to apply a runtime
and/or header file patch appropriate to your operating
system (see list below). You do not need to install the
header file patch if you use the A.03.30 compiler. The
header file patches are needed for A.03.27, A.03.26,
A.03.25, and A.01.27.
You can avoid the binary incompatibility simply by not
using the -AA option and foregoing use of the 2.0 library.
If you don't use -AA, you should still install the patches.
If you do use -AA and you are on A.03.30, the header file
patches are included in A.03.30 but you must still install
the runtime patches. Then you must recompile and relink any
previous -AA application.
HP does not take the creation of binary incompatibilities
lightly. When one is created, it is only after a careful
consideration of options and ramifications. Our customers
want to be able to use the new 2.0 library. Doing this also
ensures compatibility with the Multibyte Support Extensions
made in the 11i (11.11) release of HP-UX. The A.03.25
version (PHSS_21906) had an incorrect size and mangling for
mbstate_t. The 11i defined value is 8 bytes, the libstd_v2
version is 4.
In particular the following template classes are now
larger:
std::basic_filebuf<>
std::basic_fstream<>
std::basic_ifstream<>
std::basic_ofstream<>
std::fpos
std::mbstate_t
In addition to the possible silent corruption with this
above change in size, the mangling was changed to better
detect this compatibility problem by changing the name.
std::mbstate_t was changed to just mbstate_t.
std::tm was changed to just tm.
So if you developed on A.03.25 with the beta, A.03.26 on
11i or on 11.0 with the Ecommerce compiler, or A.01.27 for
AR1200, or A.03.27 for AR1200, you will have the following
problems if you don't install both the following header file
and runtime library patches:
PHSS_22867 10.x header file
PHSS_22354 10.x runtime
PHSS_22868 11.x header file
PHSS_22543 11.0 runtime
PHSS_22898 11i runtime
Note applications developed on A.01.27 may not have these
problems yet because there never was any runtime patch,
except for a beta.
An ordinary program using iostreams experiencing this
problem will get the following unsats:
If existing application runs on new runtime patch:
/usr/lib/dld.sl: Unresolved symbol: do_out__Q2_3std14codecvt_bynameXTwTcTQ2_
3std9mbstate_t_CFRQ2_3std9mbstate_tPCwT2RPCwPcT5RPc (plabel) from a.out_old
/usr/lib/dld.sl: Unresolved symbol:
do_in__Q2_3std14codecvt_bynameXTwTcTQ2_
3std9mbstate_t_CFRQ2_3std9mbstate_tPCcT2RPCcPwT5RPw (plabel)
from a.out_old
Trying to link with new runtime without new headers:
/usr/ccs/bin/ld: Unsatisfied symbols: std::codecvt_byname::do_in(std::mbstate_t
&,const char *,const char *,const char *&,wchar_t *,wchar_t
*,wchar_t *&) const (code)
std::codecvt_byname::do_out(std::mbstate_t
&,const wchar_t *,const wchar_t *,const wchar_t *&,char
*,char *,char *&) const (code)
Running application linked with new headers on old
runtime:
/usr/lib/dld.sl: Unresolved symbol:
do_out__Q2_3std14codecvt_
bynameXTwTcT9mbstate_t_CFR9mbstate_tPCwT2RPCwPcT5RPc (code)
from a.out_new
/usr/lib/dld.sl: Unresolved symbol:
do_in__Q2_3std14codecvt_
bynameXTwTcT9mbstate_t_CFR9mbstate_tPCcT2RPCcPwT5RPw (code)
from a.out_new
Trying to link with old runtime with new headers:
/usr/ccs/bin/ld: Unsatisfied symbols: std::codecvt_byname::do_out(mbstate_t
&,const wchar_t*,const wchar_t *,const wchar_t *&,char
*,char *,char *&) const (code)
std::codecvt_byname::do_in(mbstate_t
&,const char *,const char *,const char *&,wchar_t *,wchar_t
*,wchar_t *&) const (code)
Usage
The standard features enabled by -AA are incompatible with
the older Rogue Wave Standard C++ Library 1.2.1 and Tools.h++
7.0.6. All modules must be consistent in using -AA. Mixing
modules compiled with -AA with ones that are not is not
supported.
The -Wc,-koenig_lookup,on
and -Wc,-ansi_for_scope,on
options are also set.
For More Information:
-AC89 Command-Line Option
-AC89
This option invokes the compiler in ANSI C89 compilation mode. This option, when specified with -ext option, invokes a part of ANSI C99 features.
-AC99 Command-Line Option
-AC99
This option invokes the compiler in ANSI C99 compilation mode with its features.
-Ae Command-Line Option
-Ae
Setting the -Ae option invokes aC++ as an ANSI C compiler, with additional support for HP C
language extensions.
This option is a synonym for the -AC89 -ext option.
For C++, if -Ae is anywhere on the command line,
C-mode will be in effect. The options, -AA
and -AP, are ignored with warnings.
If both -Ae and -Aa are present, C-mode will be
in effect and the right most option determines whether extended ANSI (-Ae) or strict ANSI
(-Aa) is in effect. So, to get strict ANSI, both -Ae and -Aa option are required.
Note:
Some code that is a warning in C may be a fatal error in aC++.
-AP Command-Line Option
-AP
This option turns off -AA mode and uses the older C++ runtime libraries. This is the default.
See Choice of the C++ Runtime (-AA vs -AP) on HP-UX for more information on usage of -AP.
-Wc,-ansi_for_scope Command-Line Option
-Wc,-ansi_for_scope,[on|off]
This option enables or disables the standard scoping rules for init-declarations in for
statements; the scope of the declaration then ends with the scope of the loop body. By default,
the option is disabled.
Examples:
- In the following example, if the option is not enabled (the current default), the scope of k
extends to the end of the body of main() and statement (1) is valid (and will return zero). With
the option enabled, k is no longer in scope and (1) is an error.
#include <stdio.h>
int main() {
for (int k = 0; k!=100; ++k) {
printf("%d\n", k);
}
return 100-k; // (1)
}
-
In the following example, with the option disabled, the code is illegal, because it redefines k in (2)
when a previous definition (1) is considered to have occurred in the same scope.
With the option enabled (-Wc,-ansi_for_scope,on), the definition in (1) is no longer in scope
at (2) and thus the definition in (2) is legal.
int main() {
int sum = 0;
for (int k = 0; k!=100; ++k) // (1)
sum += k;
for (int k = 100; k!= 0; ++k) // (2)
sum += k;
}
-Wc,-koenig_loopup,[on][off] Command-Line Option
-Wc,-koenig_lookup,[on|off]
This option enables or disables standard argument-dependent lookup rules (also known as
Koenig lookup). It causes functions to be looked up in the namespaces and classes associated
with the types of the function-call argument. By default, the option is enabled.
Example:
In the following example, if the option is not enabled, the call in main() does not consider
declaration (1) and selects (2).With the option enabled, both declarations are seen, and in this
case overload resolution will select (1).
namespace N {
struct S {};
void f(S const&, int); // (1)
}
void f(N::S const&, long); // (2)
int main() {
N::S x;
f(x, 1);
}
For More Information:
+hpxstd98 Command-Line Option
+hpxstd98
+hpxstd98 is a command line option that enables new, standard compliant compilation mode. This option is independent of other compilation options.
The compiler defines the macro __hpxstd98 during compilation with +hpxstd98 option. This macro can be used in the source for conditional compilations, if required.
This option offers the following key features:
- Improved support for templates including support for template-template parameters
- Enhanced ANSI C++ standard compliance
- Rich set of diagnostics
- Completely binary compatible with objects created using earlier releases of compiler
- Approximately 5 to 6 percent improvement in the runtime performance of the application
Note:
The +hpxstd98 option is not enabled by default in this release of the compiler. This option is valid only for C++ compilations. Using -Ae/-AC99 (for C compilation) with +hpxstd98 turns off this option without any warning.
The +hpxstd98 option impacts the following areas:
- Pre-compiled Header files
- Compiler Diagnostics
- Pragmas
- OpenMP
Impact on Pre-compiled Header files:
Pre-compiled header (PCH) files created using a version prior to this release, and without the option +hpxstd98 are incompatible with PCH files created using the option +hpxstd98. The PCH files are re-created (when +hdr_cache is used) with a message if an incompatibility is detected.
Impact on Compiler Diagnostics:
The complier emits a completely new and improved set of diagnostics with the +hpxstd98 option.
Note:
All options referring to diagnostic numbers are to be modified to reflect the new diagnostic numbers when used with the +hpxstd98 option.
Example:
+Wearg1[,arg2,arg3....,argn] where arg1, arg2, arg3,... argn are new diagnostic numbers.
Impact on pragmas:
The +hpxstd98 option supports the following pragmas:
- #pragma PACK
- #pragma ALIGN
- #pragma VTABLE
- #pragma LOCALITY
- #pragma OPTIMIZE
- #pragma OPT_LEVEL
- #pragma COPYRIGHT
- #pragma COPYRIGHT_DATE
- #pragma VERSIONID
- #pragma extern
- #pragma HP_DEFINED_EXTERNAL
- #pragma HP_LONG_RETURN
- #pragma HP_NO_RELOCATION
All other pragmas are ignored with a warning during the compilation with +hpxstd98 option.
Impact on OpenMP:
OpenMP is not supported in this release of the compiler. The use of OpenMP features are ignored by the compiler with or without warnings.
|
| Subprocesses of the Compiler |
The following options allow you to substitute your own processes in
place of the default HP aC++ subprocesses, or pass options
to HP aC++ subprocesses.
- -tx,name - Substitutes name in place of subprocess x.
- -Wx,args - Passes the option arg to subprocess x of the HP aC++ compiling system.
-tx,name Command-Line Option
-tx,name
This option substitutes or inserts subprocess x, using name.
The parameter, x, is one or more identifiers indicating the subprocess or subprocesses. The
value of x can one or more of the following:
| a |
Assembler (standard suffix is as). |
| c |
Compiler (standard suffix is ctcom/ecom). |
| C |
See c. |
| f |
Filter tool (standard suffix is c++filt). |
| l |
Linker (standard suffix is ld). |
| p |
Preprocessor (standard suffix is cpp.ansi).
-tp must be used before any -Wp options can be
passed to cpp.ansi. To enable the external
preprocessor, use: -tp,/opt/langtools/lbin/cpp.ansi.
|
| u |
Stand-alone code generator (standard suffix is u2comp). |
| x |
All subprocesses. |
The -tx,name option works in two modes:
- If x is a single identifier, name represents the full path name of the new subprocess.
- If x is a set of identifiers, name represents a prefix to which the standard suffixes are concatenated to construct the full path names of the new subprocesses.
For example, the following command invokes the assembler /users/sjs/myasmb instead of
the default assembler /usr/ccs/bin/as to assemble and link file.s.
aCC -ta,/users/sjs/myasmb file.s
More Examples:
Following are some examples of -t option:
- Substituting for C++ file:
The following example compiles file.C and specifies that /new/bin/c++filt should be
used rather than the default /opt/aCC/bin/c++filt.
aCC -tf,/new/bin/c++filt file.C
- Substituting for ctcom:
The following example compiles file.C and specifies that /users/proj/ecom should be
used instead of the default /opt/aCC/lbin/ecom.
aCC -tC,/users/proj/ecom file.C
- Substituting for all Subprocesses:
The following example compiles file.C and specifies that the characters /new/aCC
should be used as a prefix to all the subprocesses of HP aC++ For example,
/new/aCC/ecom runs rather than the default /opt/aCC/lbin/ecom.
aCC -tx,/new/aCC file.C
This parameter is either the full path name of the executable file that
will be run, or a prefix that will be concatenated to the default path
name.
If x is a single identifier, name
represents the full path name of the new subprocess. If x
is a set of identifiers, name represents a prefix to which
the standard suffixes are concatenated to construct the full path names
of the new subprocesses.<
-Wx,args Command-Line Option
-Wx,arg1[,arg2,..,argn]
This option passes the arguments arg1 through argn to the subprocess x of the compilation.
Each argument, arg1, arg2, through argn takes the form:
-argoption[,argvalue]
where:
- argoption is the name of an option recognized by the subprocess.
- argvalue is a separate argument to argoption, where necessary.
The parameter, x, is one or more identifiers indicating a subprocess or subprocesses. The
value of x can be one or more of the following:
| a |
Assembler (standard suffix is as). |
| c |
Compiler (standard suffix is ctcom/ecom). |
| C |
See c. |
| f |
Filter tool (standard suffix is c++filt). |
| l |
Linker (standard suffix is ld). |
| p |
Preprocessor (standard suffix is cpp.ansi).
-tp must be used before any -Wp options can be
passed to cpp.ansi. To enable the external
preprocessor, use: -tp,/opt/langtools/lbin/cpp.ansi.
|
| x |
All subprocesses. |
The following example compiles file.C and passes the option -v to the linker.
aCC -Wl,-v file.C
The following example helps to see which include files led to an error or warning.
aCC -Wc -diagnose_includes file.C.
Use -diagnose_includes off (the default) to turn the option off.
Passing Options to the Linker with -W
The following example links file.o and passes the option -a archive to the linker, indicating
that the archive version of the math library (indicated by -lm) and all other driver supplied
libraries should be used rather than the default shared library.
aCC file.o -Wl,-a,archive -lm
Passing Multiple Options to the Linker with -W
The following example links file.o and passes the options -a, archive, -m, and -v to the
linker.
aCC -Wl,-a,archive,-m,-v file.o -lm
This case is similar to the previous example, with additional options. -m indicates that a load
map should be produced. The -v option requests verbose messages from the linker.
For More Information:
|
| Symbol Binding Options |
- -Bhidden - Hides all the symbols used in the translation unit.
- -Bhidden_def - Hides all the symbols used in the translation unit other than the externally defined symbols.
-Bhidden Command-Line Option
-Bhidden
This option hides all the symbols used in the translation unit other than
the symbols prefixed with __declspec(dllexport), __declspec(dllimport),
or specified using the HP_DEFINED_EXTERNAL pragma.
-Bhidden_def Command-Line Option
-Bhidden_def
This option hides all the symbols defined in the translation unit other than
the symbols prefixed with __declspec(dllexport), or specified using
the HP_DEFINED_EXTERNAL pragma.
|
| Template Options |
By using a template option on the aCC command line, you can:
- Close a library or set of link units, to satisfy all unsatisfied instantiations without creating duplicate instantiations.
- Specify what templates to instantiate for a given translation unit.
- Name and use template files in the same way as for the cfront based HP C++ compiler.
- Request verbose information about template processing.
Note:
All template options on an aCC command line apply to every file on the
command line. If you specify more than one incompatible option on a command
line, only the last option takes effect.
Options:
+inst_compiletime Command-Line Option
+inst_compiletime
This option causes the compiler to use the compile time (CTTI) instantiation mechanism to
instantiate templates. This occurs for every template used or explicitly instantiated in this
translation unit and for which a definition exists in the translation unit. This is the default.
Note:
This option is supported in C++ only. Silently ignored in -Ae mode.
+inst_directed Command-Line Option
+inst_directed
This option indicates to the compiler that no templates are to
be instantiated.
If you are using only explicit instantiation,
specify +inst_directed.
Example:
aCC +inst_directed prog.C
Compiles file.C with the resulting object
file containing no template instantiations, except for
any explicit instantiations coded in your souce file.
+inst_implicit_include Command-Line Option
+inst_implicit_include
This option specifies that the compiler use a process similar to that of the cfront source rule
for locating template definition files. For the cfront based HP C++ compiler, if you are using
default instantiation (that is, if you are not using a map file), you must have a template
definition file for each template declaration file, and these must have the same file name
prefix.
This restriction does not apply in HP aC++. Therefore, if your code was written for HP C++
and you wish to follow this rule when compiling with HP aC++, you need to specify the
+inst_implicit_include option.
Example:
aCC +inst_implicit_include prog.C
If prog.C includes a template declaration file named template.h, the compiler assumes a
template definition file name determined by the +inst_include_suffixes option.
For More Information:
+inst_include_suffixes Command-Line Option
+inst_include_suffixes "list"
list is a set of space separated file extensions or suffixes, enclosed in quotes, that template
definition files can have.
This option specifies which file name extensions the compiler uses to locate template
definition files. This option must be used with the +inst_implicit_include option.
The default extensions in order of precedence are:
- .c
- .C
- .cxx
- .CXX
- .cc
- .CC
- .cpp
User specified extensions must begin with a dot and must not exceed four characters in total.
Any extension that does not follow these rules causes a warning and is ignored.
These restrictions do not apply in HP aC++. Therefore, if your code was written for HP C++
and you wish to follow the cfront-based HP C++ template definition file naming conventions
when compiling with HP aC++, you need to specify the +inst_include_suffixes option.
The following example specifies that template definition files can have extensions of .c or .C.
+inst_include_suffixes ".c .C"
The +inst_include_suffixes option is equivalent to the HP C++ -ptS option.
For More Information:
|
| Verbose Compile and Link Information |
Use the following options to obtain additional information about:
- What HP compilers do while compiling or linking your program.
- Which subprocesses would execute for a given command line, without running the compiler.
- The current compiler and linker version numbers.
- Execution time.
Options:
- +dryrun - Requests compiler subprocess information without running the subprocesses.
- +O[no]info - Requests optimization information.
- +inst_v - Requests verbose information about template processing.
- +time - Requests execution times.
- -v - Requests verbose information of the compilation process.
- -V - Requests the current compiler and linker version numbers.
- -WI,-v - Requests verbose messages from the linker.
+dryrun Command-Line Option
+dryrun
This option generates subprocess information for a given command line without running the
subprocesses. It is useful in the development process to obtain command lines of compiler
subprocesses in order to run the commands manually or to use them with other tools.
Example:
aCC +dryrun app.C
This command line gives the same kind of information as the -v option but without running
the subprocesses.
+time Command-Line Option
+time
This option generates timing information for compiler subprocesses. For each subprocess,
estimated time is generated in seconds for user processes, system calls, and total processing
time. This option is useful in the development process, for example, when tuning an
application’s compile-time performance.
Examples:
/opt/aCC/lbin/ctcom -inst compiletime -diags 523 -D __hppa -D __hpux
-D __unix -D __hp9000s800 -D __STDCPP__ -D __hp9000s700 -D _PA_RISC1_1
-I /opt/aCC/include -I /opt/aCC/include/iostream -I /usr -I
/usr/include -I /usr/include -inline_power 0 app.C
file name: app.C
file size: app.o 444 + 16 + 1 = 461
process user sys real
------------------------------------------
process: compiler 0.93 0.13 1.17
------------------------------------------
line numbers: app.C 7
lines/minute: app.C 396
LPATH=/usr/lib:/usr/lib/hpux32/pa1.1 :/usr/lib:/opt/langtools/lib:/usr/lib
/opt/aCC/lbin/ld -o a.out /opt/aCC/lib/crt0.o -u ___exit -u main
-L /opt/aCC/lib /opt/aCC/lib/cpprt0.o app.o -lstd -lstream -lCsup -lm
/usr/lib/hpux32/libcl.a -lc /usr/lib/hpux32/libdld.so >/usr/tmp/AAAa28149 2>&1
file size: a.out 42475 + 1676 + 152 = 44303
process user sys real
------------------------------------------
process: ld 0.35 0.24 0.82
------------------------------------------
total link time(user+sys): 0.59
removing /usr/tmp/AAAa28149
removing app.o
-v Command-Line Option
-v
This option enables verbose mode, sending a step-by-step description of the compilation
process to stderr. This option is especially useful for debugging or for learning the
appropriate commands for processing a C++ file.
Example:
The following command compiles file.C and gives extra information about the process of compiling.
aCC -v file.C
/opt/aCC/lbin/ctcom -inst compiletime -diags 523 -D __hppa -D __hpux
-D __unix -D __hp9000s800 -D __STDCPP__ -D __hp9000s700 -D _PA_RISC1_1
-I /opt/aCC/include -I /opt/aCC/include/iostream -I /usr -I /usr/include
-I /usr/include -inline_power 0 app.C
LPATH=/usr/lib:/usr/lib/hpux32/pa1.1
:/usr/lib:/opt/langtools/lib:/usr/lib
/opt/aCC/lbin/ld -o a.out /opt/aCC/lib/crt0.o -u ___exit -u main
-L /opt/aCC/lib /opt/aCC/lib/cpprt0.o app.o -lstd -lstream -lCsup
-lm /usr/lib/hpux32/libcl.a -lc /usr/lib/hpux32/libdld.so >/usr/tmp/AAAa28149 2>&1
removing /usr/tmp/AAAa28149
-V Command-Line Option
-V
This option displays the version numbers of the current compiler and linker (if the linker is
executed). Use this option whenever you need to know the current compiler and linker version
numbers.
Example:
aCC -V app.C
|
| Concatenating Options |
You can concatenate some options to the aCC command under
a single prefix. The longest substring that matches an option
is used. Only the last option can take an argument. You can concatenate
option arguments with their options if the resulting string
does not match a longer option.
Examples:
Suppose you want to compile my_file.C using the
options -v and -g1. Below are equivalent command lines you could use:
- aCC my_file.C -v -g1
- aCC my_file.C -vg1
- aCC my_file.C -vg1
- aCC -vg1 my_file.C
+opts Command-Line Option
+opts filename
The file indicated by filename contains a list of
options, which are processed as if they were specified
on the command line at the point of the +opts option.
The content of a filename can contain comments by using a "#" in column 1.
|
| Other Options |
-y Command-Line Option
-y
This option generates a Static Analysis database if SoftBench is
installed and /opt/softbench/bin is at the beginning of
your path. For more information on SoftBench Static
Analysis, see the C and C++ SoftBench User's Guide
manual.
|