From 9fbc577be71910ae5e8a56c9c43a304d278aae73 Mon Sep 17 00:00:00 2001 From: Francisco Geiman Thiesen Date: Sun, 3 Aug 2025 18:48:07 +0000 Subject: [PATCH] Fix member initialization order warning in auto_parser MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The compiler was warning about member initialization order mismatch. C++ initializes members in the order they are declared in the class, not the order they appear in the initializer list. Fixed by reordering member declarations to match the initialization order needed: m_doc must be initialized before m_parser since we need to call parser.iterate() before moving the parser. This fixes the -Werror=reorder compilation error in CI. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- include/simdjson/convert.h | 8 ++++---- singleheader/simdjson.cpp | 2 +- singleheader/simdjson.h | 10 +++++----- singleheader/singleheader.zip | Bin 8089478 -> 8089478 bytes 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/simdjson/convert.h b/include/simdjson/convert.h index 37c1f4bbe..b01960da5 100644 --- a/include/simdjson/convert.h +++ b/include/simdjson/convert.h @@ -86,8 +86,8 @@ struct [[nodiscard]] auto_parser using const_iterator = auto_iterator; // auto_iterator is already const private: - ParserType m_parser; ondemand::document m_doc; + ParserType m_parser; // Caching the iterator here: iterator::auto_iterator_storage iter_storage{}; @@ -101,7 +101,7 @@ public: // non-pointer constructors: explicit auto_parser(ParserType &&parser, ondemand::document &&doc) noexcept requires(!std::is_pointer_v) - : m_parser{std::move(parser)}, m_doc{std::move(doc)} {} + : m_doc{std::move(doc)}, m_parser{std::move(parser)} {} explicit auto_parser(ParserType &&parser, padded_string_view const str) noexcept @@ -117,12 +117,12 @@ public: explicit auto_parser(std::remove_pointer_t &parser, ondemand::document &&doc) noexcept requires(std::is_pointer_v) - : m_parser{&parser}, m_doc{std::move(doc)} {} + : m_doc{std::move(doc)}, m_parser{&parser} {} explicit auto_parser(std::remove_pointer_t &parser, padded_string_view const str) noexcept requires(std::is_pointer_v) - : m_parser{&parser}, m_doc(parser.iterate(str)) {} + : m_doc(parser.iterate(str)), m_parser{&parser} {} explicit auto_parser(ParserType parser, ondemand::document &&doc) noexcept requires(std::is_pointer_v) diff --git a/singleheader/simdjson.cpp b/singleheader/simdjson.cpp index 19b5701d5..25ea0da3b 100644 --- a/singleheader/simdjson.cpp +++ b/singleheader/simdjson.cpp @@ -1,4 +1,4 @@ -/* auto-generated on 2025-08-03 18:12:50 +0000. Do not edit! */ +/* auto-generated on 2025-08-03 18:36:14 +0000. Do not edit! */ /* including simdjson.cpp: */ /* begin file simdjson.cpp */ #define SIMDJSON_SRC_SIMDJSON_CPP diff --git a/singleheader/simdjson.h b/singleheader/simdjson.h index d7a0e6eae..1d90229be 100644 --- a/singleheader/simdjson.h +++ b/singleheader/simdjson.h @@ -1,4 +1,4 @@ -/* auto-generated on 2025-08-03 18:12:50 +0000. Do not edit! */ +/* auto-generated on 2025-08-03 18:36:14 +0000. Do not edit! */ /* including simdjson.h: */ /* begin file simdjson.h */ #ifndef SIMDJSON_H @@ -135338,8 +135338,8 @@ struct [[nodiscard]] auto_parser using const_iterator = auto_iterator; // auto_iterator is already const private: - ParserType m_parser; ondemand::document m_doc; + ParserType m_parser; // Caching the iterator here: iterator::auto_iterator_storage iter_storage{}; @@ -135353,7 +135353,7 @@ public: // non-pointer constructors: explicit auto_parser(ParserType &&parser, ondemand::document &&doc) noexcept requires(!std::is_pointer_v) - : m_parser{std::move(parser)}, m_doc{std::move(doc)} {} + : m_doc{std::move(doc)}, m_parser{std::move(parser)} {} explicit auto_parser(ParserType &&parser, padded_string_view const str) noexcept @@ -135369,12 +135369,12 @@ public: explicit auto_parser(std::remove_pointer_t &parser, ondemand::document &&doc) noexcept requires(std::is_pointer_v) - : m_parser{&parser}, m_doc{std::move(doc)} {} + : m_doc{std::move(doc)}, m_parser{&parser} {} explicit auto_parser(std::remove_pointer_t &parser, padded_string_view const str) noexcept requires(std::is_pointer_v) - : m_parser{&parser}, m_doc(parser.iterate(str)) {} + : m_doc(parser.iterate(str)), m_parser{&parser} {} explicit auto_parser(ParserType parser, ondemand::document &&doc) noexcept requires(std::is_pointer_v) diff --git a/singleheader/singleheader.zip b/singleheader/singleheader.zip index 6c7981d2700c0cdf4cae8a2e9b3758c29089d607..93e47f70e4d473f220ef9e798b355eb4fd4ebd0f 100644 GIT binary patch delta 683 zcmYk)OHY$Q6vlC(1&X5ROVN5kU!|fTB9~fiQBm*;s6{Tlp@2~D*jhx3vpFsfE)5Ga zehrPLTNC$w1#RL|UAy$(lBkpX7L$1B!ikM|y#5X4^ZSh_J^$&;hc&0a zrY{`r3E4s^*!5CWs#K~~JStw58kJg=Iu)Nvy~;+FO)3p4n^m@`G^%V>*{0&CG^zMi znpL)|>`)1)>{QvMvRh@3N{h-~m3=C%%6^ptDy<(S`2L%(Tw|=ZqrpZ?!N_`%R}{fP zwBZmAqa7VMf=(Po7mlGDJ?KRrLO6~vPT(XWh@u~-a2jVYfU`J%AF@-o1NFs$arg0OuFoRjl;Wp;6fDG>7F7Dwz9^fG!VG)m! zMGjAp#}b}m8PD(>1*{Ycr5CT4?dP`(j_r;cU$g7R=JHFK{KQHw<1WtRDwkq7Zq};o z_k?M(-js>hM8f!OAZ-H0futF(uDm#%fAgko{hxJHrp5kBnL$e~WM|W+-Tp|L*1G=# Y#dp&t=~Sj(UOww&P4B-Q7|ojKAJu0%tpET3 delta 696 zcmZwF%TAL~6oz4-fb|Ic7AS%WQV|rfR6r>ziYEjFJoW?@qyciye9|_ zqX|dQj20ZlF|^`1+HeAXv?G9%=s+jBa0;i7{)M;dx&EKlemv5BruH!c!)=Mj3;=CXPCir zBr%H@NMQ~yF^^YxjWph5(%H8k=51rhRN5b(6Q0ugnRp^OmFWtZl|uU~Y--%C`H`{y zaZ_cRqilx5#$&xP||