Fix an ODR violation

Building with CFLAGS="-flto -Werror=odr -Werror=lto-type-mismatch
-Werror=strict-aliasing" CXXFLAGS="-flto -Werror=odr
-Werror=lto-type-mismatch -Werror=strict-aliasing" LDFLAGS=-flto fails
due to a violation of the one definition rule. There are two different
definitions of TOption that are both linked into the znc binary.

Fix this by putting them into anonymous namespaces.

Fixes: https://github.com/znc/znc/issues/1834
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter
2022-08-05 16:12:40 +02:00
parent 82669e99b3
commit 3e45b2f35f
2 changed files with 4 additions and 0 deletions
+2
View File
@@ -363,11 +363,13 @@ CString CIRCNetwork::GetNetworkPath() const {
return sNetworkPath;
}
namespace {
template <class T>
struct TOption {
const char* name;
void (CIRCNetwork::*pSetter)(T);
};
}
bool CIRCNetwork::ParseConfig(CConfig* pConfig, CString& sError,
bool bUpgrade) {