Helpers in disabling warnings for unused params.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34790 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2005-06-30 15:31:20 +00:00
parent ff782aec70
commit 7bea7b9148
5 changed files with 48 additions and 39 deletions

View File

@@ -515,6 +515,20 @@ typedef int wxWindowID;
#define WXUNUSED_UNLESS_DEBUG(param) WXUNUSED(param) #define WXUNUSED_UNLESS_DEBUG(param) WXUNUSED(param)
#endif #endif
/* some arguments are not used in unicode mode */
#if wxUSE_UNICODE
#define WXUNUSED_IN_UNICODE(param) WXUNUSED(param)
#else
#define WXUNUSED_IN_UNICODE(param) param
#endif
/* some arguments are not used in WinCE build */
#ifdef __WXWINCE__
#define WXUNUSED_IN_WINCE(param) WXUNUSED(param)
#else
#define WXUNUSED_IN_WINCE(param) param
#endif
/* some compilers give warning about a possibly unused variable if it is */ /* some compilers give warning about a possibly unused variable if it is */
/* initialized in both branches of if/else and shut up if it is initialized */ /* initialized in both branches of if/else and shut up if it is initialized */
/* when declared, but other compilers then give warnings about unused variable */ /* when declared, but other compilers then give warnings about unused variable */

View File

@@ -167,7 +167,7 @@ void wxPathList::Add (const wxString& path)
} }
// Add paths e.g. from the PATH environment variable // Add paths e.g. from the PATH environment variable
void wxPathList::AddEnvList (const wxString& envVariable) void wxPathList::AddEnvList (const wxString& WXUNUSED_IN_WINCE(envVariable))
{ {
// No environment variables on WinCE // No environment variables on WinCE
#ifndef __WXWINCE__ #ifndef __WXWINCE__
@@ -209,9 +209,7 @@ void wxPathList::AddEnvList (const wxString& envVariable)
delete [] s; delete [] s;
} }
#else // __WXWINCE__ #endif // !__WXWINCE__
wxUnusedVar(envVariable);
#endif // !__WXWINCE__/__WXWINCE__
} }
// Given a full filename (with path), ensure that that file can // Given a full filename (with path), ensure that that file can
@@ -652,7 +650,9 @@ wxChar *wxExpandPath(wxChar *buf, const wxChar *name)
The call wxExpandPath can convert these back! The call wxExpandPath can convert these back!
*/ */
wxChar * wxChar *
wxContractPath (const wxString& filename, const wxString& envname, const wxString& user) wxContractPath (const wxString& filename,
const wxString& WXUNUSED_IN_WINCE(envname),
const wxString& user)
{ {
static wxChar dest[_MAXPATHLEN]; static wxChar dest[_MAXPATHLEN];
@@ -678,8 +678,6 @@ wxContractPath (const wxString& filename, const wxString& envname, const wxStrin
wxStrcat (tcp, wxT("}")); wxStrcat (tcp, wxT("}"));
wxStrcat (tcp, wxFileFunctionsBuffer); wxStrcat (tcp, wxFileFunctionsBuffer);
} }
#else
wxUnusedVar(envname);
#endif #endif
// Handle User's home (ignore root homes!) // Handle User's home (ignore root homes!)
@@ -1641,7 +1639,9 @@ time_t WXDLLEXPORT wxFileModificationTime(const wxString& filename)
// Returns 0 if none or if there's a problem. // Returns 0 if none or if there's a problem.
// filterStr is in the form: "All files (*.*)|*.*|JPEG Files (*.jpeg)|*.jpeg" // filterStr is in the form: "All files (*.*)|*.*|JPEG Files (*.jpeg)|*.jpeg"
int WXDLLEXPORT wxParseCommonDialogsFilter(const wxString& filterStr, wxArrayString& descriptions, wxArrayString& filters) int WXDLLEXPORT wxParseCommonDialogsFilter(const wxString& filterStr,
wxArrayString& descriptions,
wxArrayString& filters)
{ {
descriptions.Clear(); descriptions.Clear();
filters.Clear(); filters.Clear();

View File

@@ -137,7 +137,9 @@ _tiffUnmapProc(thandle_t WXUNUSED(handle),
} }
static void static void
TIFFwxWarningHandler(const char* module, const char* fmt, va_list ap) TIFFwxWarningHandler(const char* module,
const char* WXUNUSED_IN_UNICODE(fmt),
va_list WXUNUSED_IN_UNICODE(ap))
{ {
if (module != NULL) if (module != NULL)
wxLogWarning(_("tiff module: %s"), wxString::FromAscii(module).c_str()); wxLogWarning(_("tiff module: %s"), wxString::FromAscii(module).c_str());
@@ -151,7 +153,9 @@ TIFFwxWarningHandler(const char* module, const char* fmt, va_list ap)
} }
static void static void
TIFFwxErrorHandler(const char* module, const char* fmt, va_list ap) TIFFwxErrorHandler(const char* module,
const char* WXUNUSED_IN_UNICODE(fmt),
va_list WXUNUSED_IN_UNICODE(ap))
{ {
if (module != NULL) if (module != NULL)
wxLogError(_("tiff module: %s"), wxString::FromAscii(module).c_str()); wxLogError(_("tiff module: %s"), wxString::FromAscii(module).c_str());

View File

@@ -89,7 +89,8 @@ static const int idMenuTitle = -3;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// make the given menu item default // make the given menu item default
static void SetDefaultMenuItem(HMENU hmenu, UINT id) static void SetDefaultMenuItem(HMENU WXUNUSED_IN_WINCE(hmenu),
UINT WXUNUSED_IN_WINCE(id))
{ {
#ifndef __WXWINCE__ #ifndef __WXWINCE__
MENUITEMINFO mii; MENUITEMINFO mii;
@@ -102,9 +103,6 @@ static void SetDefaultMenuItem(HMENU hmenu, UINT id)
{ {
wxLogLastError(wxT("SetMenuItemInfo")); wxLogLastError(wxT("SetMenuItemInfo"));
} }
#else
wxUnusedVar(hmenu);
wxUnusedVar(id);
#endif #endif
} }

View File

@@ -122,12 +122,11 @@ static const wxChar eUSERNAME[] = wxT("UserName");
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Get hostname only (without domain name) // Get hostname only (without domain name)
bool wxGetHostName(wxChar *buf, int maxSize) bool wxGetHostName(wxChar *WXUNUSED_IN_WINCE(buf),
int WXUNUSED_IN_WINCE(maxSize))
{ {
#if defined(__WXWINCE__) #if defined(__WXWINCE__)
// TODO-CE // TODO-CE
wxUnusedVar(buf);
wxUnusedVar(maxSize);
return false; return false;
#elif defined(__WIN32__) && !defined(__WXMICROWIN__) #elif defined(__WIN32__) && !defined(__WXMICROWIN__)
DWORD nSize = maxSize; DWORD nSize = maxSize;
@@ -237,12 +236,11 @@ bool wxGetFullHostName(wxChar *buf, int maxSize)
} }
// Get user ID e.g. jacs // Get user ID e.g. jacs
bool wxGetUserId(wxChar *buf, int maxSize) bool wxGetUserId(wxChar *WXUNUSED_IN_WINCE(buf),
int WXUNUSED_IN_WINCE(maxSize))
{ {
#if defined(__WXWINCE__) #if defined(__WXWINCE__)
// TODO-CE // TODO-CE
wxUnusedVar(buf);
wxUnusedVar(maxSize);
return false; return false;
#elif defined(__WIN32__) && !defined(__WXMICROWIN__) #elif defined(__WIN32__) && !defined(__WXMICROWIN__)
DWORD nSize = maxSize; DWORD nSize = maxSize;
@@ -280,12 +278,11 @@ bool wxGetUserId(wxChar *buf, int maxSize)
} }
// Get user name e.g. Julian Smart // Get user name e.g. Julian Smart
bool wxGetUserName(wxChar *buf, int maxSize) bool wxGetUserName(wxChar *WXUNUSED_IN_WINCE(buf),
int WXUNUSED_IN_WINCE(maxSize))
{ {
#if defined(__WXWINCE__) #if defined(__WXWINCE__)
// TODO-CE // TODO-CE
wxUnusedVar(buf);
wxUnusedVar(maxSize);
return false; return false;
#elif defined(USE_NET_API) #elif defined(USE_NET_API)
CHAR szUserName[256]; CHAR szUserName[256];
@@ -467,13 +464,12 @@ wxChar *wxGetUserHome(const wxString& WXUNUSED(user))
return (wxChar *)wxGetHomeDir(&s_home); return (wxChar *)wxGetHomeDir(&s_home);
} }
bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree) bool wxGetDiskSpace(const wxString& WXUNUSED_IN_WINCE(path),
wxLongLong *WXUNUSED_IN_WINCE(pTotal),
wxLongLong *WXUNUSED_IN_WINCE(pFree))
{ {
#ifdef __WXWINCE__ #ifdef __WXWINCE__
// TODO-CE // TODO-CE
wxUnusedVar(path);
wxUnusedVar(pTotal);
wxUnusedVar(pFree);
return false; return false;
#else #else
if ( path.empty() ) if ( path.empty() )
@@ -583,12 +579,11 @@ bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
// env vars // env vars
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
bool wxGetEnv(const wxString& var, wxString *value) bool wxGetEnv(const wxString& WXUNUSED_IN_WINCE(var),
wxString *WXUNUSED_IN_WINCE(value))
{ {
#ifdef __WXWINCE__ #ifdef __WXWINCE__
// no environment variables under CE // no environment variables under CE
wxUnusedVar(var);
wxUnusedVar(value);
return false; return false;
#else // Win32 #else // Win32
// first get the size of the buffer // first get the size of the buffer
@@ -609,11 +604,15 @@ bool wxGetEnv(const wxString& var, wxString *value)
#endif // WinCE/32 #endif // WinCE/32
} }
bool wxSetEnv(const wxString& var, const wxChar *value) bool wxSetEnv(const wxString& WXUNUSED_IN_WINCE(var),
const wxChar *WXUNUSED_IN_WINCE(value))
{ {
// some compilers have putenv() or _putenv() or _wputenv() but it's better // some compilers have putenv() or _putenv() or _wputenv() but it's better
// to always use Win32 function directly instead of dealing with them // to always use Win32 function directly instead of dealing with them
#if defined(__WIN32__) && !defined(__WXWINCE__) #ifdef __WXWINCE__
// no environment variables under CE
return false;
#else
if ( !::SetEnvironmentVariable(var, value) ) if ( !::SetEnvironmentVariable(var, value) )
{ {
wxLogLastError(_T("SetEnvironmentVariable")); wxLogLastError(_T("SetEnvironmentVariable"));
@@ -622,11 +621,6 @@ bool wxSetEnv(const wxString& var, const wxChar *value)
} }
return true; return true;
#else // no way to set env vars
// no environment variables under CE
wxUnusedVar(var);
wxUnusedVar(value);
return false;
#endif #endif
} }
@@ -946,11 +940,10 @@ bool wxShell(const wxString& command)
} }
// Shutdown or reboot the PC // Shutdown or reboot the PC
bool wxShutdown(wxShutdownFlags wFlags) bool wxShutdown(wxShutdownFlags WXUNUSED_IN_WINCE(wFlags))
{ {
#ifdef __WXWINCE__ #ifdef __WXWINCE__
// TODO-CE // TODO-CE
wxUnusedVar(wFlags);
return false; return false;
#elif defined(__WIN32__) #elif defined(__WIN32__)
bool bOK = true; bool bOK = true;