VMS Help  —  CC  Language topics, Preprocessor  #pragma
compiler. CDD Messages about CDD (Common Data Dictionary) support. CHECK Messages reporting code or practices that, although correct and perhaps portable, are sometimes considered ill-advised because they can be confusing or fragile to maintain. For example, assignment as the test expression in an "if" statement. NOTE: The check group gets defined by enabling level5 messages. DEFUNCT Messages reporting the use of obsolete features: ones that were commonly accepted by early C compilers but were subsequently removed from the language. NEWC99 Messages reporting the use of the new C99 Standard features. NOANSI Messages reporting the use of non-ANSI Standard features. The NOANSI message group is a synonym for NOC89. Also see message groups NEWC99, NOC89, NOc99. NOC89 Messages reporting the use of non-C89 Standard features. NOC99 Messages reporting the use of non-C99 Standard features. OBSOLESCENT Messages reporting the use of features that are valid in ANSI Standard C, but which were identified in the standard as being obsolescent and likely to be removed from the language in a future version of the standard. OVERFLOW Messages that report assignments and/or casts that can cause overflow or other loss of data significance. PERFORMANCE Messages reporting code that might result in poor run-time performance. PORTABLE Messages reporting the use of language extensions or other constructs that might not be portable to other compilers or platforms. PREPROCESSOR Messages reporting questionable or non-portable use of preprocessing constructs. QUESTCODE Messages reporting questionable coding practices. Similar to the check group, but messages in this group are more likely to indicate a programming error rather than just a non-robust style. Enabling the QUESTCODE group provides lint-like checking. RETURNCHECKS Messages related to function return values. UNINIT Messages related to using uninitialized variables. UNUSED Messages reporting expressions, declarations, header files, CDD records, static functions, and code paths that are not used. Note, however, that unlike any other messages, these messages must be enabled on the command line (/WARNINGS=ENABLE=UNUSED) to be effective. o A single message-level name (within parentheses or not). Note: There is a core of very important compiler messages that are enabled by default, regardless of anything specified with /WARNINGS or #pragma message. Referred to as message level 0, it includes all messages issued in header files, and comprises what is known as the nostandard group. All other message levels add additional messages to this core of enabled messages. You cannot disable level 0. However, you can disable individual messages in level 0 that are not errors or fatals. Message-level names are: LEVEL1 Important messages. These are less important than level 0, because messages in this group are not displayed if #pragma nostandard is active. LEVEL2 Moderately important messages. This level is used to introduce new messages that will be output in the DIGITAL UNIX V4.0 release. LEVEL2 is the default for DIGITAL UNIX and Tru64 UNIX platforms. LEVEL3 Less important messages. In general, these are the messages output by default in DEC C Version 5.5 for OpenVMS Systems. LEVEL3 is the default message level for VSI C for OpenVMS systems. LEVEL4 Useful check/portable messages. LEVEL5 Not so useful check/portable messages. LEVEL6 All messages in LEVEL5 plus additional "noisy" messages. Enabling a level also enables all the messages in the levels below it. So enabling LEVEL3 messages also enables messages in LEVEL2 and LEVEL1. Disabling a level also disables all the messages in the levels above it. So disabling LEVEL4 messages also disables messages in LEVEL5 and LEVEL6. o A comma-separated list of message identifiers, group names, and messages levels, freely mixed, enclosed in parentheses. option2 is: save -- saves the current state of which messages are enabled and disabled. restore -- restores the previous state of which messages are enabled and disabled. The save and restore options are useful primarily within header files. The #pragma message (quoted-string) form outputs the quoted-string as a compiler message. This form of the pragma is subject to macro replacement. For example, the following is valid: #pragma message ("Compiling file " __FILE__) #pragma module[_m|_nm] The ANSI C compliant #pragma module directive is equivalent to the VAX C compatible #module directive, but is supported in all compiler modes. (The #module directive is retained for compatibility and is supported only when compiling with the /STANDARD=VAXC qualifier.) The #pragma module directive is specific to VSI C for OpenVMS Systems and is not portable. Use the #pragma module directive to change the system-recognized module name and version number. You can find the module name and version number in the compiler listing file and the linker load map. Syntax: #pragma module identifier identifier #pragma module identifier string The first parameter must be a valid VSI C identifier. It specifies the module name to be used by the linker. The second parameter specifies the optional identification that appears on listings and in the object file. It must be either a valid VSI C identifier of 31 characters or less, or a character-string constant of 31 characters or less. Only one #pragma module directive can be processed per compilation unit, and that directive must appear before any C language text. The #pragma module directive can follow other directives, such as #define, but it must precede any function definitions or external data definitions. #pragma names[_m|_nm] Provides the same kinds of control over the mapping of external identifiers' object-module symbols as does the /NAMES command-line qualifier, and it uses the same keywords. But as a pragma, the controls can be applied selectively to regions of declarations. This pragma should only be used in header files and is intended for use by developers who supply libraries and/or header files to their customers. The pragma has a save/restore stack that is also managed by #pragma environment, and so it is well-suited for use in header files. The effect of #pragma environment header_defaults is to set NAMES to "uppercase,truncated", which is the compiler default. Syntax: #pragma names <stack-option> #pragma names <case-option> #pragma names <length-option> Where <stack-option> is one of: o save - save the current names state o restore - restore a saved names state <case-option> is one of: o uppercase - uppercase external names o as_is - do not change case <length-option> is one of: o truncated - truncate at 31 characters o shortened - shorten to 31 using CRC #pragma optimize[_m|_nm] Sets the optimization characteristics of function definitions that follow the directive. It allows optimization-control options that are normally set on the command line for the entire compilation to be specified in the source file for individual functions. Syntax: #pragma optimize <settings> #pragma optimize save #pragma optimize restore #pragma optimize command_line Where <settings> is any combination of the following: o <level settings> Set the optimization level. Specify as: level=n Where n is an integer from 0 to 5. o <unroll settings> Control loop unrolling. Specify as: unroll=n Where n is a nonnegative integer. o <ansi-alias settings> Control ansi-alias assumptions. Specify one of the following: ansi_alias=on ansi_alias=off o <intrinsic settings> Control recognition of intrinsics. Specify one of the following: intrinsics=on intrinsics=off Use the save, restore, and command_line keywords as follows: o save -- Saves the current pointer size o restore -- Restores the current pointer size to its last saved state o command_line -- Sets the optimization settings to what was specified on the command line Example: #pragma optimize level=5 unroll=6 Usage Notes: o If the level=0 clause is present, it must be the only clause present. o The #pragma optimize directive must appear at file scope, outside any function body. o The #pragma environment save and restore operations include the optimization state. o The #pragma environment command_line directive resets the optimization state to that specified on the command line. o If #pragma optimize does not specify a setting for one of the optimization states, that state remains unchanged. o When a function definition is encountered, it is compiled using the optimization settings that are current at that point in the source. o When a function is compiled under level=0, the compiler will not inline that function. In general, when functions are inlined, the inlined code is optimized using the optimization controls in effect at the call site instead of using the optimization controls specified for the function being inlined. o When the OpenVMS command line specifies /NOOPT (or /OPTIMIZE=LEVEL=0), the #pragma optimize directive has no effect (except that its arguments are still validated). #pragma pack[_m|_nm] Specifies the byte boundary for packing members of C structures. Syntax: #pragma pack [n] The n specifies the new alignment restriction in bytes: 1 - align to byte 2 - align to word 4 - align to longword 8 - align to quadword 16 - align to octaword A structure member is aligned to either the alignment specified by #pragma pack or the alignment determined by the size of the structure member, whichever is smaller. For example, a short variable in a structure gets byte-aligned if #pragma pack 1 is specified. If #pragma pack 2, 4, or 8 is specified, the short variable in the structure gets aligned to word. When #pragma pack is specified without a value or with a value of 0, packing reverts to that specified by the /[NO]MEMBER_ALIGNMENT qualifier setting (either explicitly specified or by default) on the command line. Note that when specifying #pragma pack without a value, you must use parentheses: #pragma pack (). #pragma pointer_size[_m|_nm] Controls whether pointers are 32-bit pointers or 64-bit pointers. Syntax: #pragma pointer_size keyword Where keyword is one of the following: o short -- 32-bit pointer o long -- 64-bit pointer o system_default -- 32-bit pointers on OpenVMS systems; 64-bit pointers on Tru64 UNIX systems o save -- Saves the current pointer size o restore -- Restores the current pointer size to its last saved state This directive is enabled only when the /POINTER_SIZE command-line qualifier is specified. Otherwise, #pragma pointer_size has the same effect as #pragma required_pointer_size. #pragma required_pointer_size[_m|_nm] Intended for use by developers of header files to control pointer size within header files. Syntax: #pragma required_pointer_size keyword Where keyword is one of the following: o short -- 32-bit pointer o long -- 64-bit pointer o system_default -- 32-bit pointers on OpenVMS systems; 64-bit pointers on Tru64 UNIX systems o save -- Saves the current pointer size o restore -- Restores the current pointer size to its last saved state This directive is always enabled, even if the /POINTER_SIZE command-line qualifier is omitted. Otherwise, #pragma required_pointer_size has the same effect as #pragma pointer_size. #pragma [no]standard[_m|_nm] Directs the compiler to define regions of source code where portability diagnostics are not to be issued. Use #pragma nostandard to suppress diagnostics about non-ANSI C extensions, regardless of the /STANDARD qualifier specified, until a #pragma standard directive is encountered. Use #pragma standard to reinstate the setting of the /STANDARD qualifier that was in effect before before the last #pragma nostandard was encountered. Every #pragma standard directive must be preceded by a corresponding #pragma nostandard directive. Note that this pragma does not change the current mode of the compiler or enable any extensions not already supported in that mode. #pragma unroll[_m|_nm] Directs the compiler to unroll the for loop that follows it by the number of times specified in the unroll_factor argument. The #pragma unroll directive must be followed by a for statement. Syntax: #pragma unroll (unroll_factor) The unroll_factor is an integer constant in the range 0 to 255. If a value of 0 is specified, the compiler ignores the directive and determines the number of times to unroll the loop in its normal way. A value of 1 prevents the loop from being unrolled. The directive applies only to the for loop that follows it, not to any subsequent for loops. #pragma use_linkage[_m|_nm] Associates a special linkage, defined by the #pragma linkage directive, with the specified functions. Syntax: #pragma use_linkage linkage-name (routine1, routine2, ...) The linkage-name is the name of a linkage previously defined by the #pragma linkage directive. The parenthesized list contains the names of functions you want to associated with the named linkage. The list can also contain typedef names of function type, in which case functions or pointers to functions declared using that type will have the specified linkage.
Close Help