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

View File

@@ -135,11 +135,13 @@ CUser::~CUser() {
CZNC::Get().AddBytesWritten(m_uBytesWritten);
}
namespace {
template <class T>
struct TOption {
const char* name;
void (CUser::*pSetter)(T);
};
}
bool CUser::ParseConfig(CConfig* pConfig, CString& sError) {
TOption<const CString&> StringOptions[] = {