1
0
mirror of https://github.com/anope/anope.git synced 2026-06-12 17:04:47 +02:00

Modernize CXXFLAGS on Unix and enable -Werror on CI.

Also clear up warnings that this exposed.
This commit is contained in:
Sadie Powell
2022-01-03 19:17:02 +00:00
parent a31a7f5a6c
commit eb81f22a5b
10 changed files with 23 additions and 29 deletions
+1
View File
@@ -7,6 +7,7 @@ jobs:
runs-on: ubuntu-20.04
env:
CXX: ${{ matrix.compiler }}
CXXFLAGS: -Werror
steps:
- uses: actions/checkout@v2
- name: Install dependencies
+4 -13
View File
@@ -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()
+2 -1
View File
@@ -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;
+1
View File
@@ -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 &);
+1 -1
View File
@@ -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
+5 -5
View File
@@ -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)
+2 -2
View File
@@ -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");
+5 -5
View File
@@ -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);
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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);
}