I am printing out (printf) the name of the function as I enter it by using the "__FUNCTION__" predefined macro (in gcc and clang). However, if I use -Wpedantic, I get this warning:
warning: ISO C does not support ‘__FUNCTION__’ predefined identifier [-Wpedantic]
How do I silence that warning?
The standard compliant function identifier is __func__
From §6.4.2.2 of the C11 specification
The identifier
__func__
shall be implicitly declared by the translator as if, immediately following the opening brace of each function definition, the declaration
static const char __func__[] = "function-name";
appeared, where function-name is the name of the lexically-enclosing function.
I believe that __func__
was added in C99.