Skip to content

Commit b3f626d

Browse files
Only add the reserves
1 parent 6624f62 commit b3f626d

3 files changed

Lines changed: 2 additions & 6 deletions

File tree

docs/supported_formats/cereal.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ Furthermore, when compiling reflect-cpp, you need to pass `-DREFLECTCPP_CEREAL=O
55

66
Cereal is a C++ serialization library that provides multiple archive formats including binary, portable binary, JSON, and XML formats, even though we use the portable binary format.
77

8-
Note that on some versions of GCC, it is necessary to compile with `-Wno-stringop-overflow`, because of false positive warnings due to a known compiler bug, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110498.
9-
108
## Reading and writing
119

1210
Suppose you have a struct like this:

include/rfl/parsing/NamedTupleParser.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ struct NamedTupleParser {
306306
auto set = std::array<bool, NamedTupleType::size()>();
307307
set.fill(false);
308308
std::vector<std::string> errors;
309+
errors.reserve(size_);
309310
const auto reader = ViewReaderType(&_r, _view, &found, &set, &errors);
310311
if constexpr (_no_field_names) {
311312
const auto err = _r.read_array(reader, _obj_or_arr);
@@ -330,6 +331,7 @@ struct NamedTupleParser {
330331
const R& _r, const InputObjectOrArrayType& _obj_or_arr,
331332
NamedTupleType* _view) noexcept {
332333
std::vector<std::string> errors;
334+
errors.reserve(size_);
333335
const auto reader = ViewReaderWithDefaultType(&_r, _view, &errors);
334336
if constexpr (_no_field_names) {
335337
const auto err = _r.read_array(reader, _obj_or_arr);

tests/cereal/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ add_executable(
88
)
99
target_precompile_headers(reflect-cpp-cereal-tests PRIVATE [["rfl.hpp"]] <iostream> <string> <functional> <gtest/gtest.h>)
1010

11-
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
12-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-overflow")
13-
endif()
14-
1511
target_link_libraries(reflect-cpp-cereal-tests PRIVATE reflectcpp_tests_crt)
1612

1713
add_custom_command(TARGET reflect-cpp-cereal-tests POST_BUILD

0 commit comments

Comments
 (0)