I have some legacy code that needs certain gcc flags passed in. Can I add pre-processor checks for these flags?
For example, let’s say I need -fno-strict-aliasing, can I do something like this:
#ifndef _FNO_STRICT_ALIASING
#error -fno-strict-aliasing is required!
#endif
You can use
to compile the file with that flag (overriding what was specified on the command line).
You can also use
to apply the flag to a single function within a source file…