How to suppress GCC variadic macro argument warning for zero arguments for a particular macro definition within a source file
<p>I want to suppress GCC variadic macro argument warning for zero arguments, produced for example by: </p>

<pre><code>// for illustration purposes only:
int foo(int i) { return 0; };
#define FOO(A, ...) foo(A, ##__VA_ARGS__)
FOO(1);
     ^  warning: ISO C++11 requires at least one argument for the "..." in a variadic macro
</code></pre>

<p>for a particular macro definition within a source file when using GCC 5.3.0. </p>

<p>In clang this is done as follows:</p>

<pre><code>// ... large file
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
#define FOO(A, ...) foo(A, ##__VA_ARGS__)
#pragma clang diagnostic pop
// ... large file

// not necessary on the same file
FOO(1);  // doesnt trigger the warning
</code></pre>

<p>In gcc it looks like <code>-pedantic</code> is a magical kind of warning type so the following just doesn't work:</p>

<pre><code>// ... large file
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#define FOO(A, ...) foo(A, ##__VA_ARGS__)
#pragma GCC diagnostic pop
// ... large file
</code></pre>

<p>Just to be clear, the warning should be enabled in the whole program except in this particular snippet of code. This is about fine grained control. Disabling the warning in GCC for the whole program can be achieved by just not passing <code>-pedantic</code> to the compiler.</p>