Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- libs/wpp/ppy.y | 1 + 1 file changed, 1 insertion(+)
diff --git a/libs/wpp/ppy.y b/libs/wpp/ppy.y index 5b7083b3813..0afc642d3e0 100644 --- a/libs/wpp/ppy.y +++ b/libs/wpp/ppy.y @@ -327,6 +327,7 @@ allmargs: /* Empty */ { $$ = 0; macro_args = NULL; nmacro_args = 0; }
emargs : margs { $$ = $1; } | margs ',' tELLIPSIS { nmacro_args *= -1; } + | tELLIPSIS { macro_args = NULL; nmacro_args = 0; } ;
margs : margs ',' tIDENT { $$ = add_new_marg($3); }
NOP_FUNCTION is a drop-in function replacement that ignores its arguments but also suppresses compiler warnings about them being unused. For example, on MSVC, 0(foo, bar, baz()); or __noop(foo, bar, baz()); would suppress warnings about foo and bar being unused and not call baz at all. Neither of those syntaxes is supported on GCC, which provides no similar way to suppress unused variable warnings, but we can at least allow such code to compile by defining NOP_FUNCTION to be an empty variadic macro.
Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- Discovered while attempting to compile WinDirStat with winemaker. --- include/winnt.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/include/winnt.h b/include/winnt.h index b83f588a16d..c230fa0cd7f 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -123,10 +123,14 @@ extern "C" { #endif
#ifndef NOP_FUNCTION -# if defined(_MSC_VER) && (_MSC_VER >= 1210) -# define NOP_FUNCTION __noop +# if defined(_MSC_VER) +# if (_MSC_VER >= 1210) +# define NOP_FUNCTION __noop +# else +# define NOP_FUNCTION (void)0 +# endif # else -# define NOP_FUNCTION (void)0 +# define NOP_FUNCTION(...) # endif #endif