From 644051bad4ce7b088ea8af07c9b82a5920c96f4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Wed, 9 Jun 2010 21:00:55 +0200 Subject: Enabled & fixed some more C++ warnings. diff --git a/3rdParty/Boost/SConscript b/3rdParty/Boost/SConscript index 49e66e5..9181425 100644 --- a/3rdParty/Boost/SConscript +++ b/3rdParty/Boost/SConscript @@ -16,6 +16,11 @@ elif env.get("BOOST_BUNDLED", False) : ################################################################################ cppdefines = ["BOOST_ALL_NO_LIB"] + if env["PLATFORM"] == "win32" : + cppflags = ["/I" + Dir("src").abspath] + else : + cppflags = [("-isystem", Dir("src").abspath)] + ################################################################################ # Flags @@ -23,7 +28,7 @@ elif env.get("BOOST_BUNDLED", False) : if env["SCONS_STAGE"] == "flags" : env["BOOST_FLAGS"] = { - "CPPFLAGS": ["-I" + Dir("src").abspath], + "CPPFLAGS": cppflags, "CPPDEFINES": cppdefines, "LIBPATH": [Dir(".")], "LIBS": ["Boost"] @@ -41,7 +46,7 @@ elif env.get("BOOST_BUNDLED", False) : if env["SCONS_STAGE"] == "build" : myenv = env.Clone() - myenv.Replace(CCFLAGS = [flag for flag in env["CCFLAGS"] if flag not in ["-W", "-Wall"]]) + myenv.Replace(CXXFLAGS = [flag for flag in env["CXXFLAGS"] if not flag.startswith("-W")]) sources = [ "src/libs/date_time/src/gregorian/date_generators.cpp", @@ -100,7 +105,7 @@ elif env.get("BOOST_BUNDLED", False) : "src/libs/thread/src/win32/tss_dll.cpp", "src/libs/thread/src/win32/tss_pe.cpp"] - myenv.StaticLibrary("Boost", sources, CPPFLAGS = "-I" + Dir("src").abspath, CPPDEFINES = cppdefines) + myenv.StaticLibrary("Boost", sources, CPPFLAGS = cppflags, CPPDEFINES = cppdefines) if ARGUMENTS.get("BOOST_BUILD_BCP") or env.GetOption("clean") : bcp_env = myenv.Clone() diff --git a/BuildTools/SCons/SConstruct b/BuildTools/SCons/SConstruct index a8c8529..3a41be4 100644 --- a/BuildTools/SCons/SConstruct +++ b/BuildTools/SCons/SConstruct @@ -110,8 +110,7 @@ if env["warnings"] : if env["PLATFORM"] == "win32" : env.Append(CCFLAGS = ["/Wall"]) else : - env.Append(CXXFLAGS = ["-W", "-Wall", "-Wnon-virtual-dtor"]) - #env.Append(CCFLAGS = ["-W", "-Wall", "-Wredundant-decls", "-pedantic", "-Wno-long-long", "-Woverloaded-virtual", "-Wundef", "-Wfloat-equal", "-Wold-style-cast"]) + env.Append(CXXFLAGS = ["-Wextra", "-Wall", "-Wnon-virtual-dtor", "-Wundef", "-Wold-style-cast", "-Wno-long-long", "-Woverloaded-virtual", "-Wfloat-equal", "-Wredundant-decls"]) gccVersion = env["CCVERSION"].split(".") if gccVersion >= ["4", "5", "0"] : env.Append(CCFLAGS = ["-Wlogical-op"]) diff --git a/Slimber/Cocoa/CocoaMenulet.mm b/Slimber/Cocoa/CocoaMenulet.mm index 72ab000..90e699f 100644 --- a/Slimber/Cocoa/CocoaMenulet.mm +++ b/Slimber/Cocoa/CocoaMenulet.mm @@ -1,5 +1,7 @@ #include "Slimber/Cocoa/CocoaMenulet.h" +#pragma GCC diagnostic ignored "-Wold-style-cast" + #include using namespace Swift; diff --git a/SwifTools/Idle/MacOSXIdleQuerier.cpp b/SwifTools/Idle/MacOSXIdleQuerier.cpp index 2d0f654..4760285 100644 --- a/SwifTools/Idle/MacOSXIdleQuerier.cpp +++ b/SwifTools/Idle/MacOSXIdleQuerier.cpp @@ -6,6 +6,8 @@ #include "SwifTools/Idle/MacOSXIdleQuerier.h" +#pragma GCC diagnostic ignored "-Wold-style-cast" + #include #include #include diff --git a/Swift/QtUI/ChatList/QtChatListWindowFactory.cpp b/Swift/QtUI/ChatList/QtChatListWindowFactory.cpp index 2705058..0e9d324 100644 --- a/Swift/QtUI/ChatList/QtChatListWindowFactory.cpp +++ b/Swift/QtUI/ChatList/QtChatListWindowFactory.cpp @@ -16,7 +16,7 @@ QtChatListWindowFactory::QtChatListWindowFactory(QtMainWindowFactory* mainWindow } ChatListWindow* QtChatListWindowFactory::createWindow(UIEventStream* /*uiEventStream*/) { - return ((QtMainWindow*)mainWindowFactory_->getLastCreatedWindow())->getChatListWindow(); + return static_cast(mainWindowFactory_->getLastCreatedWindow())->getChatListWindow(); } } diff --git a/Swift/QtUI/EventViewer/QtEventWindowFactory.cpp b/Swift/QtUI/EventViewer/QtEventWindowFactory.cpp index ac8ae06..45f6da0 100644 --- a/Swift/QtUI/EventViewer/QtEventWindowFactory.cpp +++ b/Swift/QtUI/EventViewer/QtEventWindowFactory.cpp @@ -16,7 +16,7 @@ QtEventWindowFactory::QtEventWindowFactory(QtMainWindowFactory* mainWindowFactor } EventWindow* QtEventWindowFactory::createEventWindow() { - return ((QtMainWindow*)mainWindowFactory_->getLastCreatedWindow())->getEventWindow(); + return static_cast(mainWindowFactory_->getLastCreatedWindow())->getEventWindow(); } } diff --git a/Swift/QtUI/QtStatusWidget.cpp b/Swift/QtUI/QtStatusWidget.cpp index d7c0e63..459b283 100644 --- a/Swift/QtUI/QtStatusWidget.cpp +++ b/Swift/QtUI/QtStatusWidget.cpp @@ -205,7 +205,7 @@ StatusShow::Type QtStatusWidget::getSelectedStatusShow() { void QtStatusWidget::handleItemClicked(QListWidgetItem* item) { editing_ = false; - selectedStatusType_ = (StatusShow::Type)(item->data(Qt::UserRole).toInt()); + selectedStatusType_ = static_cast(item->data(Qt::UserRole).toInt()); newStatusText_ = item->data(Qt::DisplayRole).toString(); statusEdit_->setText(newStatusText_); handleEditComplete(); diff --git a/Swift/QtUI/Roster/RosterModel.cpp b/Swift/QtUI/Roster/RosterModel.cpp index fa9becd..d705d34 100644 --- a/Swift/QtUI/Roster/RosterModel.cpp +++ b/Swift/QtUI/Roster/RosterModel.cpp @@ -169,7 +169,7 @@ QModelIndex RosterModel::index(int row, int column, const QModelIndex& parent) c parentItem = dynamic_cast(getItem(parent)); if (!parentItem) return QModelIndex(); } - return (size_t)row < parentItem->getDisplayedChildren().size() ? createIndex(row, column, parentItem->getDisplayedChildren()[row]) : QModelIndex(); + return static_cast(row) < parentItem->getDisplayedChildren().size() ? createIndex(row, column, parentItem->getDisplayedChildren()[row]) : QModelIndex(); } QModelIndex RosterModel::index(RosterItem* item) const { diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript index 80e3d56..ddc0b31 100644 --- a/Swift/QtUI/SConscript +++ b/Swift/QtUI/SConscript @@ -20,7 +20,7 @@ def generateDefaultTheme(dir) : Import("env") myenv = env.Clone() - +myenv["CXXFLAGS"] = filter(lambda x : x != "-Wfloat-equal", myenv["CXXFLAGS"]) myenv.MergeFlags(env["SWIFT_CONTROLLERS_FLAGS"]) myenv.MergeFlags(env["SWIFTOOLS_FLAGS"]) if myenv["HAVE_XSS"] : diff --git a/Swiften/Compress/ZLibCompressor.cpp b/Swiften/Compress/ZLibCompressor.cpp new file mode 100644 index 0000000..7e3116e --- /dev/null +++ b/Swiften/Compress/ZLibCompressor.cpp @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2010 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include "Swiften/Compress/ZLibCompressor.h" + +#pragma GCC diagnostic ignored "-Wold-style-cast" + +namespace Swift { + +ZLibCompressor::ZLibCompressor() { + int result = deflateInit(&stream_, COMPRESSION_LEVEL); + assert(result == Z_OK); + (void) result; +} + +} diff --git a/Swiften/Compress/ZLibCompressor.h b/Swiften/Compress/ZLibCompressor.h index d1d835b..7fe5387 100644 --- a/Swiften/Compress/ZLibCompressor.h +++ b/Swiften/Compress/ZLibCompressor.h @@ -4,8 +4,7 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ -#ifndef SWIFTEN_ZLibCompressor_H -#define SWIFTEN_ZLibCompressor_H +#pragma once #include @@ -15,11 +14,7 @@ namespace Swift { class ZLibCompressor : public ZLibCodecompressor { public: - ZLibCompressor() { - int result = deflateInit(&stream_, COMPRESSION_LEVEL); - assert(result == Z_OK); - (void) result; - } + ZLibCompressor(); ~ZLibCompressor() { deflateEnd(&stream_); @@ -33,5 +28,3 @@ namespace Swift { static const int COMPRESSION_LEVEL = 9; }; } - -#endif diff --git a/Swiften/Compress/ZLibDecompressor.cpp b/Swiften/Compress/ZLibDecompressor.cpp new file mode 100644 index 0000000..af7349b --- /dev/null +++ b/Swiften/Compress/ZLibDecompressor.cpp @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2010 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include "Swiften/Compress/ZLibDecompressor.h" + +#pragma GCC diagnostic ignored "-Wold-style-cast" + +namespace Swift { + +ZLibDecompressor::ZLibDecompressor() { + int result = inflateInit(&stream_); + assert(result == Z_OK); + (void) result; +} + +} diff --git a/Swiften/Compress/ZLibDecompressor.h b/Swiften/Compress/ZLibDecompressor.h index ce8573e..ec08a4f 100644 --- a/Swiften/Compress/ZLibDecompressor.h +++ b/Swiften/Compress/ZLibDecompressor.h @@ -4,8 +4,7 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ -#ifndef SWIFTEN_ZLibDecompressor_H -#define SWIFTEN_ZLibDecompressor_H +#pragma once #include @@ -15,11 +14,7 @@ namespace Swift { class ZLibDecompressor : public ZLibCodecompressor { public: - ZLibDecompressor() { - int result = inflateInit(&stream_); - assert(result == Z_OK); - (void) result; - } + ZLibDecompressor(); ~ZLibDecompressor() { inflateEnd(&stream_); @@ -30,5 +25,3 @@ namespace Swift { } }; } - -#endif diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveHostnameQuery.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveHostnameQuery.h index cea22d4..de52321 100644 --- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveHostnameQuery.h +++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveHostnameQuery.h @@ -6,6 +6,8 @@ #pragma once +#pragma GCC diagnostic ignored "-Wold-style-cast" + #include "Swiften/Base/String.h" #include "Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.h" #include "Swiften/LinkLocal/DNSSD/DNSSDResolveHostnameQuery.h" diff --git a/Swiften/Network/PlatformDomainNameServiceQuery.cpp b/Swiften/Network/PlatformDomainNameServiceQuery.cpp index 3ee0b18..aa0be4e 100644 --- a/Swiften/Network/PlatformDomainNameServiceQuery.cpp +++ b/Swiften/Network/PlatformDomainNameServiceQuery.cpp @@ -6,6 +6,8 @@ #include "Swiften/Network/PlatformDomainNameServiceQuery.h" +#pragma GCC diagnostic ignored "-Wold-style-cast" + #include "Swiften/Base/Platform.h" #include #ifdef SWIFTEN_PLATFORM_WINDOWS diff --git a/Swiften/SConscript b/Swiften/SConscript index 2d5490c..33a1a7e 100644 --- a/Swiften/SConscript +++ b/Swiften/SConscript @@ -33,6 +33,8 @@ if env["SCONS_STAGE"] == "build" : "Client/Client.cpp", "Client/ClientSession.cpp", "Compress/ZLibCodecompressor.cpp", + "Compress/ZLibDecompressor.cpp", + "Compress/ZLibCompressor.cpp", "Disco/CapsInfoGenerator.cpp", "Elements/DiscoInfo.cpp", "Elements/Element.cpp", diff --git a/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp index 36aa47f..4586a74 100644 --- a/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp @@ -13,7 +13,7 @@ namespace Swift { MUCPayloadSerializer::MUCPayloadSerializer() : GenericPayloadSerializer() { } -String MUCPayloadSerializer::serializePayload(boost::shared_ptr payload) const { +String MUCPayloadSerializer::serializePayload(boost::shared_ptr) const { XMLElement mucElement("x", "http://jabber.org/protocol/muc"); return mucElement.serialize(); } diff --git a/Swiften/StringCodecs/MD5.cpp b/Swiften/StringCodecs/MD5.cpp index 09c3a42..718f52e 100644 --- a/Swiften/StringCodecs/MD5.cpp +++ b/Swiften/StringCodecs/MD5.cpp @@ -31,6 +31,8 @@ ghost@aladdin.com */ +#pragma GCC diagnostic ignored "-Wold-style-cast" + #include "Swiften/StringCodecs/MD5.h" #include -- cgit v0.10.2-6-g49f6