From d35f3fc573cee42ec9cd00a4a20aea0438862a06 Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Mon, 27 Nov 2017 20:39:44 +0100 Subject: [PATCH] Treat warning as errors --- CMakeLists.txt | 2 +- src/http/qhttp/http-parser/http_parser.c | 6 ++++++ src/sshagent/SSHAgent.cpp | 2 +- src/sshagent/SSHAgent.h | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b86f0eee7..ec7682c6c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,7 +97,7 @@ if(WITH_APP_BUNDLE) endif() add_gcc_compiler_flags("-fno-common") -add_gcc_compiler_flags("-Wall -Wextra -Wundef -Wpointer-arith -Wno-long-long") +add_gcc_compiler_flags("-Wall -Werror -Wextra -Wundef -Wpointer-arith -Wno-long-long") add_gcc_compiler_flags("-Wformat=2 -Wmissing-format-attribute") add_gcc_compiler_flags("-fvisibility=hidden") add_gcc_compiler_cxxflags("-fvisibility-inlines-hidden") diff --git a/src/http/qhttp/http-parser/http_parser.c b/src/http/qhttp/http-parser/http_parser.c index 895bf0c73..ab48d0cb5 100644 --- a/src/http/qhttp/http-parser/http_parser.c +++ b/src/http/qhttp/http-parser/http_parser.c @@ -1815,6 +1815,9 @@ reexecute: case 2: parser->upgrade = 1; +#if __GNUC__ >= 7 + __attribute__ ((fallthrough)); +#endif case 1: parser->flags |= F_SKIPBODY; @@ -2374,6 +2377,9 @@ http_parser_parse_url(const char *buf, size_t buflen, int is_connect, case s_req_server_with_at: found_at = 1; +#if __GNUC__ >= 7 + __attribute__ ((fallthrough)); +#endif /* FALLTROUGH */ case s_req_server: diff --git a/src/sshagent/SSHAgent.cpp b/src/sshagent/SSHAgent.cpp index a398eb4be..7969fe0cc 100644 --- a/src/sshagent/SSHAgent.cpp +++ b/src/sshagent/SSHAgent.cpp @@ -95,7 +95,7 @@ bool SSHAgent::sendMessage(const QByteArray& in, QByteArray& out) const return false; } - if (in.length() > AGENT_MAX_MSGLEN - 4) { + if (static_cast(in.length()) > AGENT_MAX_MSGLEN - 4) { return false; } diff --git a/src/sshagent/SSHAgent.h b/src/sshagent/SSHAgent.h index e96f59e59..078ff7b0d 100644 --- a/src/sshagent/SSHAgent.h +++ b/src/sshagent/SSHAgent.h @@ -63,7 +63,7 @@ private: #ifndef Q_OS_WIN QString m_socketPath; #else - const int AGENT_MAX_MSGLEN = 8192; + const quint32 AGENT_MAX_MSGLEN = 8192; const quint32 AGENT_COPYDATA_ID = 0x804e50ba; #endif