This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Change debug/optimisation options via pragma?

Genius 5820 points


Hi,

is there a possibility to influence the inclusion of debug symbols (-g) or increase code optimisation level (-O) for some code sections only, e.g. via a special pragma?

I'm aware of the fact that such a otimisation-pragma can work only very limited, especially in case of global optimisations but it would be very useful for me to have debugging symbols for normal code and to have release-build-behaviour for time-critical code.

Thanks!

  • The latest versions of the compiler support a FUNCTIONS_OPTIONS pragma that allows you to compile a specific function with additional compiler options. This will give you the functionality you are looking for. The compiler manuals found here document this pragma.