mirror of
https://github.com/nlohmann/json.git
synced 2026-07-09 12:05:10 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d4e024be11 | |||
| 4c5b2b0666 |
@@ -5,8 +5,11 @@
|
|||||||
# -Wno-extra-semi-stmt The library uses assert which triggers this warning.
|
# -Wno-extra-semi-stmt The library uses assert which triggers this warning.
|
||||||
# -Wno-padded We do not care about padding warnings.
|
# -Wno-padded We do not care about padding warnings.
|
||||||
# -Wno-covered-switch-default All switches list all cases and a default case.
|
# -Wno-covered-switch-default All switches list all cases and a default case.
|
||||||
# -Wno-unsafe-buffer-usage Otherwise Doctest would not compile.
|
# -Wno-unsafe-buffer-usage Pervasive: the library's own low-level numeric/buffer code
|
||||||
# -Wno-missing-noreturn We found no way to silence this warning otherwise, see PR #4871
|
# (to_chars, serializer, lexer, binary reader/writer, input
|
||||||
|
# adapters, json_pointer) plus vendored Doctest itself (~208
|
||||||
|
# distinct sites measured 2026-07-08 on clang trunk) all use
|
||||||
|
# raw pointer arithmetic / libc string calls by necessity.
|
||||||
|
|
||||||
set(CLANG_CXXFLAGS
|
set(CLANG_CXXFLAGS
|
||||||
-Werror
|
-Werror
|
||||||
@@ -18,5 +21,4 @@ set(CLANG_CXXFLAGS
|
|||||||
-Wno-padded
|
-Wno-padded
|
||||||
-Wno-covered-switch-default
|
-Wno-covered-switch-default
|
||||||
-Wno-unsafe-buffer-usage
|
-Wno-unsafe-buffer-usage
|
||||||
-Wno-missing-noreturn
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -430,7 +430,7 @@ class wide_string_input_adapter
|
|||||||
|
|
||||||
// parsing binary with wchar doesn't make sense, but since the parsing mode can be runtime, we need something here
|
// parsing binary with wchar doesn't make sense, but since the parsing mode can be runtime, we need something here
|
||||||
template<class T>
|
template<class T>
|
||||||
std::size_t get_elements(T* /*dest*/, std::size_t /*count*/ = 1)
|
JSON_HEDLEY_NO_RETURN std::size_t get_elements(T* /*dest*/, std::size_t /*count*/ = 1)
|
||||||
{
|
{
|
||||||
JSON_THROW(parse_error::create(112, 1, "wide string type cannot be interpreted as binary data", nullptr));
|
JSON_THROW(parse_error::create(112, 1, "wide string type cannot be interpreted as binary data", nullptr));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7262,7 +7262,7 @@ class wide_string_input_adapter
|
|||||||
|
|
||||||
// parsing binary with wchar doesn't make sense, but since the parsing mode can be runtime, we need something here
|
// parsing binary with wchar doesn't make sense, but since the parsing mode can be runtime, we need something here
|
||||||
template<class T>
|
template<class T>
|
||||||
std::size_t get_elements(T* /*dest*/, std::size_t /*count*/ = 1)
|
JSON_HEDLEY_NO_RETURN std::size_t get_elements(T* /*dest*/, std::size_t /*count*/ = 1)
|
||||||
{
|
{
|
||||||
JSON_THROW(parse_error::create(112, 1, "wide string type cannot be interpreted as binary data", nullptr));
|
JSON_THROW(parse_error::create(112, 1, "wide string type cannot be interpreted as binary data", nullptr));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,11 @@ target_compile_options(test_main PUBLIC
|
|||||||
# Disable warning C4566: character represented by universal-character-name '\uFF01'
|
# Disable warning C4566: character represented by universal-character-name '\uFF01'
|
||||||
# cannot be represented in the current code page (1252)
|
# cannot be represented in the current code page (1252)
|
||||||
# Disable warning C4996: 'nlohmann::basic_json<...>::operator <<': was declared deprecated
|
# Disable warning C4996: 'nlohmann::basic_json<...>::operator <<': was declared deprecated
|
||||||
$<$<CXX_COMPILER_ID:MSVC>:/W4;/wd4566;/wd4996;$<$<CONFIG:Release>:/wd4702>>
|
# Disable warning C4702: unreachable code; wide_string_input_adapter::get_elements()
|
||||||
|
# is annotated JSON_HEDLEY_NO_RETURN (it always throws), which
|
||||||
|
# makes MSVC flag the code following its call in binary_reader.hpp
|
||||||
|
# as unreachable for that instantiation, in both Debug and Release
|
||||||
|
$<$<CXX_COMPILER_ID:MSVC>:/W4;/wd4566;/wd4996;/wd4702>
|
||||||
# https://github.com/nlohmann/json/issues/1114
|
# https://github.com/nlohmann/json/issues/1114
|
||||||
$<$<CXX_COMPILER_ID:MSVC>:/bigobj> $<$<BOOL:${MINGW}>:-Wa,-mbig-obj>
|
$<$<CXX_COMPILER_ID:MSVC>:/bigobj> $<$<BOOL:${MINGW}>:-Wa,-mbig-obj>
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ struct bad_allocator : std::allocator<T>
|
|||||||
template<class U> bad_allocator(const bad_allocator<U>& /*unused*/) { }
|
template<class U> bad_allocator(const bad_allocator<U>& /*unused*/) { }
|
||||||
|
|
||||||
template<class... Args>
|
template<class... Args>
|
||||||
void construct(T* /*unused*/, Args&& ... /*unused*/) // NOLINT(cppcoreguidelines-missing-std-forward)
|
[[noreturn]] void construct(T* /*unused*/, Args&& ... /*unused*/) // NOLINT(cppcoreguidelines-missing-std-forward)
|
||||||
{
|
{
|
||||||
throw std::bad_alloc();
|
throw std::bad_alloc();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user