Chapter 14. Miscellaneous #pragma Directives
Prev |  | Next

## Chapter 14. Miscellaneous `#pragma` Directives

Table 14-1 lists the `#pragma` directives described in this chapter, along with a brief description of each and the compiler version in which they are supported.

Table 14-1. Miscellaneous `#pragma` Directives

`#pragma` | Short Description | Compiler Versions
--- | --- | ---
`#pragma ident` | Adds a `.comment` section to the object file and puts the supplied string inside the `.comment` section. | 6.0 and later (`-o32` only)
`#pragma int_to_unsigned` | Identifies identifier as a function whose type was `int` in a previous release of the compilation system, but whose type is `unsigned int` in the MIPSpro compiler release. | 7.0 and later
`#pragma intrinsic` | Allows certain preselected functions from `math.h`, `stdio.h`, and `string.h` to be inlined at a call site. Can also enable the compiler to get additional information about the function to improve execution efficiency. | 7.0 and later
`#pragma unknown_control_flow` | Indicates user level functions that have behavior similar to `setjmp` and `getcontext` . | 7.3 and later

## `#pragma ident`

The `#pragma ident` directive adds a `.comment` section to the object file and puts the supplied string inside the `.comment` section.

The syntax of `#pragma ident` is as follows:

    #pragma ident “string”

string is the string you want to add to the `.comment` section in the object file. The string must be enclosed in double quotation marks.

| Caution: The `#pragma ident` directive is only available in `-o32` mode.

## `#pragma int_to_unsigned`

The `#pragma int_to_unsigned` directive tells the compiler that the named function has a different type (`unsigned int`) in the MIPSpro compiler release than it did in previous releases (`int`).

The syntax of `#pragma int_to_unsigned` is as follows:

    #pragma int_to_unsigned   function_name

`#pragma int_to_unsigned` is not currently supported in C++, except for symbols marked `extern “C”`.

This directive identifies function_name as a function whose type was `int` in a previous release of the compilation system, but whose type is `unsigned int` in the MIPSpro compiler release. The declaration of the identifier must precede the directive:

    unsigned int strlen(const char*);
    #pragma int_to_unsigned strlen

This declaration makes it possible for the compiler to identify where the changed type may affect the evaluation of expressions.

## `#pragma intrinsic`

The `#pragma intrinsic` directive allows certain preselected functions from `math.h`, `stdio.h`, and `string.h` to be inlined at a call site for execution efficiency.

The syntax of `#pragma intrinsic` is as follows:

    #pragma intrinsic [function_name]

| Caution: This directive has no effect on functions other than the preselected ones. Exactly which functions may be inlined, how they are inlined, and under what circumstances inlining occurs is implementation-defined and may vary from one release of the compilers to the next. The inlining of intrinsics may violate some aspect of the ANSI C standard (for example, the errno setting for `math.h` functions). All intrinsics are activated through directives in the respective standard header files and only when the preprocessor symbol `__INLINE_INTRINSICS` is defined and the appropriate include files are included. `__INLINE_INTRINSICS` is predefined by default only in `-cckr` and `-xansi` mode.

## `#pragma unknown_control_flow`

The `#pragma unknown_control_flow` directive indicates that the procedures listed as func1, func2, etc. have a nonstandard control flow behavior, such as `setjmp` or `getcontext` . This type of behavior interferes with optimizations such as tail call optimization.

The syntax of `#pragma unknown_control_flow` is as follows:

    #pragma unknown_control_flow [func1 , [func2] ...]

This directive should appear after the external declaration of the function(s).

Prev | Table of Contents | Next
Chapter 13. Warning Suppression Control #pragma Directives |  | Chapter 15. The Auto-Parallelizing Option (APO)