From 91b7aab4c24cb6a1a0df5e3d92c63a1f89fe44e2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 10 Sep 2014 16:52:08 +0000 Subject: [PATCH] Fix build with g++ 3.4 with -pedantic[-errors] option. The use of variadic macros results in a warning/error if -pedantic[-errors] is used when compiling C++98 code as they are only formally part of C99 (or C++11). With g++ 4 and later, this can be avoided by using -Wno-variadic-macros option, but it doesn't exist in g++ 3, so a nasty workaround in the header itself is required: mark it as system header in order to fix compilation. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77664 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/cpp.h | 15 +++++++++++++++ include/wx/testing.h | 6 ++++++ 2 files changed, 21 insertions(+) diff --git a/include/wx/cpp.h b/include/wx/cpp.h index 19aa9bea52..5dfe6afccd 100644 --- a/include/wx/cpp.h +++ b/include/wx/cpp.h @@ -128,6 +128,21 @@ #ifdef HAVE_VARIADIC_MACROS + +/* + This is a hack to make it possible to use variadic macros with g++ 3.x even + when using -pedantic[-errors] option: without this, it would complain that + + "anonymous variadic macros were introduced in C99" + + and the option disabling this warning (-Wno-variadic-macros) is only + available in gcc 4.0 and later, so until then this hack is the only thing we + can do. + */ +#if defined(__GNUC__) && __GNUC__ == 3 + #pragma GCC system_header +#endif /* gcc-3.x */ + /* wxCALL_FOR_EACH(what, ...) calls the macro from its first argument, what(pos, x), for every remaining argument 'x', with 'pos' being its 1-based index in diff --git a/include/wx/testing.h b/include/wx/testing.h index a0961baef5..6dd6794fcb 100644 --- a/include/wx/testing.h +++ b/include/wx/testing.h @@ -357,6 +357,12 @@ private: method. */ #ifdef HAVE_VARIADIC_MACROS + +// See wx/cpp.h for the explanations of this hack. +#if defined(__GNUC__) && __GNUC__ == 3 + #pragma GCC system_header +#endif /* gcc-3.x */ + #define wxTEST_DIALOG(codeToRun, ...) \ { \ wxTEST_DIALOG_HOOK_CLASS wx_hook; \