Is it possible to use GCC to compile one section of a code file with specific compiler flags? For example, suppose I had some functions I was testing. I want those functions to strictly adhere to standards compliance, so I want to compile them with the --pedantic flag. But the code to do the testing issues a lot of warnings on compilation. Is there any way to compile just those specific functions with --pedantic?
Alternatively, suppose I have a carefully written but extremely expensive function that needs to run as fast as possible. How could I compile just that function (and a few others) with -Ofast, and compile the rest of the program with -O2 or -O3?