Enbale/disable c compiler warnings for specific aprt of code

Viewed 17

I'd like to enable/disable some c compiler warnings for some specific portions of code. For example for the code

printf("code: %i", code, subcode);

i (obviously) get a warnings like "warning: too many arguments for format [-Wformat-extra-args]"

I know I can pass the -Wformat-extra-args to the compiler to get rid of such warnings, but I do not want that for all code, only for some portions, i'm thinking something like

#pragma disable format-extra-args
printf("code: %i", code, subcode);
#pragma enable format-extra-args

is that feasible ?

0 Answers
Related