HPlogo HP C/HP-UX Release Notes for HP-UX 11.0: HP 9000 Computers > Chapter 1 New and Changed Features

New or Changed Options

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

The following command line options are new in this release of HP C/HP-UX.

+objdebug Option

NOTE: You must install the latest linker patch (PHSS_16841) or its successor for this option to work. Without this patch, the option is ignored.

When used with -g, +objdebug leaves debug information in the object files instead of copying it to the executable file at link time, resulting in shorter link times and smaller executables. The default, +noobjdebug, copies the debug information to the executable file.

When you specify -g, the compiler places symbolic debugging information into the object files. By default, the linker calls pxdb which compacts this debug information & copies it to the executable file. When +objdebug was used at compile time, the linker leaves the debug information in the object files. To debug the executable file, the HP WDB debugger must have access to the object files. If you move the object files, use HP WDB's objectdir command to tell it where the object files are. (The HP DDE debugger does not support this option.) This option reduces link time and the size of the executable file by avoiding this copying of debug information.

The compile-time default is +noobjdebug. If the linker detects any object files that were compiled with +objdebug, it will leave the debug information in those files. Any object files not compiled with +objdebug will have their debug information copied into the executable file. You can leave debug information in some object files and not in others.

Use the +noobjdebug option when linking to explicitly tell the linker to copy all debug information to the executable file, even from files compiled with +objdebug.

For information on the HP WDB debugger, see the help file in /opt/langtools/wdb/doc/index.html.

+W n1[, n2, ... nN] Option

This option suppresses the specified warnings, where n1 through nN are valid compiler warning message numbers. See the file /opt/ansic/lib/nls/msg/C/cc.msgs for a partial list of compiler messages. Or use the dumpmsg(1) command to see compiler messages in the catalog files in /opt/ansic/lib/nls/msg/C.

+We n1[, n2, ...nN] Option

This option changes the specified warnings to errors, where n1 through nN are valid compiler warning messages. See the file /opt/ansic/lib/nls/msg/C/cc.msgs for a partial list of compiler messages. Or use the dumpmsg(1) command to see compiler messages in the catalog files in /opt/ansic/lib/nls/msg/C.

+Ww n1[, n2, ...nN] Option

This option enables the specified warnings. Use it to enable specific warnings when all other warnings have been suppressed with -w or +w3. Or use it to enable specific warnings that would otherwise be enabled with the +w1 option. It cannot be used to enable +Mn migration warnings. n1 through nN are valid compiler warning messages. See the file /opt/ansic/lib/nls/msg/C/cc.msgs for a partial list of compiler messages. Or use the dumpmsg(1) command to see compiler messages in the catalog files in /opt/ansic/lib/nls/msg/C.

+Olevel=name1[,name2,...] Option

Optimization levels: 1, 2, 3, 4

Default: All functions are optimized at the level specified by the ordinary +Olevel option.

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 -O or an ordinary +Olevel option.

This option works the same as the OPT_LEVEL pragma described under "Optimizer Control Pragmas" in the HP C/HP-UX Programmer's Guide. This option overrides the OPT_LEVEL 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 in the ordinary +Olevel or -O option. To avoid confusion, it is best to use either this option or the OPT_LEVEL pragma rather than both.

Examples

The following command optimizes all functions at level 3, except for the functions myfunc1 and myfunc2, which it optimizes at level 1.

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

$ cc -O +O0=myfunc1,myfunc2 funcs.c main.c

The following command optimizes myfunc1 at level 2, myfunc2 at level 1, and all other functions at level 3.

$ cc +O3 +O1=myfunc1,myfunc2 +O2=myfunc1 funcs.c main.c

+Oreusedir=directory Option

Optimization levels: 4 or with profile-based optimization

Default: no reuse of object files

This option specifies a directory where the linker can 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 that when you do 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.

+O[no]promote_indirect_calls Option

Optimization levels: 3, 4 and profile-based optimization

Default: +Onopromote_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 conditionally-executed direct calls. If +Oinline is in effect, the optimizer may also inline the promoted calls. This option is only effective with profile-based optimization, described in "Profile-Based Optimization" in the HP C/HP-UX Programmer's Guide.

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.

At +O3, this option 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.

© 1999 - Hewlett-Packard Development Company, L.P.