From 751f2c82c4121d28d0740bffb29a4fb273ec55c5 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 21 Jun 2016 22:19:15 +0200 Subject: Catch errors --- CMakeLists.txt | 2 +- common/changereplay.cpp | 2 +- common/domainadaptor.h | 7 +++---- common/resourcefacade.cpp | 2 +- examples/imapresource/imapserverproxy.cpp | 2 +- examples/maildirresource/maildirresource.cpp | 1 - examples/mailtransportresource/mailtransport.cpp | 2 +- synchronizer/main.cpp | 6 ++---- 8 files changed, 10 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1eb16a1..8213bed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,7 +72,7 @@ endfunction() set(CMAKE_AUTOMOC ON) if (${CATCH_ERRORS}) - add_definitions("-Werror -Wall -Weverything -Wno-unused-function -Wno-cast-align -Wno-used-but-marked-unused -Wno-shadow -Wno-weak-vtables -Wno-global-constructors -Wno-deprecated -Wno-weak-template-vtables -Wno-exit-time-destructors -Wno-covered-switch-default -Wno-shorten-64-to-32 -Wno-documentation -Wno-old-style-cast -Wno-extra-semi -Wno-unused-parameter -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-padded -Wno-missing-noreturn -Wno-missing-prototypes -Wno-documentation-unknown-command -Wno-sign-conversion") + add_definitions("-Werror -Wall -Weverything -Wno-unused-function -Wno-cast-align -Wno-used-but-marked-unused -Wno-shadow -Wno-weak-vtables -Wno-global-constructors -Wno-deprecated -Wno-weak-template-vtables -Wno-exit-time-destructors -Wno-covered-switch-default -Wno-shorten-64-to-32 -Wno-documentation -Wno-old-style-cast -Wno-extra-semi -Wno-unused-parameter -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-padded -Wno-missing-noreturn -Wno-missing-prototypes -Wno-documentation-unknown-command -Wno-sign-conversion -Wno-gnu-zero-variadic-macro-arguments -Wno-disabled-macro-expansion -Wno-vla-extension -Wno-vla") endif() add_definitions("-std=c++0x -g") include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${FLATBUFFERS_INCLUDE_DIR} ${CMAKE_BINARY_DIR}/common) diff --git a/common/changereplay.cpp b/common/changereplay.cpp index 51443e8..0096bd0 100644 --- a/common/changereplay.cpp +++ b/common/changereplay.cpp @@ -128,5 +128,5 @@ void ChangeReplay::revisionChanged() #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wundefined-reinterpret-cast" -#include "changereplay.moc" +#include "moc_changereplay.cpp" #pragma clang diagnostic pop diff --git a/common/domainadaptor.h b/common/domainadaptor.h index e97c5f5..8ac8171 100644 --- a/common/domainadaptor.h +++ b/common/domainadaptor.h @@ -94,14 +94,13 @@ public: { } - virtual QVariant setProperty(const QByteArray &key, const QVariant &value) const + virtual void setProperty(const QByteArray &key, const QVariant &value) Q_DECL_OVERRIDE { - Q_ASSERT(false); Warning() << "Can't set property " << key; - return QVariant(); + Q_ASSERT(false); } - virtual QVariant getProperty(const QByteArray &key) const + virtual QVariant getProperty(const QByteArray &key) const Q_DECL_OVERRIDE { if (mResourceBuffer && mResourceMapper->hasMapping(key)) { return mResourceMapper->getProperty(key, mResourceBuffer); diff --git a/common/resourcefacade.cpp b/common/resourcefacade.cpp index 65ff05c..3901f43 100644 --- a/common/resourcefacade.cpp +++ b/common/resourcefacade.cpp @@ -220,5 +220,5 @@ IdentityFacade::~IdentityFacade() #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wundefined-reinterpret-cast" -#include "resourcefacade.moc" +#include "moc_resourcefacade.cpp" #pragma clang diagnostic pop diff --git a/examples/imapresource/imapserverproxy.cpp b/examples/imapresource/imapserverproxy.cpp index a82e3ac..703caca 100644 --- a/examples/imapresource/imapserverproxy.cpp +++ b/examples/imapresource/imapserverproxy.cpp @@ -87,7 +87,7 @@ class SessionUiProxy : public KIMAP::SessionUiProxy { } }; -ImapServerProxy::ImapServerProxy(const QString &serverUrl, int port) : mSession(new KIMAP::Session(serverUrl, port)) +ImapServerProxy::ImapServerProxy(const QString &serverUrl, int port) : mSession(new KIMAP::Session(serverUrl, qint16(port))) { mSession->setUiProxy(SessionUiProxy::Ptr(new SessionUiProxy)); mSession->setTimeout(10); diff --git a/examples/maildirresource/maildirresource.cpp b/examples/maildirresource/maildirresource.cpp index 23e25c4..ea780cc 100644 --- a/examples/maildirresource/maildirresource.cpp +++ b/examples/maildirresource/maildirresource.cpp @@ -164,7 +164,6 @@ public: auto identifier = oldMaildir.moveEntryTo(oldIdentifier, maildir); return path + "/" + identifier; } - return oldPath; } void newEntity(const QByteArray &uid, qint64 revision, Sink::ApplicationDomain::BufferAdaptor &newEntity, Sink::Storage::Transaction &transaction) Q_DECL_OVERRIDE diff --git a/examples/mailtransportresource/mailtransport.cpp b/examples/mailtransportresource/mailtransport.cpp index 5985562..4f7e59b 100644 --- a/examples/mailtransportresource/mailtransport.cpp +++ b/examples/mailtransportresource/mailtransport.cpp @@ -48,7 +48,7 @@ static size_t payload_source(void *ptr, size_t size, size_t nmemb, void *userp) if (len > size * nmemb) { len = size * nmemb; } - fprintf(stderr, "read n bytes: %d\n",len); + fprintf(stderr, "read n bytes: %d\n", int(len)); memcpy(ptr, data, len); upload_ctx->offset += len; return len; diff --git a/synchronizer/main.cpp b/synchronizer/main.cpp index a30aebb..3168bfc 100644 --- a/synchronizer/main.cpp +++ b/synchronizer/main.cpp @@ -37,7 +37,7 @@ #undef DEBUG_AREA #define DEBUG_AREA "resource" -Listener *listener = nullptr; +static Listener *listener = nullptr; //Print a demangled stacktrace void printStacktrace() @@ -78,14 +78,13 @@ void printStacktrace() std::cerr << trace_buf.str(); } -int sCounter = 0; +static int sCounter = 0; void crashHandler(int signal) { //Guard against crashing in here if (sCounter > 1) { std::_Exit(EXIT_FAILURE); - return; } sCounter++; @@ -107,7 +106,6 @@ void crashHandler(int signal) // std::system("exec xterm -e gdb -p \"$PPID\""); std::_Exit(EXIT_FAILURE); - return; } void terminateHandler() -- cgit v1.2.3