In a project that includes dozens of modules, we have O1
as the default debug optimization level.
Sometimes, I need a lesser optimization (i.e., no optimization at all). So I use the clang attribute optnone
to exclude a single function from optimization.
But when the number of functions to exclude is large, this becomes cumbersome.
Is there a way to exclude a whole module from optimization? For example set a pragma at the top of the module.
Clang has a compiler-specific pragma
yes, try:
#pragma clang optimize off
//region of code
#pragma clang optimize on