search    
Hewlett-Packard
Command-Line Options
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.

Default options can be set using option configuration files. Refer to System Wide Configuration in the Command Syntax and Environment Variables topic.

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:
  • -c - compiles one or more source files without entering the linking phase.
  • +DO[osname] - sets the target operating system for the compiler; intended for enabling optimizations that are not backward compatible.
  • +DDdata_model - generates object code for either the ILP32 or LP64 data model.
  • +DSmodel - performs instruction scheduling tuned for a particular architecture.
  • -S - compiles to assembly language without linking.

-c Command-Line Option

The -c option is used to compile one or more source files without 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.


+DOosname 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 :

  • 11.20
  • 11.22
  • 11.23
  • 11.31
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 option generates ILP32 code and is the default.
  • 64 - This option 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.

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

This option performs instruction scheduling for a particular implementation of the Itanium®-based architecture. model can be one of the following values:

  • blended - Tune to run reasonably well on multiple implementations. As old implementation become less important and new implementations are added, the behavior with this value will change accordingly.
  • itanium - Tune for the Itanium® processor.
  • itanium2 - Tune for the Itanium2® processor.
  • mckinley - See itanium2.
  • montecito - Tune for the Montecito processor.
  • native - Tune for the processor on which the compiler is running.
The default is blended. Object code with scheduling tuned for a particular model will execute on other HP-UX Integrity systems, although possibly less efficiently.

Using +DS to Specify Instruction Scheduling

Instruction scheduling is different on different implementations of Itanium®-based architectures. You can improve performance on a particular model or processor of the HP-UX system 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.

  • If you plan to run your program on the same system where you are compiling, make sure you have selected the correct model. By default, the compiler will use the +DS blended option. The compiler will not automatically generate code tuned for your system.
  • If you plan to run your program on one particular model of the HP-UX system, use +DSmodel with the processor name of the target 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 of the hosts where the source or object files reside do not affect the default code generation and scheduling.


-S Command-Line Option

This option compiles a program and logs the assembly language output in a corresponding file with a .s suffix. The -S option is only for displaying the assembler code. The generated code is not intended to be used as input to the assembler (as).

Example:

aCC -S prog.C
This command compiles prog.C to assembly code rather than to object code, and puts the assembly code in the file prog.s. The -S option creates an assembly file in addition to the object file.

Data Alignment and Storage
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.

For additional information on unaligned data access refer to Handling Unaligned Data in the Pragmas topic.

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
cc -Agcc -Wc, -fshort-enums foo.c
aCC -Ag++ -Wc, -fshort-enums foo.c

This option is used with the -Agcc or -Ag++ options to cause each enum type to be represented using the smallest integer type that is capable of representing all values of the enum type. Because it changes the representation of types, the code generated is NOT binary compatible with code compiled without the option. The primary use of this option is for compatibility with gcc, but it can provide performance improvement to applications that can accept the binary incompatibility.

+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

Debugging Options
The following debugging options enable you to use the HP WDB Debugger:
  • +d - Disables all inlining of functions
  • +expand_types_in_diag - Expands typedefs in diagnostics.
  • -g - Generates minimal information for debugging
  • -g0 - Generates full information for debugging
  • -g1 - Generates minimal information for debugging
  • +macro_debug - Controls the emission of macro debug information into the object file.
  • +[no]objdebug - Generates debug information in object files and not in the executable
  • +keep - Keeps temporary files and saves diagnostic information for compiler debugging.
  • +pathtrace - Provides a mechanism to record program execution control flow into global and/or local path tables.
  • +[no]srcpos - Controls the generation of source position information.

+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 disables inlining thereby allowing you to set breakpoints at functions specified as inline. <\p>

Also see:
+O[no]inline Command-line option


+expand_types_in_diag Command-Line Option

The +expand_types_in_diag option expands typedefs in diagnostics so that both the original and final types are present.


-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.


+macro_debug= Command-Line Option

+macro_debug={ref|all|none}

This option controls the emission of macro debug information into the object file.

Set +macro_debug to one of the following required values:

ref Emits debug information only for referenced macros. This is the default for -g,   -g1, or -g0.
all Emits debug information for all macros. This option can cause a significant increase in object file size.
none Does not emit any macro debug information.

One of the -g options (-g, -g0, or -g1) must be used to enable the +macro_debug option.


+[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.


Note: With +objdebug, the object files or archive libraries must not be removed.

+objdebug is default at link time and at compile time.

If +noobjdebug is used at link time, all debug information goes into the executable, even if some objects were compiled with +objdebug.

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 option when using +ild.


+keep Command-Line Option
+keep
This option instructs the compiler to keep all temporary files and generate other information useful in diagnosing compiler failures. The option will save IELF files, generate a post processed source file and save state information in an .env file. The state information contains such things as version strings of various compiler components, the command line options used, and machine configuration.


+pathtrace Command-Line Option
+pathtrace[=kind]
This option provides a mechanism to record program execution control flow into global and/or local path tables. The saved information can be used by the HP WDB debugger to assist with crash path recovery from the core file, or to assist when debugging the program by showing the executed branches.

Currently only if, else, switch-case-default, and try-catch execution paths are recorded in the path table. If there is no condition statement inside a for, while, or do-while loop, then no execution path is recorded.

The defined values for kind are:

 local Generates a local path table and records basic block-execution information in it at runtime.
global Generates a global path table and records basic block-execution information in it at runtime.
global_fixed_size Generates a fixed-size (65536 items) global path table and records basic block-execution information in it at runtime.

This form differs from +pathtrace=global because the size of the table cannot be configured at runtime, and the contents cannot be dumped to a file. The fixed-size global path table has better runtime performance than the configurable global path table. The performance difference varies depending on the optimization level and how the program is written.

none Disables generation of both the global and local path tables.

The values can be combined by joining them with a colon. For example:

+pathtrace=global:local

The global_fixed_size and global values are mutually exclusive. If more than one of them are specified on the command line, the last one takes precedence. The same is true for the none value.

+pathtrace with no values is equivalent to +pathtrace=global_fixed_size:local

The use of this option and the -mt option must be consistent for all compilation and link steps. That means if -mt is used with +pathtrace at compile time, it should also be used at link time; if -mt is not used with +pathtrace at compile time, it should not used at link time. Otherwise, a link-time error can occur.

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, except those explicitly enabled with +Wwargs or a subsequent +w-prefix option.
  • +w - Warns about all questionable constructs
  • +w64bit - Enables warnings that help detection of potential problems in converting 32-bit applications to 64-bit
  • +Wargs - Selectively suppresses compiler warnings
  • +Wcontext_limit - Limits the number of instantiation contexts output by the compiler for diagnostics involving template instantiations.
  • +We - Interprets all warning and future error messages as errors
  • +Weargs - Selectively interprets warnings or future errors as errors
  • +wlint - Enables several warnings in the compiler that provide lint like functionality
  • +Wmacro - Disables specified warning diagnostics in the expansion of a specified macro.
  • +wn - Specifies the level of the warnings messages
  • +wperfadvice - Enables performance advisory messages.
  • +wsecurity - Enables compile-time diagnostics for potential security violations
  • +Wv - Displays the description for diagnostic messages
  • +Wwargs - Selectively treats compiler remarks or discretionary errors as warnings

You can use the cadvise report feature of the HP Code Advisor tool to help analyze compiler errors and warnings.


+p Command-Line Option

This option disallows all anachronistic constructs.

Ordinarily, 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 disables all warnings except those that are explicitly enabled with +Wwargs or a subsequent +w-prefix option. By default, the compiler reports all errors and warnings.

HP recommends against using the -w option. In addition to disabling messages currently output by the compiler, it will also disable any new messages added to the compiler in the future that could identify problem areas in user code. HP recommends using the +Wargs option to disable a message. Although it can often take a long list of +Warg options to disable all desired warnings, this list can be included in an options file and referenced using the +opts option to avoid listing them all directly on the command line.

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. +w enables all checks except for the +wsecurity and +wendian warnings. Those need to be enabled explicitly if needed. 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.


Note: This option is equivalent to the +w1 option of legacy HP C.

+w64bit Command-Line Option

Enable warnings that help detection of potential problems in converting 32-bit applications to 64-bit. The +w64bit option applies only to a 64-bit compile (using +DD64). The option is equivalent to the +M2 option.


+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


+Wcontext_limit= Command-Line Option

+Wcontext_limit=num
This option limits the number of instantiation contexts output by the compiler for diagnostics involving template instantiations. At most num outermost contexts and num innermost contexts are shown. If there are more than 2 * num relevant contexts, the additional contexts are omitted.

Omitted contexts are replaced by a single line separating the outermost num contexts from the innermost num contexts, and indicating the number of contexts omitted. The default value for num is 5. A value of 0 removes the limit.


+We Command-Line Option

This option interprets all warning and future error messages as errors. See Weargs.


+Weargs Command-Line Option
+Wearg1[,arg2,..,argn]
This option selectively interprets any specified warning or future error messages as errors. arg1 through argn must be valid compiler warning message numbers.

Example:

aCC +We600,829 app.C


+wlint Command-Line Option

This option enables several warnings in the compiler that provide lint like functionality. Checks are made for memory leaks, out-of-scope memory access, null pointer dereference, and out-of-bounds access. These compile time diagnostics can be very useful in detecting potential problems in the source code. To disable a specific warning introduced by +wlint, a +Wargs option can be used after the +wlint option.

NOTE: The +wlint option is only supported on Integrity systems.


+Wmacro Command-Line Option
+Wmacro:MACRONAME:d1,d2,...,dn

This option disables warning diagnostics d1,d2,...,dn in the expansion of macro MACRONAME. If -1 is given as the warning number, then all warnings are suppressed. This option is not applicable to warning numbers greater than 20000. +Wmacro gets higher priority than the other diagnostic-control command-line options that are applicable to the whole source. Diagnostic control pragmas take priority based on where they are placed.


+wn Command-Line Option

This option specifies the level of the warnings messages.

+wn
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.


+wperfadvice Command-Line Option

This option enables performance advisory messages.

+wperfadvice[={1|2|3|4}]
The level 1, 2, 3, or 4 controls how verbosely the performance advisory messages are emitted. The higher the level, the more messages generated. Level 1 emits only the most important messages, while level 4 emits all the messages. If the optional level is not specified, it defaults to 2.


+wsecurity Command-Line Option

This option enables compile-time diagnostics for potential security violations.

+wsecurity[={1|2|3|4}]  

The value 1, 2, 3, or 4 controls how verbosely the security check warnings are emitted. The higher the check level, the more warnings can be generated. Note that this may also generate more false positives. The default level is 2.

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 on Integrity systems.


+Wv Command-Line Option

+Wv[d1,d2,...,dn]
This option displays the description for diagnostic message numbers d1 through dn.

Specifying this option causes the compiler to emit the descriptive text for the specified diagnostics to stderr. This option must not be used with any other compiler options.

If the description for a diagnostic is not available, the compiler emits only the diagnostic with a note that the description is not available.


+Wwargs Command-Line Option

+Wwarg1[,arg2,..,argn]
This option selectively treats compiler remarks or discretionary errors 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. Mixing code compiled with and without +noeh can have undesired results.

Example:

aCC +noeh progex.C
This command compiles and links progex.C, which does not use exception handling.

Extensions to the Language
The following options support extensions to the C++ language:
  • -ext - Enables HP value added features.
  • +e - Enables 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.
When this option is used with -AC89 or -AC99, it defines the following macros:
  • -D__STDC_EXT__
  • -D_HPUX_SOURCE (unless -Aa is used)

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;
}


+e Command-Line Option

+e
This option is a synonym of the -ext option.

Floating-Point Processing Options
The following command line options are used for floating-point processing:
  • +O[no]cxlimitedrange - Enables[disables] the use of the usual formulas for complex arithmetic.
  • +O[no]fenvaccess - Accesses[does not access] the floating-point environment.
  • +FPmode - Specifies runtime environment.
  • -fpeval - Specifies minimum precision for expression evaluation.
  • -[no]fpwidetypes - Enables extended and quad data types.
  • +O[no]fltacc - Disables [enables] all optimizations that cause imprecise floating-point results
  • +O[no]libmerrno - Enables[disables] support for errno in libm functions.
  • +Oprefetch_latency - Applies to loops for which the compiler generates data prefetch instructions.
  • +O[no]sumreduction - Enables sum reduction optimization

+O[no]cxlimitedrange Command-Line Option
+O[no]cxlimitedrange

The usual mathematical formulas for complex multiply, divide, and absolute value are problematic because of their treatment of infinities and because of undue overflow and underflow.

The +O[no]cxlimitedrange command-line option enables[disables] the use of the usual formulas for complex arithmetic. The default is +Onocxlimitedrange.

The CX_LIMITED_RANGE pragma can be used to inform the implementation that (where the state is on) the usual mathematical formulas are acceptable.

This option is equivalent to adding the following pragma at the beginning of the source file:

# pragma STDC CX_LIMITED_RANGE

See STDC CX_LIMITED_RANGE Pragma for more information.


+O[no]fenvaccess Command-Line Option
+O[no]fenvaccess
This option provides a means to inform the compiler when a program might access the floating-point environment to test flags or run under non-default modes.

Use of the option +Onofenvaccess allows certain optimizations that could subvert flag tests and mode changes such as global common subexpression elimination, code motion, and constant folding.

The default is +Onofenvaccess.

This option is equivalent to adding the following pragma at the beginning of each source file submitted for compilation:

#pragma STDC FENV_ACCESS ON

See STDC FENV_ACCESS Pragma for more information.


+FPmode Command-Line Option
+FPmode

This option specifies how the run-time environment for floating-point operations should be initialized at program startup. By default, modes are as specified by the IEEE floating-point standard: all traps disabled, gradual underflow, and rounding to nearest. See ld(1) for specific values of mode. To dynamically change these settings at run time, refer to fenv(5), fesettrapenable(3M), fesetflushtozero(3M), and fesetround(3M).

The following table has a partial list of some of the mode values. 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.


-fpeval Command-Line Option
-fpeval=precision

This option specifies the minimum precision to use for floating-point expression evaluation. This option does not effect the precision of parameters, return types, or assignments.

The defined values for precision are:

float Evaluates floating-point expressions and constants in their semantic type.
double Evaluates float operations and constants using the range and precision of double, and evaluates all other floating-point expressions and constants in their semantic type.
extended Utilizes hardware support of these floating-point registers for optium speed in floating-point computations. Evaluates float and double constants and expressions using the range and precision of the extended type, and evaluates all other floating-point expressions in their semantic type. This option while providing greater precision than double, does not provide greater speed than double or float.

The default is -fpeval=float.


-[no]fpwidetypes Command-Line Option
-[no]fpwidetypes

This option enables [disables] extended and quad floating-point data types. Quad is equivalent to long double. This option also enables __float80 prototypes.

The compiler defines _FPWIDETYPES when -fpwidetypes is in effect.

The default is -nofpwidetypes.


+O[no]libmerrno Command-Line Option
+O[no]libmerrno

This option enables [disables] support for errno in libm functions.

The default is +Onolibmerrno.

In C-mode, the default is +Olibmerrno with -Aa option.


+Oprefetch_latency Command-Line Option
+Oprefetch_latency=cycles

+Oprefetch_latency applies to loops for which the compiler generates data prefetch instructions. cycles represents the number of cycles for a data cache miss. For a given loop, the compiler divides cycles by the estimated loop length to arrive at the number of loop iterations for which to generate advance prefetches.

cycles must be in the range of 0 to 10000. A value of 0 instructs the compiler to use the default value, which is 480 cycles for loops containing floating-point accesses and 150 cycles for loops that do not contain any floating-point accesses.

For tuning purposes, it is recommended that users measure their application’s performance using a few different prefetch latency settings to determine the optimal value. Some floating-point codes may benefit by increasing the distance to 960. Parallel applications frequently benefit from a shorter prefetch distance of 150.


+O[no]sumreduction Command-Line Option
+O[no]sumreduction

This option enables[disables] sum reduction optimization. It allows[does not allow] the compiler to compute partial sums to allow faster computations. It is not technically legal to do this in C or C++ because of float accuracy issues. This option is useful if an application cannot use +Onofltacc but wants sum reduction to be performed.

When sum reduction optimization is enabled, the compiler may evaluate intermediate partial sums of float or double precision terms using (wider) extended precision, which reduces variation in the result caused by different optimization strategies and generally produces a more accurate result.

Header File Options
The following is a list of header file options:
  • -H - Dumps the include file hierarchy to stderr.
  • +hdr_create - Creates a precompiled header file.
  • +hdr_use - Inserts the referenced precompiled header file.
  • -Idirectory - Adds directory to the directories to be searched for #include files
  • -I- - Overrides the default -Idirectory search-path.

-H Command-Line Option
cc -H file

The -H option enables HP aC++/HP C to print the order and hierarchy of included files. The -H option dumps the include file hierarchy to stderr so that the preprocessed compiler output indicates the include file nesting.


+hdr_create Command-Line Option
aCC progname -c +hdr_create headername

This option extracts the header from a program file and saves it as a precompiled header file.

Example:

aCC ApplicTemplate.C -c +hdr_create ApplicHeader

+hdr_use Command-Line Option
aCC progname +hdr_use headerfile -c

This option adds a precompiled header file to a program when the program is compiled.

Example:

aCC Applic.C +hdr_use AddedHeader

-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:

  1. The directory of the source file containing the #include.
  2. The directory named in the -I option.
  3. The standard include directories /opt/aCC/include and /usr/include.

-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:
  1. It changes the compiler’s search-path for quote enclosed (" ") file names in a #include directive to the following order:
    1. The directory named in the -I option.
    2. The standard include directories /opt/aCC/include* and /usr/include.
    The preprocessor does not search the directory of the including file.

  2. 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 bya.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 online helper’s Guide.


+help Command-Line Option
+help

This option invokes the main page (index.htm) of the online help.

If +help is used on any command line, the compiler displays the online help 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 help, use the command:
aCC +help
Inlining Options

The following options allow you to specify the amount of source code inlining done by the HP aC++ compiler:

  • +d - Disables all inlining of functions
  • +inline_level - Allows you to specify the amount of source code inlining done by the HP aC++ compiler.
  • +O[no]inline - Inlines [does not inline] procedure calls
  • +Oinlinebudget - Controls the compile time budget for the inliner

+inline_level num Command-Line Option
+inline_level num

This option controls how C++ inlining hints influence HP aC++. Such inlining happens in addition to functions explicitly tagged with the inline keyword. (For C89, use the __inline keyword). This option controls functions declared with the inline keyword or within the class declaration and is effective at all optimization levels.

Specify num as an integral value between 0 and 9. Refer to the tables below.

num Description
0 No inlining is done (same effect as the +d option).
1 Only functions marked with inline or implied by the language to be inline are considered for inlining. (This is the default for C++ at +O1).
2 More inlining than level 1. This is the default level at optimization levels +O2, +O3, and +O4.
3-8 Increasing levels of inliner aggressiveness.
9 Attempt to inline all functions other than recursive functions or those with a variable number of arguments.

The default level depends on +Olevel as shown in the following table:

level num
0 1
1 1
2 2
3 2
4 2


Note: The options +d and +inline_level 0 turn off all inlining, including implicit inlining. The options +Oinline and +Oinlinebudget also influence inlining aggressiveness.

Example:

aCC +inline_level 3 app.C
Library Options
The following library options allow you to create, use, and manipulate libraries:
  • +A - Causes the linker to link with archive libraries.
  • -b - Creates a shared library.
  • -dynamic - Specifies dynamically bound executables.
  • -exec - Creates an executable file from an object file.
  • -lname - Specifies a library for the linker to search.
  • -Ldirectory - Specifies a directory for the linker to search for libraries.
  • -minshared - Indicates an executable makes minimal use of shared libraries.
  • +nostl - Suppresses searching of default -I and -L directory paths and some -l libraries.
  • +Onolibcalls= - Allows you to turn off optimization for listed functions.

+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.

Example:

aCC +A file.o -lm

This command links file.o and links in the archived version of the math library, /lib/libm.a, rather than the shared version, /lib/libm.so. It does not link in /usr/lib/hpux32/libdld.so.


Note: This option is not available on Integrity systems. See -minshared for more information.

-b Command-Line Option
 -b
 

This option creates a shared library rather than an executable file.

Example:

 aCC -b utils.o -o utils.so
 
This command links utils.o and creates the shared library utils.so.

For more information on shared libraries, refer to Creating and Using Libraries.


-dynamic Command-Line Option
-dynamic

This option produces dynamically bound executables. The default is -dynamic.

See -minshared Command-Line Option for partially statically bound executables.


-exec Command-Line Option
-exec

This option indicates that any object file created will be used to create an executable file. Constants with a protected or hidden export class are placed in the read-only data section. This option also implies -Bprotected_def. It makes all defined functions and data (even tentatively defined data) protected by default (unless otherwise specified by another binding option or pragma).


-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/hpux32/name.so
  • /usr/lib/hpux32/name.a
  • /opt/langtools/lib/hpux32/name.so
  • /opt/langtools/lib/hpux32/name.a

Whether it searches the shared library (.so) or the archive library (.a) depends on the value of the -a linker option or the -minshared compiler option.

Example:

aCC file.o -lnumeric

This command directs the linker to link file.o and (by default) search the library /usr/lib/hpux32/libnumeric.so.


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.

-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.

Example:

aCC -L/project/libs prog.C -lmylib1 -lmylib2

This command compiles and links prog.C and directs the linker to search the directories and /project/libs for any libraries that prog.C uses (in this case, mylib1 and mylib2).

See the -lname option for default search path.

The -L option affects only those -lname options that are subsequent to it on the command line. This option is passed directly to the linker.


-minshared Command-Line Option
-minshared

This option indicates that the result of the current compilation is going into an executable file that will make minimal use of shared libraries.

This option is equivalent to -exec -Bprotected.


+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.


Note: Complete understanding of the linking process and the behavior of the actual (third party) libraries linked with the application is essential to avoid link or runtime failures.


+Onolibcalls= Command-Line Option
+Onolibcalls=function1,function2,...

This option allows you to turn off libcall optimizations (inlining or replacement) for calls to the listed functions. This option overrides system header files.


Linker Options
You can specify the following linker options on the compiler command line:
  • -e epsym - Sets the default entry point address for the output file
  • -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
  • -r - Retains relocation information for subsequent re-linking
  • -s - The linker strips the symbol table from the executable file it produces
  • -usymbol - Enters symbol as an undefined symbol in ld's symbol table
  • +ild - Specifies incremental linking
  • +ildrelink - Performs an initial incremental link
  • -z - Disallows dereferencing of null pointers at runtime.
  • -Z - Allows dereferencing of null pointers at runtime.

-e epsym Command-Line Option
-e epsym

Using this option sets the default entry point address for the output file to be the same as the symbol epsym. This option only applies to executable files. It does not work if epsym=xec.


-n Command-Line Option
-n

This option causes the program file produced by the linker to be marked as sharable.


-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.


-q Command-Line Option
-q

This option causes the output file from the linker to be marked as demand-loadable.


-Q Command-Line Option
-Q

This option causes the program file from the linker to be marked as not demand-loadable.


-r Command-Line Option
-r

Use this option to retain relocation information in the output file for subsequent relinking.


-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.


-usymbol Command-Line Option
-usymbol

Enter symbol as an undefined symbol in ld’s symbol table. The resulting unresolved reference is useful for linking a program solely from object files in a library. More than one symbol can be specified, but each must be preceded by -u.


+ild Command-Line Option
+ild

This option specifies incremental linking. If the output file does not exist, or if it was created without the +ild option, the linker performs an initial incremental link. The output file produced is suitable for subsequent incremental links. The incremental link option is valid for both executable and shared library links. It is not valid for relocatable links, options or tools that strip the output module, and certain optimization options.


+ildrelink Command-Line Option
+ildrelink

This option performs an initial incremental link, regardless of the output load module. In certain situations during incremental linking (for example, internal padding space is exhausted), the incremental linker is forced to perform an initial incremental link. The +ildrelink option allows you to avoid such unexpected initial incremental links by periodically rebuilding the output file.

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.

Runtime Checking

The following option allows you to check the programs for errors at run time:

The following options control dereferencing of null pointers:

  • -z - Disallows dereferencing of null pointers at runtime.
  • -Z - Allows dereferencing of null pointers at runtime.

-z Command-Line Option
-z

This option disallows dereferencing of null pointers at runtime. 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 at runtime. This is the default. The value of a dereferenced null pointer is zero.


+check= Command-Line Option
+check=all|none|bounds|globals|mall