From 1dcca917284acd9239dc6754272a0715705dbbab Mon Sep 17 00:00:00 2001 From: Abhijat Malviya Date: Thu, 8 Jan 2026 20:35:41 +0530 Subject: [PATCH 1/2] ignore warnings for gcc for specific code path Signed-off-by: Abhijat Malviya --- include/jsoncons/utility/bigint.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/jsoncons/utility/bigint.hpp b/include/jsoncons/utility/bigint.hpp index d670712b2d..9ff8bb09a5 100644 --- a/include/jsoncons/utility/bigint.hpp +++ b/include/jsoncons/utility/bigint.hpp @@ -287,6 +287,11 @@ class bigint_storage : private std::allocator_traits:: template rebin ::new (&inlined_) inlined_storage(); } +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif + bigint_storage(const bigint_storage& other) : word_allocator_type(other.get_allocator()) { @@ -300,6 +305,10 @@ class bigint_storage : private std::allocator_traits:: template rebin } } +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic pop +#endif + bigint_storage(const bigint_storage& other, const Allocator& alloc) : word_allocator_type(alloc) { From ad25b55154f73bcd0c2cb08765a659975fe55c6a Mon Sep 17 00:00:00 2001 From: Abhijat Malviya Date: Fri, 9 Jan 2026 16:03:10 +0530 Subject: [PATCH 2/2] unify indent char handling There is a new indent_char() api in jsoncons, but it is a subset of the already present indent_chars() api. the indent_char_ state is removed, and to preserve compatibilty with test code etc, the setter is preserved to set the char into the underlying string. Signed-off-by: Abhijat Malviya --- include/jsoncons/json_encoder.hpp | 20 ++------------------ include/jsoncons/json_options.hpp | 15 ++++----------- 2 files changed, 6 insertions(+), 29 deletions(-) diff --git a/include/jsoncons/json_encoder.hpp b/include/jsoncons/json_encoder.hpp index da688041c1..f83a7d04d9 100644 --- a/include/jsoncons/json_encoder.hpp +++ b/include/jsoncons/json_encoder.hpp @@ -329,7 +329,6 @@ namespace detail { Sink sink_; basic_json_encode_options options_; - char_type indent_char_{' '}; jsoncons::write_double fp_; std::vector stack_; @@ -359,7 +358,6 @@ namespace detail { const Allocator& alloc = Allocator()) : sink_(std::forward(sink)), options_(options), - indent_char_(options.indent_char()), fp_(options.float_format(), options.precision()), stack_(alloc) { @@ -1084,14 +1082,7 @@ namespace detail { sink_.append(options_.new_line_chars().data(),options_.new_line_chars().length()); for (int i = 0; i < indent_amount_; ++i) { - if (options_.indent_chars().empty()) - { - sink_.push_back(indent_char_); - } - else - { - sink_.append(options_.indent_chars().data(), options_.indent_chars().length()); - } + sink_.append(options_.indent_chars().data(), options_.indent_chars().length()); } column_ = indent_amount_ * options_.new_line_chars().length(); } @@ -1101,14 +1092,7 @@ namespace detail { sink_.append(options_.new_line_chars().data(),options_.new_line_chars().length()); for (std::size_t i = 0; i < len; ++i) { - if (options_.indent_chars().empty()) - { - sink_.push_back(indent_char_); - } - else - { - sink_.append(options_.indent_chars().data(), options_.indent_chars().length()); - } + sink_.append(options_.indent_chars().data(), options_.indent_chars().length()); } column_ = len; } diff --git a/include/jsoncons/json_options.hpp b/include/jsoncons/json_options.hpp index 523514a3d2..44d70f9d9d 100644 --- a/include/jsoncons/json_options.hpp +++ b/include/jsoncons/json_options.hpp @@ -339,7 +339,6 @@ class basic_json_encode_options : public virtual basic_json_options_common, basic_json_options& indent_char(char_type value) { - this->indent_char_ = value; + this->indent_chars_ = value; return *this; }