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.
This commit is contained in:
Vadim Zeitlin
2020-02-04 22:32:41 +01:00
parent 32ead5a0ff
commit 57111b83c9

View File

@@ -397,63 +397,66 @@ void LogTestCase::NoWarnings()
// The following two functions (v, macroCompilabilityTest) are not run by // The following two functions (v, macroCompilabilityTest) are not run by
// any test, and their purpose is merely to guarantee that the wx(V)LogXXX // any test, and their purpose is merely to guarantee that the wx(V)LogXXX
// macros compile without 'dangling else' warnings. // macros compile without 'dangling else' warnings.
#pragma GCC diagnostic error "-Wdangling-else" #if defined(__clang__) || wxCHECK_GCC_VERSION(4, 6)
#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);
#endif #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() void macroCompilabilityTest()
{ {
v(123, 456); v(123, 456);
if (true) if (true)
wxLogGeneric(wxLOG_Info, "hello generic %d", 42); wxLogGeneric(wxLOG_Info, "hello generic %d", 42);
if (true) if (true)
wxLogTrace(wxTRACE_Messages, "hello trace %d", 42); wxLogTrace(wxTRACE_Messages, "hello trace %d", 42);
if (true) if (true)
wxLogError("hello error %d", 42); wxLogError("hello error %d", 42);
if (true) if (true)
wxLogMessage("hello message %d", 42); wxLogMessage("hello message %d", 42);
if (true) if (true)
wxLogVerbose("hello verbose %d", 42); wxLogVerbose("hello verbose %d", 42);
if (true) if (true)
wxLogWarning("hello warning %d", 42); wxLogWarning("hello warning %d", 42);
if (true) if (true)
wxLogFatalError("hello fatal %d", 42); wxLogFatalError("hello fatal %d", 42);
if (true) if (true)
wxLogSysError("hello syserror %d", 42); wxLogSysError("hello syserror %d", 42);
#if wxUSE_GUI #if wxUSE_GUI
if (true) if (true)
wxLogStatus("hello status %d", 42); wxLogStatus("hello status %d", 42);
#endif #endif
if (true) if (true)
wxLogDebug("hello debug %d", 42); wxLogDebug("hello debug %d", 42);
} }
#endif // wxUSE_LOG #endif // wxUSE_LOG