Various C / C ++ compilers have #pragmaoptimization controls.
For example:
CodeWarrior
#pragma optimization_level 0
void func_no_opt()
{
}
#pragma optimization_level 3
void func_full_opt()
{
}
Msvc
#pragma optimize("g", off)
void func_no_opt()
{
}
#pragma optimize("g", on)
void func_full_opt()
{
}
#pragma optimize("", on)
void func_default_opt()
{
}
For purely performance reasons, I have a couple of features that need to be optimized in all builds, including debug builds that are otherwise not optimized.
Is there a way in GCC (specifically 4.1.1) to do something similar to these other compilers? Unfortunately, GCC 4.4 is not supported on my target platform (proprietary hardware), so I cannot use the optimize attribute - ie __attribute__((optimize(...))).
, toolchain ; , . , . , , .