I have a chunk of code that I can disable compilation warnings for via pragmas, like the following example that disables a defined-but-not-used compilation warning:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
static int
bs_qd_debug_kv(void* cls, enum MHD_ValueKind kind, const char* key, const char* value)
{
fprintf(stderr, "key [%s] -> value [%s]\n", key, value);
return MHD_YES;
}
#pragma GCC diagnostic pop
This works fine, but how can I disable multiple warnings?
For instance, I get a defined-but-not-used compilation warning with the following two pragmas:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
static int
bs_qd_debug_kv(void* cls, enum MHD_ValueKind kind, const char* key, const char* value)
{
fprintf(stderr, "key [%s] -> value [%s]\n", key, value);
return MHD_YES;
}
#pragma GCC diagnostic pop
#pragma GCC diagnostic pop
Is there a different arrangement of #pragma
directives, which allows specification of multiple pragmas on the enclosed code?
EDIT
Upon reading the linked question, it seems that question is almost entirely different from this one. This question asks about the use of multiple GCC-specific pragmas. The linked question asks about a compiler response to pragmas from OpenMP. I'm not sure that the two questions are identical, even though they both tangentially touch on the use of pragmas with GCC.