first round of Intel compiler warning fixes: down from a few thousands just to slightly more than 100

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35688 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2005-09-25 19:59:19 +00:00
parent bd090f77ee
commit 17a1ebd101
86 changed files with 713 additions and 519 deletions

View File

@@ -661,6 +661,7 @@ public:
} \
wxAppInitializer \
wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp); \
DECLARE_APP(appname) \
appname& wxGetApp() { return *(appname *)wxTheApp; }
// Same as IMPLEMENT_APP() normally but doesn't include themes support in
@@ -684,5 +685,13 @@ public:
// function
#define DECLARE_APP(appname) extern appname& wxGetApp();
// declare the stuff defined by IMPLEMENT_APP() macro, it's not really needed
// anywhere else but at the very least it suppresses icc warnings about
// defining extern symbols without prior declaration, and it shouldn't do any
// harm
extern wxAppConsole *wxCreateApp();
extern wxAppInitializer wxTheAppInitializer;
#endif // _WX_APP_H_BASE_

View File

@@ -112,13 +112,14 @@
// Use this macro to check build options. Adding it to a file in DLL will
// ensure that the DLL checks build options in same way IMPLEMENT_APP() does.
#define WX_CHECK_BUILD_OPTIONS(libName) \
static bool wxCheckBuildOptions() \
static struct wxBuildOptionsChecker \
{ \
wxAppConsole::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, \
libName); \
return true; \
} \
static bool gs_buildOptionsCheck = wxCheckBuildOptions();
wxBuildOptionsChecker() \
{ \
wxAppConsole::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, \
libName); \
} \
} gs_buildOptionsCheck;
#if WXWIN_COMPATIBILITY_2_4

View File

@@ -318,7 +318,13 @@ public:
// ctor: you can specify the text here or in SetText(), or override
// GetText()
wxTextDataObject(const wxString& text = wxEmptyString)
: wxDataObjectSimple(wxUSE_UNICODE?wxDF_UNICODETEXT:wxDF_TEXT),
: wxDataObjectSimple(
#if wxUSE_UNICODE
wxDF_UNICODETEXT
#else
wxDF_TEXT
#endif
),
m_text(text)
{
}
@@ -332,19 +338,8 @@ public:
// implement base class pure virtuals
// ----------------------------------
#if wxUSE_UNICODE && defined(__WXGTK20__)
virtual size_t GetFormatCount(Direction WXUNUSED(dir) = Get) const { return 2; }
virtual void GetAllFormats(wxDataFormat *formats,
wxDataObjectBase::Direction WXUNUSED(dir) = Get) const;
virtual size_t GetDataSize() const { return GetDataSize(GetPreferredFormat()); }
virtual bool GetDataHere(void *buf) const { return GetDataHere(GetPreferredFormat(), buf); }
virtual bool SetData(size_t len, const void *buf) { return SetData(GetPreferredFormat(), len, buf); }
size_t GetDataSize(const wxDataFormat& format) const;
bool GetDataHere(const wxDataFormat& format, void *pBuf) const;
bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf);
#elif wxUSE_UNICODE && defined(__WXMAC__)
// some platforms have 2 and not 1 format for text data
#if wxUSE_UNICODE && (defined(__WXGTK20__) || defined(__WXMAC__))
virtual size_t GetFormatCount(Direction WXUNUSED(dir) = Get) const { return 2; }
virtual void GetAllFormats(wxDataFormat *formats,
wxDataObjectBase::Direction WXUNUSED(dir) = Get) const;

View File

@@ -297,7 +297,23 @@ typedef int wxWindowID;
truncate from a larger to smaller type, static_cast<> can't be used for it
as it results in warnings when using some compilers (SGI mipspro for example)
*/
#define wx_truncate_cast(t, x) ((t)(x))
#if defined(__INTELC__) && defined(__cplusplus)
template <typename T, typename X>
inline T wx_truncate_cast_impl(X x)
{
#pragma warning(push)
/* explicit conversion of a 64-bit integral type to a smaller integral type */
#pragma warning(disable: 1683)
return (T)x;
#pragma warning(pop)
}
#define wx_truncate_cast(t, x) wx_truncate_cast_impl<t>(x)
#else /* !__INTELC__ */
#define wx_truncate_cast(t, x) ((t)(x))
#endif /* __INTELC__/!__INTELC__ */
/* for consistency with wxStatic/DynamicCast defined in wx/object.h */
#define wxConstCast(obj, className) wx_const_cast(className *, obj)
@@ -844,29 +860,43 @@ inline wxUIntPtr wxPtrToUInt(const void *p)
/*
VC++ 7.1 gives warnings about casts such as below even when they're
explicit with /Wp64 option, suppress them as we really know what we're
doing here
doing here. Same thing with icc with -Wall.
*/
#ifdef __VISUALC__
#pragma warning(disable: 4311) /* pointer truncation from '' to '' */
#if defined(__VISUALC__) || defined(__INTELC__)
#pragma warning(push)
#ifdef __VISUALC__
/* pointer truncation from '' to '' */
#pragma warning(disable: 4311)
#elif defined(__INTELC__)
/* conversion from pointer to same-sized integral type */
#pragma warning(disable: 1684)
#endif
#endif
return wx_reinterpret_cast(wxUIntPtr, p);
#ifdef __VISUALC__
#pragma warning(default: 4311)
#if defined(__VISUALC__) || defined(__INTELC__)
#pragma warning(pop)
#endif
}
inline void *wxUIntToPtr(wxUIntPtr p)
{
#ifdef __VISUALC__
#pragma warning(disable: 4312) /* conversion to type of greater size */
#if defined(__VISUALC__) || defined(__INTELC__)
#pragma warning(push)
#ifdef __VISUALC__
/* conversion to type of greater size */
#pragma warning(disable: 4312)
#elif defined(__INTELC__)
/* invalid type conversion: "wxUIntPtr={unsigned long}" to "void *" */
#pragma warning(disable: 171)
#endif
#endif
return wx_reinterpret_cast(void *, p);
#ifdef __VISUALC__
#pragma warning(default: 4312)
#if defined(__VISUALC__) || defined(__INTELC__)
#pragma warning(pop)
#endif
}
#endif /*__cplusplus*/

View File

@@ -967,10 +967,10 @@ WX_DEFINE_USER_EXPORTED_ARRAY_PTR(void *, wxArrayPtrVoid, class WXDLLIMPEXP_BASE
// append all element of one array to another one
#define WX_APPEND_ARRAY(array, other) \
{ \
size_t count = (other).size(); \
for ( size_t n = 0; n < count; n++ ) \
size_t wxAAcnt = (other).size(); \
for ( size_t wxAAn = 0; wxAAn < wxAAcnt; wxAAn++ ) \
{ \
(array).push_back((other)[n]); \
(array).push_back((other)[wxAAn]); \
} \
}
@@ -982,10 +982,10 @@ WX_DEFINE_USER_EXPORTED_ARRAY_PTR(void *, wxArrayPtrVoid, class WXDLLIMPEXP_BASE
// count on it)!
#define WX_CLEAR_ARRAY(array) \
{ \
size_t count = (array).size(); \
for ( size_t n = 0; n < count; n++ ) \
size_t wxAAcnt = (array).size(); \
for ( size_t wxAAn = 0; wxAAn < wxAAcnt; wxAAn++ ) \
{ \
delete (array)[n]; \
delete (array)[wxAAn]; \
} \
\
(array).clear(); \

View File

@@ -63,7 +63,8 @@ public:
bool GetValue() const;
// Set the label
void SetLabel(const wxBitmap& label);
virtual void SetLabel(const wxString& label) { wxControl::SetLabel(label); }
virtual void SetLabel(const wxBitmap& label);
bool Enable(bool enable = TRUE);
static wxVisualAttributes

View File

@@ -63,7 +63,8 @@ public:
bool GetValue() const;
// Set the label
void SetLabel(const wxBitmap& label);
virtual void SetLabel(const wxString& label) { wxControl::SetLabel(label); }
virtual void SetLabel(const wxBitmap& label);
bool Enable(bool enable = TRUE);
static wxVisualAttributes

View File

@@ -139,10 +139,10 @@ public:
// accessors
// get high part
long GetHi() const
{ return (long)(m_ll >> 32); }
{ return wx_truncate_cast(long, m_ll >> 32); }
// get low part
unsigned long GetLo() const
{ return (unsigned long)m_ll; }
{ return wx_truncate_cast(unsigned long, m_ll); }
// get absolute value
wxLongLongNative Abs() const { return wxLongLongNative(*this).Abs(); }
@@ -157,12 +157,12 @@ public:
wxASSERT_MSG( (m_ll >= LONG_MIN) && (m_ll <= LONG_MAX),
_T("wxLongLong to long conversion loss of precision") );
return (long)m_ll;
return wx_truncate_cast(long, m_ll);
}
#if wxABI_VERSION >= 20602
// convert to double
double ToDouble() const { return m_ll; }
double ToDouble() const { return wx_truncate_cast(double, m_ll); }
#endif // ABI >= 2.6.2
// don't provide implicit conversion to wxLongLong_t or we will have an
@@ -344,10 +344,10 @@ public:
// accessors
// get high part
unsigned long GetHi() const
{ return (unsigned long)(m_ll >> 32); }
{ return wx_truncate_cast(unsigned long, m_ll >> 32); }
// get low part
unsigned long GetLo() const
{ return (unsigned long)m_ll; }
{ return wx_truncate_cast(unsigned long, m_ll); }
// convert to native ulong long
wxULongLong_t GetValue() const { return m_ll; }
@@ -358,7 +358,7 @@ public:
wxASSERT_MSG( m_ll <= LONG_MAX,
_T("wxULongLong to long conversion loss of precision") );
return (unsigned long)m_ll;
return wx_truncate_cast(unsigned long, m_ll);
}
// operations

View File

@@ -98,4 +98,17 @@ inline bool wxIsSameDouble(double x, double y) { return x == y; }
#endif /* __cplusplus */
#if wxUSE_APPLE_IEEE
#ifdef __cplusplus
extern "C" {
#endif
/* functions from common/extended.c */
extern wxFloat64 ConvertFromIeeeExtended(const wxInt8 *bytes);
extern void ConvertToIeeeExtended(wxFloat64 num, wxInt8 *bytes);
#ifdef __cplusplus
}
#endif
#endif /* wxUSE_APPLE_IEEE */
#endif /* _WX_MATH_H_ */

View File

@@ -13,7 +13,7 @@
#define _WX_FONT_H_
#if __WXMOTIF20__ && !__WXLESSTIF__
#define wxMOTIF_NEW_FONT_HANDLING 0 // safe default, change to 1 to enable
#define wxMOTIF_NEW_FONT_HANDLING 1 // safe default, change to 1 to enable
#else
#define wxMOTIF_NEW_FONT_HANDLING 0
#endif

View File

@@ -476,6 +476,10 @@
# endif
#endif
#ifdef __INTEL_COMPILER
# define __INTELC__
#endif
/*
We get "Large Files (ILP32) not supported in strict ANSI mode." #error
from HP-UX standard headers when compiling with g++ without this:

View File

@@ -45,7 +45,7 @@
#define wxPOST_NO_WARNING_SCOPE(name)
#else
#define wxPRE_NO_WARNING_SCOPE(name) do
#define wxPOST_NO_WARNING_SCOPE(name) while ( 0 )
#define wxPOST_NO_WARNING_SCOPE(name) while ( wxFalse )
#endif
#define wxCHECKED_DELETE(ptr) \

47
include/wx/unix/private.h Normal file
View File

@@ -0,0 +1,47 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/unix/private.h
// Purpose: miscellaneous private things for Unix wx ports
// Author: Vadim Zeitlin
// Created: 2005-09-25
// RCS-ID: $Id$
// Copyright: (c) 2005 Vadim Zeitlin <vadim@wxwindows.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_UNIX_PRIVATE_H_
#define _WX_UNIX_PRIVATE_H_
// standard linux headers produce many warnings when used with icc
#if defined(__INTELC__) && defined(__LINUX__)
inline void wxFD_ZERO(fd_set *fds)
{
#pragma warning(push)
#pragma warning(disable:593)
FD_ZERO(fds);
#pragma warning(pop)
}
inline void wxFD_SET(int fd, fd_set *fds)
{
#pragma warning(push, 1)
#pragma warning(disable:1469)
FD_SET(fd, fds);
#pragma warning(pop)
}
inline bool wxFD_ISSET(int fd, fd_set *fds)
{
#pragma warning(push, 1)
#pragma warning(disable:1469)
return FD_ISSET(fd, fds);
#pragma warning(pop)
}
#else // !__INTELC__
#define wxFD_ZERO(fds) FD_ZERO(fds)
#define wxFD_SET(fd, fds) FD_SET(fd, fds)
#define wxFD_ISSET(fd, fds) FD_ISSET(fd, fds)
#endif // __INTELC__/!__INTELC__
#endif // _WX_UNIX_PRIVATE_H_