#pragma options

Applies to C Applies to C++

Description

The #pragma options directive specifies compiler options for your source program.

Syntax


Syntax Diagram

Notes

By default, pragma options generally apply to the entire compilation unit.

To specify more than one compiler option with the #pragma options directive, separate the options using a blank space. For example:

#pragma options langlvl=stdc89 halt=s spill=1024 source

Most #pragma options directives must come before any statements in your source program; only comments, blank lines, and other #pragma specifications can precede them. For example, the first few lines of your program can be a comment followed by the #pragma options directive:

/* The following is an example of a #pragma options directive: */
#pragma options langlvl=stdc89 halt=s spill=1024 source
/* The rest of the source follows ... */

Options specified before any code in your source program apply to your entire compilation unit. You can use other #pragma directives throughout your program to turn an option on for a selected block of source code. For example, you can request that parts of your source code be included in your compiler listing:

#pragma options source 
/*  Source code between the source and nosource #pragma
    options is included in the compiler listing                */
#pragma options nosource

The settings in the table below are valid options for #pragma options. For more information, refer to the pages of the equivalent compiler option.

Language Application Valid settings for #pragma options option_keyword Compiler option equivalent Description
Artwork for ngclang
Applies to C++
align=option -qalign Specifies what aggregate alignment rules the compiler uses for file compilation.
Artwork for ngclang
Applies to C++
[no]ansialias -qalias Specifies whether type-based aliasing is to be used during optimization.
Artwork for ngclang
Applies to C++
assert=option -qalias Requests the compiler to apply aliasing assertions to your compilation unit.
Artwork for ngclang
Applies to C++
[no]attr

attr=full

-qattr Produces an attribute listing containing all names.
Artwork for ngclang
Applies to C++
chars=option -qchars

See also #pragma chars

Instructs the compiler to treat all variables of type char as either signed or unsigned.
Artwork for ngclang
Applies to C++
[no]check -qcheck Generates code which performs certain types of run-time checking.
Artwork for ngclang
Applies to C++
[no]compact -qcompact When used with optimization, reduces code size where possible, at the expense of execution speed.
Artwork for ngclang
Applies to C++
[no]dbcs -qmbcs, dbcs String literals and comments can contain multibyte characters.
Artwork for ngclang

[no]dbxextra -qdbxextra Generates symbol table information for unreferenced variables.
Artwork for ngclang
Applies to C++
[no]digraph -qdigraph Allows special digraph and keyword operators.
Artwork for ngclang
Applies to C++
[no]dollar -qdollar Allows the $ symbol to be used in the names of identifiers.
Artwork for ngclang
Applies to C++
enum=option -qenum

See also #pragma enum

Specifies the amount of storage occupied by the enumerations.
Artwork for ngclang
Applies to C++
flag=option -qflag Specifies the minimum severity level of diagnostic messages to be reported.

Severity levels can also be specified with:

#pragma options flag=i => #pragma report (level,I)

#pragma options flag=w => #pragma report (level,W)

#pragma options flag=e,s,u => #pragma report (level,E)

Artwork for ngclang
Applies to C++
float=[no]option -qfloat Specifies various floating point options to speed up or improve the accuracy of floating point operations.
Artwork for ngclang
Applies to C++
[no]flttrap=option -qflttrap Generates extra instructions to detect and trap floating point exceptions.
Artwork for ngclang
Applies to C++
[no]fullpath -qfullpath Specifies the path information stored for files for dbx stabstrings.
Artwork for ngclang
Applies to C++
[no]funcsect -qfuncsect Places intructions for each function in a separate cset.
Artwork for ngclang
Applies to C++
halt -qhalt Stops compiler when errors of the specified severity detected.
Artwork for ngclang
Applies to C++
[no]idirfirst -qidirfirst Specifies search order for user include files.
Artwork for ngclang
Applies to C++
[no]ignerrno -qignerrno Allows the compiler to perform optimizations that assume errno is not modified by system calls.
Artwork for ngclang
Applies to C++
ignprag=option -qignprag Instructs the compiler to ignore certain pragma statements.
Artwork for ngclang
Applies to C++
[no]info=option -qinfo

See also #pragma info

Produces informational messages.
Artwork for ngclang
Applies to C++
initauto=value -qinitauto Initializes automatic storage to a specified hexadecimal byte value.
Artwork for ngclang
Applies to C++
[no]inlglue -qinlglue Generates fast external linkage by inlining the pointer glue code necessary to make a call to an external function or a call through a function pointer.
Artwork for ngclang
Applies to C++
isolated_call=names -qisolated_call

See also #pragma isolated_call

Specifies functions in the source file that have no side effects.
Artwork for ngclang

langlvl -qlanglvl Specifies different language levels.

This directive can dynamically alter preprocessor behavior. As a result, compiling with the -E compiler option may produce results different from those produced when not compiling with the -E option.

Artwork for ngclang
Applies to C++
[no]libansi -qlibansi Assumes that all functions with the name of an ANSI C library function are in fact the system functions.
Artwork for ngclang
Applies to C++
[no]list -qlist Produces a compiler listing that includes an object listing.
Artwork for ngclang
Applies to C++
[no]longlong -qlonglong Allows long long types in your program.
Artwork for ngclang
Applies to C++
[no]maxmem=number -qmaxmem Instructs the compiler to halt compilation when a specified number of errors of specified or greater severity is reached.
Artwork for ngclang
Applies to C++
[no]mbcs -qmbcs, dbcs String literals and comments can contain multibyte characters.
Artwork for ngclang
Applies to C++
[no]optimize
optimize=number
-O, optimize Specifies the optimization level to apply to a section of program code.

The compiler will accept the following values for number:

  • 0 - sets level 0 optimization
  • 2 - sets level 2 optimization
  • 3 - sets level 3 optimization

If no value is specified for number, the compiler assumes level 2 optimization.


Applies to C++
priority=number -qpriority

See also #pragma priority

Specifies the priority level for the initialization of static constructors
Artwork for ngclang
Applies to C++
[no]proclocal, [no]procimported, [no]procunknown -qproclocal, procimported, procunknown Marks functions as local, imported, or unknown.
Artwork for ngclang

[no]proto -qproto If this option is set, the compiler assumes that all functions are prototyped.
Artwork for ngclang
Applies to C++
[no]ro -qro Specifies the storage type for string literals.
Artwork for ngclang
Applies to C++
[no]roconst -qroconst Specifies the storage location for constant values.
Artwork for ngclang
Applies to C++
[no]showinc -qshowinc If used with -qsource, all include files are included in the source listing.
Artwork for ngclang
Applies to C++
[no]source -qsource Produces a source listing.
Artwork for ngclang
Applies to C++
spill=number -qspill Specifies the size of the register allocation spill area.
Artwork for ngclang
Applies to C++
[no]stdinc -qstdinc Specifies which files are included with #include <file_name> and #include "file_name" directives.
Artwork for ngclang
Applies to C++
[no]strict -qstrict Turns off aggressive optimizations of the -O3 compiler option that have the potential to alter the semantics of your program.
Artwork for ngclang
Applies to C++
tbtable=option -qtbtable Changes the length of tabs as perceived by the compiler.
Artwork for ngclang
Applies to C++
tune=option -qtune Specifies the architecture for which the executable program is optimized.
Artwork for ngclang
Applies to C++
[no]unroll

unroll=number

-qunroll Unrolls inner loops in the program by a specified factor.
Artwork for ngclang

[no]upconv -qupconv Preserves the unsigned specification when performing integral promotions.

Applies to C++
[no]vftable -qvftable Controls the generation of virtual function tables.
Artwork for ngclang
Applies to C++
[no]xref -qxref Produces a compiler listing that includes a cross-reference listing of all identifiers.

Related References

General Purpose Pragmas
E IBM Copyright 2003