From 57111b83c931824d9e4fd235f29a8bfdbdba6a56 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 4 Feb 2020 22:32:41 +0100 Subject: [PATCH] Minor fixes to new wxLog functions test case Only use the diagnostic pragma for the compilers that understand it. Also don't use hard TABs. --- tests/log/logtest.cpp | 101 ++++++++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 49 deletions(-) diff --git a/tests/log/logtest.cpp b/tests/log/logtest.cpp index c6f47c080b..f1b26f77bf 100644 --- a/tests/log/logtest.cpp +++ b/tests/log/logtest.cpp @@ -397,63 +397,66 @@ void LogTestCase::NoWarnings() // The following two functions (v, macroCompilabilityTest) are not run by // any test, and their purpose is merely to guarantee that the wx(V)LogXXX // macros compile without 'dangling else' warnings. -#pragma GCC diagnostic error "-Wdangling-else" - -static void v(int x, ...) { - va_list list; - va_start(list, x); - - if (true) - wxVLogGeneric(Info, "vhello generic %d", list); - if (true) - wxVLogTrace(wxTRACE_Messages, "vhello trace %d", list); - if (true) - wxVLogError("vhello error %d", list); - if (true) - wxVLogMessage("vhello message %d", list); - if (true) - wxVLogVerbose("vhello verbose %d", list); - if (true) - wxVLogWarning("vhello warning %d", list); - if (true) - wxVLogFatalError("vhello fatal %d", list); - if (true) - wxVLogSysError("vhello syserror %d", list); -#if wxUSE_GUI - if (true) - wxVLogStatus("vhello status %d", list); +#if defined(__clang__) || wxCHECK_GCC_VERSION(4, 6) + #pragma GCC diagnostic error "-Wdangling-else" #endif - if (true) - wxVLogDebug("vhello debug %d", list); - va_end(list); +static void v(int x, ...) +{ + va_list list; + va_start(list, x); + + if (true) + wxVLogGeneric(Info, "vhello generic %d", list); + if (true) + wxVLogTrace(wxTRACE_Messages, "vhello trace %d", list); + if (true) + wxVLogError("vhello error %d", list); + if (true) + wxVLogMessage("vhello message %d", list); + if (true) + wxVLogVerbose("vhello verbose %d", list); + if (true) + wxVLogWarning("vhello warning %d", list); + if (true) + wxVLogFatalError("vhello fatal %d", list); + if (true) + wxVLogSysError("vhello syserror %d", list); +#if wxUSE_GUI + if (true) + wxVLogStatus("vhello status %d", list); +#endif + if (true) + wxVLogDebug("vhello debug %d", list); + + va_end(list); } void macroCompilabilityTest() { - v(123, 456); - if (true) - wxLogGeneric(wxLOG_Info, "hello generic %d", 42); - if (true) - wxLogTrace(wxTRACE_Messages, "hello trace %d", 42); - if (true) - wxLogError("hello error %d", 42); - if (true) - wxLogMessage("hello message %d", 42); - if (true) - wxLogVerbose("hello verbose %d", 42); - if (true) - wxLogWarning("hello warning %d", 42); - if (true) - wxLogFatalError("hello fatal %d", 42); - if (true) - wxLogSysError("hello syserror %d", 42); + v(123, 456); + if (true) + wxLogGeneric(wxLOG_Info, "hello generic %d", 42); + if (true) + wxLogTrace(wxTRACE_Messages, "hello trace %d", 42); + if (true) + wxLogError("hello error %d", 42); + if (true) + wxLogMessage("hello message %d", 42); + if (true) + wxLogVerbose("hello verbose %d", 42); + if (true) + wxLogWarning("hello warning %d", 42); + if (true) + wxLogFatalError("hello fatal %d", 42); + if (true) + wxLogSysError("hello syserror %d", 42); #if wxUSE_GUI - if (true) - wxLogStatus("hello status %d", 42); + if (true) + wxLogStatus("hello status %d", 42); #endif - if (true) - wxLogDebug("hello debug %d", 42); + if (true) + wxLogDebug("hello debug %d", 42); } #endif // wxUSE_LOG