From: Vadim Zeitlin Date: Sun, 16 Nov 2008 14:24:13 +0000 (+0000) Subject: fix some of icc 11.0 warnings and disable a few others X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/5c69ef61f3ad09c0aef39915d4361a534f598520 fix some of icc 11.0 warnings and disable a few others git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56792 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/configure.in b/configure.in index a402c5825a..ff46cc9b4d 100644 --- a/configure.in +++ b/configure.in @@ -7409,14 +7409,14 @@ dnl check for icc before gcc as icc is also recognized as gcc if test "x$INTELCC" = "xyes" ; then dnl Warnings which can't be easily suppressed in C code are disabled: dnl - dnl remark #810: conversion from "x" to "y" may lose significant bits - dnl remark #869: parameter "foo" was never referenced - dnl remark #1572: floating-point equality and inequality comparisons - dnl are unreliable - dnl remark #1684: conversion from pointer to same-sized integral type - dnl - dnl (for others see below) - CWARNINGS="-Wall -wd810,869,981,1418,1572,1684" + dnl #810: conversion from "x" to "y" may lose significant bits + dnl #869: parameter "foo" was never referenced + dnl #1572: floating-point equality and inequality comparisons + dnl are unreliable + dnl #1684: conversion from pointer to same-sized integral type + dnl #2259: non-pointer conversion from "x" to "y" may lose significant + dnl bits + CWARNINGS="-Wall -wd810,869,981,1418,1572,1684,2259" elif test "$GCC" = yes ; then CWARNINGS="-Wall -Wundef" fi @@ -7428,15 +7428,16 @@ if test "x$INTELCXX" = "xyes" ; then dnl (279) are generated for standard macros and so there is nothing we can dnl do about them dnl - dnl remark #279: controlling expression is constant - dnl remark #383: value copied to temporary, reference to temporary used - dnl remark #444: destructor for base class "xxx" is not virtual - dnl remark #810: conversion from "x" to "y" may lose significant bits - dnl remark #869: parameter "foo" was never referenced - dnl remark #981: operands are evaluated in unspecified order - dnl remark #1418: external definition with no prior declaration - dnl remark #1419: external declaration in primary source file - CXXWARNINGS="-Wall -wd279,383,444,810,869,981,1418,1419" + dnl #279: controlling expression is constant + dnl #383: value copied to temporary, reference to temporary used + dnl #444: destructor for base class "xxx" is not virtual + dnl #981: operands are evaluated in unspecified order + dnl #1418: external definition with no prior declaration + dnl #1419: external declaration in primary source file + dnl #1881: argument must be a constant null pointer value + dnl + dnl (for others see CWARNINGS above) + CXXWARNINGS="-Wall -wd279,383,444,810,869,981,1418,1419,1881,2259" elif test "$GXX" = yes ; then CXXWARNINGS="-Wall -Wundef -Wunused-parameter -Wno-ctor-dtor-privacy" AX_CXXFLAGS_GCC_OPTION(-Woverloaded-virtual, CXXWARNINGS) diff --git a/include/wx/buffer.h b/include/wx/buffer.h index 231c8d185f..e8de10a3c7 100644 --- a/include/wx/buffer.h +++ b/include/wx/buffer.h @@ -179,7 +179,7 @@ public: private: // reference-counted data - struct Data : wxPrivate::UntypedBufferData + struct Data : public wxPrivate::UntypedBufferData { Data(CharType *str, Kind kind = Owned) : UntypedBufferData(str, kind) diff --git a/include/wx/defs.h b/include/wx/defs.h index c3e61462d5..38bba222a7 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -268,6 +268,8 @@ typedef short int WXTYPE; #pragma warning(disable: 1682) /* conversion from "X" to "T" may lose significant bits */ #pragma warning(disable: 810) + /* non-pointer conversion from "foo" to "bar" may lose significant bits */ + #pragma warning(disable: 2259) return x; diff --git a/include/wx/strconv.h b/include/wx/strconv.h index 148eeb01e0..74e871324b 100644 --- a/include/wx/strconv.h +++ b/include/wx/strconv.h @@ -279,7 +279,7 @@ private: // the current decoder state: this is only used by ToWChar() if srcLen // parameter is not wxNO_LEN, when working on the entire NUL-terminated // strings we neither update nor use the state - class DecoderState : StateMode + class DecoderState : private StateMode { private: // current state: this one is private as we want to enforce the use of @@ -311,7 +311,7 @@ private: // encoder state is simpler as we always receive entire Unicode characters // on input - class EncoderState : StateMode + class EncoderState : private StateMode { private: Mode mode; diff --git a/include/wx/strvararg.h b/include/wx/strvararg.h index 7364cd61b3..4a9f0dbdd6 100644 --- a/include/wx/strvararg.h +++ b/include/wx/strvararg.h @@ -564,7 +564,7 @@ struct wxArgNormalizerNarrowChar // FIXME-UTF8: which one is better default in absence of fmt string // (i.e. when used like e.g. Foo("foo", "bar", 'c', NULL)? if ( !fmt || fmt->GetArgumentType(index) == wxFormatString::Arg_Char ) - m_value = wxUniChar(value).GetValue(); + m_value = wx_truncate_cast(T, wxUniChar(value).GetValue()); else m_value = value; } diff --git a/include/wx/unichar.h b/include/wx/unichar.h index 8503c41992..9d0b593bd7 100644 --- a/include/wx/unichar.h +++ b/include/wx/unichar.h @@ -155,7 +155,7 @@ private: { #if wxUSE_UNICODE if ( c < 0x80 ) - return c; + return wx_truncate_cast(char, c); return ToHi8bit(c); #else diff --git a/src/common/imagjpeg.cpp b/src/common/imagjpeg.cpp index 4772973a9d..8260ad683f 100644 --- a/src/common/imagjpeg.cpp +++ b/src/common/imagjpeg.cpp @@ -148,7 +148,7 @@ CPP_METHODDEF(void) wx_term_source ( j_decompress_ptr cinfo ) // JPEG error manager: -struct wx_error_mgr : jpeg_error_mgr +struct wx_error_mgr : public jpeg_error_mgr { jmp_buf setjmp_buffer; /* for return to caller */ }; diff --git a/src/common/strconv.cpp b/src/common/strconv.cpp index aa084f52c2..64d31ae750 100644 --- a/src/common/strconv.cpp +++ b/src/common/strconv.cpp @@ -3364,6 +3364,11 @@ wxCharBuffer wxSafeConvertWX2MB(const wchar_t *ws) #define WX_DEFINE_GLOBAL_CONV(klass, name, ctor_args) \ WX_DEFINE_GLOBAL_CONV2(klass, klass, name, ctor_args) +#ifdef __INTELC__ + // disable warning "variable 'xxx' was declared but never referenced" + #pragma warning(disable: 177) +#endif // Intel C++ + #ifdef __WINDOWS__ WX_DEFINE_GLOBAL_CONV2(wxMBConv, wxMBConv_win32, wxConvLibc, wxEMPTY_PARAMETER_VALUE); #else diff --git a/src/common/ustring.cpp b/src/common/ustring.cpp index a9b9241eb4..1c23bf0da7 100644 --- a/src/common/ustring.cpp +++ b/src/common/ustring.cpp @@ -25,10 +25,10 @@ wxUString &wxUString::assignFromAscii( const char *str ) { size_type len = wxStrlen( str ); - + wxU32CharBuffer buffer( len ); wxChar32 *ptr = buffer.data(); - + size_type i; for (i = 0; i < len; i++) { @@ -36,7 +36,7 @@ wxUString &wxUString::assignFromAscii( const char *str ) ptr++; str++; } - + return assign( buffer ); } @@ -49,10 +49,10 @@ wxUString &wxUString::assignFromAscii( const char *str, size_type n ) len++; s++; } - + wxU32CharBuffer buffer( len ); wxChar32 *ptr = buffer.data(); - + size_type i; for (i = 0; i < len; i++) { @@ -60,7 +60,7 @@ wxUString &wxUString::assignFromAscii( const char *str, size_type n ) ptr++; str++; } - + return *this; } @@ -68,9 +68,6 @@ wxUString &wxUString::assignFromAscii( const char *str, size_type n ) // UTF-8 // ---------------------------------------------------------------------------- -static const wxUint32 utf8_max[]= - { 0x7f, 0x7ff, 0xffff, 0x1fffff, 0x3ffffff, 0x7fffffff, 0xffffffff }; - // this table gives the length of the UTF-8 encoding from its first character: const unsigned char tableUtf8Lengths[256] = { // single-byte sequences (ASCII): @@ -110,7 +107,7 @@ wxUString &wxUString::assignFromUTF8( const char *str ) { if (!str) return assign( wxUString() ); - + size_type ucs4_len = 0; const char *p = str; while (*p) @@ -125,7 +122,7 @@ wxUString &wxUString::assignFromUTF8( const char *str ) wxU32CharBuffer buffer( ucs4_len ); wxChar32 *out = buffer.data(); - + p = str; while (*p) { @@ -178,7 +175,7 @@ wxUString &wxUString::assignFromUTF8( const char *str ) code <<= 6; code |= c & 0x3F; } - + *out = code; p++; } @@ -192,7 +189,7 @@ wxUString &wxUString::assignFromUTF8( const char *str, size_type n ) { if (!str) return assign( wxUString() ); - + size_type ucs4_len = 0; size_type utf8_pos = 0; const char *p = str; @@ -208,10 +205,10 @@ wxUString &wxUString::assignFromUTF8( const char *str, size_type n ) ucs4_len ++; p += len; } - + wxU32CharBuffer buffer( ucs4_len ); wxChar32 *out = buffer.data(); - + utf8_pos = 0; p = str; while (*p) @@ -222,7 +219,7 @@ wxUString &wxUString::assignFromUTF8( const char *str, size_type n ) if (utf8_pos + 1 > n) break; utf8_pos++; - + *out = c; p++; } @@ -272,13 +269,13 @@ wxUString &wxUString::assignFromUTF8( const char *str, size_type n ) code <<= 6; code |= c & 0x3F; } - + *out = code; p++; } out++; } - + *out = 0; return assign( buffer.data() ); @@ -288,7 +285,7 @@ wxUString &wxUString::assignFromUTF16( const wxChar16* str, size_type n ) { if (!str) return assign( wxUString() ); - + size_type ucs4_len = 0; size_type utf16_pos = 0; const wxChar16 *p = str; @@ -307,10 +304,10 @@ wxUString &wxUString::assignFromUTF16( const wxChar16* str, size_type n ) { len = 2; } - + if (utf16_pos + len > n) break; - + ucs4_len++; p += len; utf16_pos += len; @@ -320,7 +317,7 @@ wxUString &wxUString::assignFromUTF16( const wxChar16* str, size_type n ) wxChar32 *out = buffer.data(); utf16_pos = 0; - + p = str; while (*p) { @@ -328,7 +325,7 @@ wxUString &wxUString::assignFromUTF16( const wxChar16* str, size_type n ) { if (utf16_pos + 1 > n) break; - + *out = *p; p++; utf16_pos++; @@ -337,14 +334,14 @@ wxUString &wxUString::assignFromUTF16( const wxChar16* str, size_type n ) { if (utf16_pos + 2 > n) break; - + *out = ((p[0] - 0xd7c0) << 10) + (p[1] - 0xdc00); p += 2; utf16_pos += 2; } out++; } - + return assign( buffer.data() ); } @@ -352,7 +349,7 @@ wxUString &wxUString::assignFromUTF16( const wxChar16* str ) { if (!str) return assign( wxUString() ); - + size_type ucs4_len = 0; const wxChar16 *p = str; while (*p) @@ -370,14 +367,14 @@ wxUString &wxUString::assignFromUTF16( const wxChar16* str ) { len = 2; } - + ucs4_len++; p += len; } wxU32CharBuffer buffer( ucs4_len ); wxChar32 *out = buffer.data(); - + p = str; while (*p) { @@ -393,7 +390,7 @@ wxUString &wxUString::assignFromUTF16( const wxChar16* str ) } out++; } - + return assign( buffer.data() ); } @@ -401,9 +398,9 @@ wxUString &wxUString::assignFromCString( const char* str ) { if (!str) return assign( wxUString() ); - + wxWCharBuffer buffer = wxConvLibc.cMB2WC( str ); - + return assign( buffer ); } @@ -411,9 +408,9 @@ wxUString &wxUString::assignFromCString( const char* str, const wxMBConv &conv ) { if (!str) return assign( wxUString() ); - + wxWCharBuffer buffer = conv.cMB2WC( str ); - + return assign( buffer ); } @@ -421,12 +418,12 @@ wxCharBuffer wxUString::utf8_str() const { size_type utf8_length = 0; const wxChar32 *ptr = data(); - + while (*ptr) { wxChar32 code = *ptr; ptr++; - + if ( code <= 0x7F ) { utf8_length++; @@ -448,17 +445,17 @@ wxCharBuffer wxUString::utf8_str() const // invalid range, skip } } - + wxCharBuffer result( utf8_length ); - + char *out = result.data(); - + ptr = data(); while (*ptr) { wxChar32 code = *ptr; ptr++; - + if ( code <= 0x7F ) { out[0] = (char)code; @@ -493,40 +490,40 @@ wxCharBuffer wxUString::utf8_str() const wxPrintf( "utf8_str %s len %d\n", result, wxStrlen( result.data() ) ); wxPrintf( "utf8_str %s len %d\n", result, wxStrlen( result.data() ) ); - + return result; } - + wxU16CharBuffer wxUString::utf16_str() const { size_type utf16_length = 0; const wxChar32 *ptr = data(); - + while (*ptr) { wxChar32 code = *ptr; ptr++; - + // TODO: error range checks - + if (code < 0x10000) utf16_length++; else utf16_length += 2; } - + wxU16CharBuffer result( utf16_length ); wxChar16 *out = result.data(); - + ptr = data(); - + while (*ptr) { wxChar32 code = *ptr; ptr++; - + // TODO: error range checks - + if (code < 0x10000) { out[0] = code; @@ -539,6 +536,6 @@ wxU16CharBuffer wxUString::utf16_str() const out += 2; } } - - return result; + + return result; } diff --git a/src/generic/dcpsg.cpp b/src/generic/dcpsg.cpp index 06880bc1c7..759bd01d8a 100644 --- a/src/generic/dcpsg.cpp +++ b/src/generic/dcpsg.cpp @@ -1226,7 +1226,6 @@ void wxPostScriptDCImpl::SetPen( const wxPen& pen ) double bluePS = (double)(blue) / 255.0; double greenPS = (double)(green) / 255.0; - wxString buffer; buffer.Printf( "%f %f %f setrgbcolor\n", redPS, greenPS, bluePS ); buffer.Replace( ",", "." ); PsPrint( buffer ); diff --git a/src/generic/progdlgg.cpp b/src/generic/progdlgg.cpp index 25a42355ae..b3050261fe 100644 --- a/src/generic/progdlgg.cpp +++ b/src/generic/progdlgg.cpp @@ -148,7 +148,6 @@ wxProgressDialog::wxProgressDialog(const wxString& title, m_msg = new wxStaticText(this, wxID_ANY, message); sizerTop->Add(m_msg, 0, wxLEFT | wxTOP, 2*LAYOUT_MARGIN); - wxSize sizeLabel = m_msg->GetSize(); if ( maximum > 0 ) { int gauge_style = wxGA_HORIZONTAL; diff --git a/src/gtk/dialog.cpp b/src/gtk/dialog.cpp index d9d6dd1e9c..8c40909e05 100644 --- a/src/gtk/dialog.cpp +++ b/src/gtk/dialog.cpp @@ -25,7 +25,7 @@ // this is defined in src/gtk/toplevel.cpp extern int wxOpenModalDialogsCount; -wxDEFINE_TIED_SCOPED_PTR_TYPE(wxGUIEventLoop); +wxDEFINE_TIED_SCOPED_PTR_TYPE(wxGUIEventLoop) //----------------------------------------------------------------------------- diff --git a/src/unix/mimetype.cpp b/src/unix/mimetype.cpp index 9467a8c1b4..c9d7bc93ad 100644 --- a/src/unix/mimetype.cpp +++ b/src/unix/mimetype.cpp @@ -603,7 +603,6 @@ void wxMimeTypesManagerImpl::Initialize(int mailcapStyles, { if (textfile.GetLine(i).Find(wxT("=")) != wxNOT_FOUND) { - wxString mimeType = textfile.GetVerb(i); wxString desktopFile = textfile.GetCmd(i); if (deskTopFilesSeen.Index(desktopFile) == wxNOT_FOUND)