diff options
-rw-r--r-- | .github/workflows/ci-linux.yml | 1 | ||||
-rw-r--r-- | CMakeLists.txt | 17 | ||||
-rw-r--r-- | include/modules/httpd.h | 3 | ||||
-rw-r--r-- | include/regchannel.h | 1 | ||||
-rw-r--r-- | modules/extra/m_mysql.cpp | 2 | ||||
-rw-r--r-- | modules/extra/m_sqlite.cpp | 10 | ||||
-rw-r--r-- | modules/extra/stats/m_chanstats.cpp | 4 | ||||
-rw-r--r-- | src/siphash.cpp | 10 | ||||
-rw-r--r-- | src/socketengines/socketengine_epoll.cpp | 2 | ||||
-rw-r--r-- | src/sockets.cpp | 2 |
10 files changed, 23 insertions, 29 deletions
diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index c0c240ee8..33f7154fa 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -7,6 +7,7 @@ jobs: runs-on: ubuntu-20.04 env: CXX: ${{ matrix.compiler }} + CXXFLAGS: -Werror steps: - uses: actions/checkout@v2 - name: Install dependencies diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d02f3ea6..c2133e73b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -188,19 +188,10 @@ if(MSVC) # Otherwise, we're not using Visual Studio else() # Set the compile flags to have all warnings on (including shadowed variables) - set(CXXFLAGS "${CXXFLAGS} -Wall -Wshadow") - # If on a *nix system, also set the compile flags to remove GNU extensions (favor ISO C++) as well as reject non-ISO C++ code, also remove all leading underscores in exported symbols (only on GNU compiler) - if(UNIX) - set(CXXFLAGS "${CXXFLAGS} -pedantic ${CMAKE_CXX_FLAGS}") - if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - set(CXXFLAGS "${CXXFLAGS} -fno-leading-underscore") - endif() - # If we aren't on a *nix system, we are using MinGW - else() - # Also, if we are building under MinGW, add another define for MinGW - if(MINGW) - add_definitions(-DMINGW) - endif() + set(CXXFLAGS "${CXXFLAGS} -Wall -Wextra -Wpedantic -Wno-unused-parameter ${CMAKE_CXX_FLAGS}") + # Also, if we are building under MinGW, add another define for MinGW + if(MINGW) + add_definitions(-DMINGW) endif() endif() diff --git a/include/modules/httpd.h b/include/modules/httpd.h index d9ab85df7..c4c2c7d74 100644 --- a/include/modules/httpd.h +++ b/include/modules/httpd.h @@ -28,6 +28,7 @@ struct HTTPReply std::vector<cookie> cookies; HTTPReply() = default; + HTTPReply& operator=(const HTTPReply &) = default; HTTPReply(const HTTPReply& other) : error(other.error), length(other.length) { @@ -93,7 +94,7 @@ struct HTTPMessage class HTTPClient; class HTTPProvider; -class HTTPPage : public Base +class HTTPPage : public virtual Base { Anope::string url; Anope::string content_type; diff --git a/include/regchannel.h b/include/regchannel.h index bf14d82ae..9b05a2e62 100644 --- a/include/regchannel.h +++ b/include/regchannel.h @@ -93,6 +93,7 @@ class CoreExport ChannelInfo : public Serializable, public Extensible ChannelInfo(const ChannelInfo &ci); ~ChannelInfo(); + ChannelInfo& operator=(const ChannelInfo &) = default; void Serialize(Serialize::Data &data) const override; static Serializable* Unserialize(Serializable *obj, Serialize::Data &); diff --git a/modules/extra/m_mysql.cpp b/modules/extra/m_mysql.cpp index 3b4b0ea3f..96f346b53 100644 --- a/modules/extra/m_mysql.cpp +++ b/modules/extra/m_mysql.cpp @@ -151,7 +151,7 @@ class MySQLService : public Provider Anope::string BuildQuery(const Query &q); - Anope::string FromUnixtime(time_t); + Anope::string FromUnixtime(time_t) override; }; /** The SQL thread used to execute queries diff --git a/modules/extra/m_sqlite.cpp b/modules/extra/m_sqlite.cpp index 1a2bed1f1..ad74c435b 100644 --- a/modules/extra/m_sqlite.cpp +++ b/modules/extra/m_sqlite.cpp @@ -55,17 +55,17 @@ class SQLiteService : public Provider void Run(Interface *i, const Query &query) override; - Result RunQuery(const Query &query); + Result RunQuery(const Query &query) override; std::vector<Query> CreateTable(const Anope::string &table, const Data &data) override; - Query BuildInsert(const Anope::string &table, unsigned int id, Data &data); + Query BuildInsert(const Anope::string &table, unsigned int id, Data &data) override; - Query GetTables(const Anope::string &prefix); + Query GetTables(const Anope::string &prefix) override; Anope::string BuildQuery(const Query &q); - Anope::string FromUnixtime(time_t); + Anope::string FromUnixtime(time_t) override; }; class ModuleSQLite : public Module @@ -200,7 +200,7 @@ Result SQLiteService::RunQuery(const Query &query) if (err != SQLITE_DONE) return SQLiteResult(query, real_query, sqlite3_errmsg(this->sql)); - return result; + return std::move(result); } std::vector<Query> SQLiteService::CreateTable(const Anope::string &table, const Data &data) diff --git a/modules/extra/stats/m_chanstats.cpp b/modules/extra/stats/m_chanstats.cpp index 772ac4ff3..92f361f64 100644 --- a/modules/extra/stats/m_chanstats.cpp +++ b/modules/extra/stats/m_chanstats.cpp @@ -639,13 +639,13 @@ class MChanstats : public Module this->RunQuery(query); } - void OnChanRegistered(ChannelInfo *ci) + void OnChanRegistered(ChannelInfo *ci) override { if (CSDefChanstats) ci->Extend<bool>("CS_STATS"); } - void OnNickRegister(User *user, NickAlias *na, const Anope::string &) + void OnNickRegister(User *user, NickAlias *na, const Anope::string &) override { if (NSDefChanstats) na->nc->Extend<bool>("NS_STATS"); diff --git a/src/siphash.cpp b/src/siphash.cpp index 612b6eec7..9460f085b 100644 --- a/src/siphash.cpp +++ b/src/siphash.cpp @@ -120,12 +120,12 @@ uint64_t Anope::SipHash24(const void *src, unsigned long src_sz, const char key[ uint64_t t = 0; uint8_t *pt = (uint8_t *)&t; uint8_t *m = (uint8_t *)in; switch (src_sz) { - case 7: pt[6] = m[6]; - case 6: pt[5] = m[5]; - case 5: pt[4] = m[4]; + case 7: pt[6] = m[6]; [[fallthrough]]; + case 6: pt[5] = m[5]; [[fallthrough]]; + case 5: pt[4] = m[4]; [[fallthrough]]; case 4: *((uint32_t*)&pt[0]) = *((uint32_t*)&m[0]); break; - case 3: pt[2] = m[2]; - case 2: pt[1] = m[1]; + case 3: pt[2] = m[2]; [[fallthrough]]; + case 2: pt[1] = m[1]; [[fallthrough]]; case 1: pt[0] = m[0]; } b |= _le64toh(t); diff --git a/src/socketengines/socketengine_epoll.cpp b/src/socketengines/socketengine_epoll.cpp index 169c4b98a..851fea4e4 100644 --- a/src/socketengines/socketengine_epoll.cpp +++ b/src/socketengines/socketengine_epoll.cpp @@ -53,7 +53,7 @@ void SocketEngine::Change(Socket *s, bool set, SocketFlag flag) memset(&ev, 0, sizeof(ev)); - ev.events = (s->flags[SF_READABLE] ? EPOLLIN : 0) | (s->flags[SF_WRITABLE] ? EPOLLOUT : 0); + ev.events = (s->flags[SF_READABLE] ? EPOLLIN : 0u) | (s->flags[SF_WRITABLE] ? EPOLLOUT : 0u); ev.data.fd = s->GetFD(); int mod; diff --git a/src/sockets.cpp b/src/sockets.cpp index 37ba6e446..b05927691 100644 --- a/src/sockets.cpp +++ b/src/sockets.cpp @@ -306,7 +306,7 @@ bool cidr::match(const sockaddrs &other) byte = len % 8; if (byte) { - uint8_t m = ~0 << (8 - byte); + uint8_t m = ~0u << (8 - byte); return (*ip & m) == (*their_ip & m); } |