Skip to content

Commit 097a5c0

Browse files
nlohmannslowriot
authored andcommitted
Suppress warnings in NLOHMANN_JSON_SERIALIZE_ENUM (nlohmann#4497)
1 parent 9d361ab commit 097a5c0

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

include/nlohmann/detail/macro_scope.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,9 @@
216216
template<typename BasicJsonType> \
217217
inline void to_json(BasicJsonType& j, const ENUM_TYPE& e) \
218218
{ \
219+
/* NOLINTNEXTLINE(modernize-type-traits) we use C++11 */ \
219220
static_assert(std::is_enum<ENUM_TYPE>::value, #ENUM_TYPE " must be an enum!"); \
221+
/* NOLINTNEXTLINE(modernize-avoid-c-arrays) we don't want to depend on <array> */ \
220222
static const std::pair<ENUM_TYPE, BasicJsonType> m[] = __VA_ARGS__; \
221223
auto it = std::find_if(std::begin(m), std::end(m), \
222224
[e](const std::pair<ENUM_TYPE, BasicJsonType>& ej_pair) -> bool \
@@ -228,7 +230,9 @@
228230
template<typename BasicJsonType> \
229231
inline void from_json(const BasicJsonType& j, ENUM_TYPE& e) \
230232
{ \
233+
/* NOLINTNEXTLINE(modernize-type-traits) we use C++11 */ \
231234
static_assert(std::is_enum<ENUM_TYPE>::value, #ENUM_TYPE " must be an enum!"); \
235+
/* NOLINTNEXTLINE(modernize-avoid-c-arrays) we don't want to depend on <array> */ \
232236
static const std::pair<ENUM_TYPE, BasicJsonType> m[] = __VA_ARGS__; \
233237
auto it = std::find_if(std::begin(m), std::end(m), \
234238
[&j](const std::pair<ENUM_TYPE, BasicJsonType>& ej_pair) -> bool \

single_include/nlohmann/json.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2572,7 +2572,9 @@ JSON_HEDLEY_DIAGNOSTIC_POP
25722572
template<typename BasicJsonType> \
25732573
inline void to_json(BasicJsonType& j, const ENUM_TYPE& e) \
25742574
{ \
2575+
/* NOLINTNEXTLINE(modernize-type-traits) we use C++11 */ \
25752576
static_assert(std::is_enum<ENUM_TYPE>::value, #ENUM_TYPE " must be an enum!"); \
2577+
/* NOLINTNEXTLINE(modernize-avoid-c-arrays) we don't want to depend on <array> */ \
25762578
static const std::pair<ENUM_TYPE, BasicJsonType> m[] = __VA_ARGS__; \
25772579
auto it = std::find_if(std::begin(m), std::end(m), \
25782580
[e](const std::pair<ENUM_TYPE, BasicJsonType>& ej_pair) -> bool \
@@ -2584,7 +2586,9 @@ JSON_HEDLEY_DIAGNOSTIC_POP
25842586
template<typename BasicJsonType> \
25852587
inline void from_json(const BasicJsonType& j, ENUM_TYPE& e) \
25862588
{ \
2589+
/* NOLINTNEXTLINE(modernize-type-traits) we use C++11 */ \
25872590
static_assert(std::is_enum<ENUM_TYPE>::value, #ENUM_TYPE " must be an enum!"); \
2591+
/* NOLINTNEXTLINE(modernize-avoid-c-arrays) we don't want to depend on <array> */ \
25882592
static const std::pair<ENUM_TYPE, BasicJsonType> m[] = __VA_ARGS__; \
25892593
auto it = std::find_if(std::begin(m), std::end(m), \
25902594
[&j](const std::pair<ENUM_TYPE, BasicJsonType>& ej_pair) -> bool \

0 commit comments

Comments
 (0)