From dab29e4f525c0dd23887378eae8ae55581d521ce Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 29 Jun 2014 23:42:34 +0000 Subject: [PATCH] Fix harmless unused parameters warnings in builds without wxLogTrace(). Fix warnings appearing when building with --disable-debug under Unix by either referencing the parameters or variables which become unused then, because wxLogTrace() calls are compiled out, or by not compiling the code whose only purpose is to call wxLogTrace() at all. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@76787 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/fswatchercmn.cpp | 4 +++- src/common/translation.cpp | 13 +++++++++++++ src/unix/stackwalk.cpp | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/common/fswatchercmn.cpp b/src/common/fswatchercmn.cpp index cb32a14100..b946f6402c 100644 --- a/src/common/fswatchercmn.cpp +++ b/src/common/fswatchercmn.cpp @@ -144,9 +144,11 @@ wxFileSystemWatcherBase::AddAny(const wxFileName& path, else { wxFSWatchInfo& watch = it->second; - int count = watch.IncRef(); + const int count = watch.IncRef(); wxLogTrace(wxTRACE_FSWATCHER, "'%s' is now watched %d times", canonical, count); + + wxUnusedVar(count); // could be unused if debug tracing is disabled } return true; } diff --git a/src/common/translation.cpp b/src/common/translation.cpp index 455fb315d0..b5b33de9f1 100644 --- a/src/common/translation.cpp +++ b/src/common/translation.cpp @@ -95,6 +95,8 @@ wxStringToStringHashMap gs_msgIdCharset; // Platform specific helpers // ---------------------------------------------------------------------------- +#if wxUSE_LOG_TRACE + void LogTraceArray(const char *prefix, const wxArrayString& arr) { wxLogTrace(TRACE_I18N, "%s: [%s]", prefix, wxJoin(arr, ',')); @@ -107,6 +109,13 @@ void LogTraceLargeArray(const wxString& prefix, const wxArrayString& arr) wxLogTrace(TRACE_I18N, " %s", *i); } +#else // !wxUSE_LOG_TRACE + +#define LogTraceArray(prefix, arr) +#define LogTraceLargeArray(prefix, arr) + +#endif // wxUSE_LOG_TRACE/!wxUSE_LOG_TRACE + // Use locale-based detection as a fallback wxString GetPreferredUILanguageFallback(const wxArrayString& WXUNUSED(available)) { @@ -180,6 +189,8 @@ wxString GetPreferredUILanguage(const wxArrayString& available) #elif defined(__WXOSX__) +#if wxUSE_LOG_TRACE + void LogTraceArray(const char *prefix, CFArrayRef arr) { wxString s; @@ -193,6 +204,8 @@ void LogTraceArray(const char *prefix, CFArrayRef arr) wxLogTrace(TRACE_I18N, "%s: [%s]", prefix, s); } +#endif // wxUSE_LOG_TRACE + wxString GetPreferredUILanguage(const wxArrayString& available) { wxStringToStringHashMap availableNormalized; diff --git a/src/unix/stackwalk.cpp b/src/unix/stackwalk.cpp index e8cf6edff3..eccb910e11 100644 --- a/src/unix/stackwalk.cpp +++ b/src/unix/stackwalk.cpp @@ -215,6 +215,8 @@ bool ReadLine(FILE* fp, unsigned long num, wxString* line) { if ( !fgets(g_buf, WXSIZEOF(g_buf), fp) ) { + wxUnusedVar(num); // could be unused if debug tracing is disabled + wxLogDebug(wxS("cannot read address information for stack frame #%lu"), num); return false;