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)
#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 */
/* 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 */

View File

@@ -167,7 +167,7 @@ void wxPathList::Add (const wxString& path)
}
// 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
#ifndef __WXWINCE__
@@ -209,9 +209,7 @@ void wxPathList::AddEnvList (const wxString& envVariable)
delete [] s;
}
#else // __WXWINCE__
wxUnusedVar(envVariable);
#endif // !__WXWINCE__/__WXWINCE__
#endif // !__WXWINCE__
}
// 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!
*/
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];
@@ -678,8 +678,6 @@ wxContractPath (const wxString& filename, const wxString& envname, const wxStrin
wxStrcat (tcp, wxT("}"));
wxStrcat (tcp, wxFileFunctionsBuffer);
}
#else
wxUnusedVar(envname);
#endif
// 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.
// 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();
filters.Clear();

View File

@@ -137,7 +137,9 @@ _tiffUnmapProc(thandle_t WXUNUSED(handle),
}
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)
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
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)
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
static void SetDefaultMenuItem(HMENU hmenu, UINT id)
static void SetDefaultMenuItem(HMENU WXUNUSED_IN_WINCE(hmenu),
UINT WXUNUSED_IN_WINCE(id))
{
#ifndef __WXWINCE__
MENUITEMINFO mii;
@@ -102,9 +103,6 @@ static void SetDefaultMenuItem(HMENU hmenu, UINT id)
{
wxLogLastError(wxT("SetMenuItemInfo"));
}
#else
wxUnusedVar(hmenu);
wxUnusedVar(id);
#endif
}

View File

@@ -122,12 +122,11 @@ static const wxChar eUSERNAME[] = wxT("UserName");
// ----------------------------------------------------------------------------
// 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__)
// TODO-CE
wxUnusedVar(buf);
wxUnusedVar(maxSize);
return false;
#elif defined(__WIN32__) && !defined(__WXMICROWIN__)
DWORD nSize = maxSize;
@@ -237,12 +236,11 @@ bool wxGetFullHostName(wxChar *buf, int maxSize)
}
// 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__)
// TODO-CE
wxUnusedVar(buf);
wxUnusedVar(maxSize);
return false;
#elif defined(__WIN32__) && !defined(__WXMICROWIN__)
DWORD nSize = maxSize;
@@ -280,12 +278,11 @@ bool wxGetUserId(wxChar *buf, int maxSize)
}
// 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__)
// TODO-CE
wxUnusedVar(buf);
wxUnusedVar(maxSize);
return false;
#elif defined(USE_NET_API)
CHAR szUserName[256];
@@ -467,13 +464,12 @@ wxChar *wxGetUserHome(const wxString& WXUNUSED(user))
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__
// TODO-CE
wxUnusedVar(path);
wxUnusedVar(pTotal);
wxUnusedVar(pFree);
return false;
#else
if ( path.empty() )
@@ -583,12 +579,11 @@ bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
// env vars
// ----------------------------------------------------------------------------
bool wxGetEnv(const wxString& var, wxString *value)
bool wxGetEnv(const wxString& WXUNUSED_IN_WINCE(var),
wxString *WXUNUSED_IN_WINCE(value))
{
#ifdef __WXWINCE__
// no environment variables under CE
wxUnusedVar(var);
wxUnusedVar(value);
return false;
#else // Win32
// first get the size of the buffer
@@ -609,11 +604,15 @@ bool wxGetEnv(const wxString& var, wxString *value)
#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
// 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) )
{
wxLogLastError(_T("SetEnvironmentVariable"));
@@ -622,11 +621,6 @@ bool wxSetEnv(const wxString& var, const wxChar *value)
}
return true;
#else // no way to set env vars
// no environment variables under CE
wxUnusedVar(var);
wxUnusedVar(value);
return false;
#endif
}
@@ -946,11 +940,10 @@ bool wxShell(const wxString& command)
}
// Shutdown or reboot the PC
bool wxShutdown(wxShutdownFlags wFlags)
bool wxShutdown(wxShutdownFlags WXUNUSED_IN_WINCE(wFlags))
{
#ifdef __WXWINCE__
// TODO-CE
wxUnusedVar(wFlags);
return false;
#elif defined(__WIN32__)
bool bOK = true;