You copied the Doc URL to your clipboard.

#pragma Onum

This pragma changes the optimization level for all subsequent functions.

Syntax

#pragma Onum

Where:

num

is the new optimization level.

The value of num is 0, 1, 2 or 3.

Usage

To assign a new optimization level to all subsequent functions, use #pragma Onum. For example, compiling with armcc -O1:

void function1(void){
    ...                // Optimized at O1 (from armcc -O1)
}

#pragma O3
void function2(void){
    ...                // Optimized at O3
}

void function3(void){
    ...                // Optimized at O3
}

To assign a new optimization level to an individual function, use #pragma Onum together with #pragma push and #pragma pop. For example, compiling with armcc -O1:

void function1(void){
    ...                 // Optimized at O1 (from armcc -O1)
}
#pragma push
#pragma O3
void function2(void){
    ...                 // Optimized at O3
}
#pragma pop

void function3(void){
    ...                 // Optimized at O1 (from armcc -O1)
}

Restriction

The pragma must be placed outside a function.

Was this page helpful? Yes No