Skip to content

Commit 5fc253a

Browse files
committed
Suppress a whole lot of EnumTraits warnings
1 parent 18baf86 commit 5fc253a

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/Etterna/Models/Misc/EnumHelper.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,28 @@ EnumToString(int iVal,
106106
} \
107107
}
108108

109+
/* Disable errors about instantiations of static member variables of the
110+
* templated class not being defined. These are all defined in different
111+
* translation units by LuaXType, a macro that does a whole lot of stuff
112+
* including initializing them.
113+
*
114+
* Because it happens in a different translation unit, there's not really a
115+
* great way to do this better. You could state that external instantiations
116+
* happen elsewhere with a `extern template struct EnumTraits<T>;` for every T,
117+
* but the issue is that this header file doesn't know about the existence of
118+
* those classes.
119+
*/
120+
121+
#if defined(__clang__)
122+
#pragma clang diagnostic push
123+
#pragma clang diagnostic ignored "-Wundefined-var-template"
124+
#elif defined(__GNUC__)
125+
#pragma GCC diagnostic push
126+
#pragma GCC diagnostic ignored "-Wundefined-var-template"
127+
#elif defined(_MSC_VER)
128+
// TODO: Does anything need to be here?
129+
#endif
130+
109131
namespace Enum {
110132
template<typename T>
111133
static auto
@@ -122,6 +144,14 @@ Check(lua_State* L,
122144
bAllowInvalid,
123145
bAllowAnything));
124146
}
147+
#if defined(__clang__)
148+
#pragma clang pop
149+
#elif defined(__GNUC__)
150+
#pragma GCC pop
151+
#elif defined(_MSC_VER)
152+
153+
#endif
154+
125155
template<typename T>
126156
static void
127157
Push(lua_State* L, T iVal)

0 commit comments

Comments
 (0)