danielaparker / jsoncons

A C++, header-only library for constructing JSON and JSON-like data formats, with JSON Pointer, JSON Patch, JSON Schema, JSONPath, JMESPath, CSV, MessagePack, CBOR, BSON, UBJSON
https://danielaparker.github.io/jsoncons
Other
680 stars 159 forks source link

Build error: `error: no matching function for call to 'FreeListAllocator<char>::FreeListAllocator()'` #488

Open barracuda156 opened 5 months ago

barracuda156 commented 5 months ago

Describe the bug

Build fails with GCC:

:info:build [  6%] Building CXX object test/CMakeFiles/unit_tests.dir/cbor/src/cbor_bitset_traits_tests.cpp.o
:info:build cd /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/build/test && /opt/local/bin/g++-mp-13  -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/test -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/third_party -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/third_party/catch -pipe -Os -DNDEBUG -I/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -mmacosx-version-min=10.6 -Wnon-virtual-dtor -Werror=stringop-overflow -Werror -Wall -Wextra -Wcast-align -Wcast-qual -Wimplicit-fallthrough -Wsign-compare -pedantic -Wnonnull -Werror=nonnull -MD -MT test/CMakeFiles/unit_tests.dir/cbor/src/cbor_bitset_traits_tests.cpp.o -MF CMakeFiles/unit_tests.dir/cbor/src/cbor_bitset_traits_tests.cpp.o.d -o CMakeFiles/unit_tests.dir/cbor/src/cbor_bitset_traits_tests.cpp.o -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/test/cbor/src/cbor_bitset_traits_tests.cpp
:info:build In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/test/bson/src/encode_decode_bson_tests.cpp:7:
:info:build /opt/local/include/gcc13/c++/scoped_allocator: In instantiation of 'std::scoped_allocator_adaptor<_OuterAlloc, _InnerAllocs>::scoped_allocator_adaptor() [with _OuterAlloc = FreeListAllocator<char>; _InnerAllocs = {}]':
:info:build /opt/local/include/gcc13/c++/bits/cow_string.h:3179:30:   required from 'static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct(size_type, _CharT, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::scoped_allocator_adaptor<FreeListAllocator<char> >; size_type = long unsigned int]'
:info:build /opt/local/include/gcc13/c++/bits/cow_string.h:537:33:   required from 'std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::scoped_allocator_adaptor<FreeListAllocator<char> >]'
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/bson/bson_parser.hpp:76:10:   required from 'jsoncons::bson::basic_bson_parser<Source, TempAllocator>::basic_bson_parser(Sourceable&&, const jsoncons::bson::bson_decode_options&, const TempAllocator&) [with Sourceable = const std::vector<unsigned char>&; Source = jsoncons::bytes_source; TempAllocator = std::scoped_allocator_adaptor<FreeListAllocator<char> >]'
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/bson/bson_reader.hpp:46:10:   required from 'jsoncons::bson::basic_bson_reader<Source, TempAllocator>::basic_bson_reader(Sourceable&&, jsoncons::json_visitor&, const jsoncons::bson::bson_decode_options&, const TempAllocator&) [with Sourceable = const std::vector<unsigned char>&; Source = jsoncons::bytes_source; TempAllocator = std::scoped_allocator_adaptor<FreeListAllocator<char> >; jsoncons::json_visitor = jsoncons::basic_json_visitor<char>]'
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/bson/decode_bson.hpp:136:65:   required from 'typename std::enable_if<(jsoncons::extension_traits::is_basic_json<Json>::value && jsoncons::extension_traits::is_byte_sequence<Source>::value), T>::type jsoncons::bson::decode_bson(const jsoncons::allocator_set<Allocator, TempAllocator>&, const Source&, const bson_decode_options&) [with T = jsoncons::basic_json<char, jsoncons::order_preserving_policy, std::allocator<char> >; Source = std::vector<unsigned char>; Allocator = std::allocator<char>; TempAllocator = std::scoped_allocator_adaptor<FreeListAllocator<char> >; typename std::enable_if<(jsoncons::extension_traits::is_basic_json<Json>::value && jsoncons::extension_traits::is_byte_sequence<Source>::value), T>::type = jsoncons::basic_json<char, jsoncons::order_preserving_policy, std::allocator<char> >]'
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/test/bson/src/encode_decode_bson_tests.cpp:211:42:   required from here
:info:build /opt/local/include/gcc13/c++/scoped_allocator:306:60: error: no matching function for call to 'FreeListAllocator<char>::FreeListAllocator()'
:info:build   306 |       scoped_allocator_adaptor() : _OuterAlloc(), _M_inner() { }
:info:build       |                                                            ^
:info:build In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/test/bson/src/encode_decode_bson_tests.cpp:6:
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/test/common/FreeListAllocator.hpp:44:5: note: candidate: 'template<class U> FreeListAllocator<T>::FreeListAllocator(const FreeListAllocator<U>&) [with T = char]'
:info:build    44 |     FreeListAllocator(const FreeListAllocator<U>&) noexcept {}
:info:build       |     ^~~~~~~~~~~~~~~~~
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/test/common/FreeListAllocator.hpp:44:5: note:   template argument deduction/substitution failed:
:info:build /opt/local/include/gcc13/c++/scoped_allocator:306:60: note:   candidate expects 1 argument, 0 provided
:info:build   306 |       scoped_allocator_adaptor() : _OuterAlloc(), _M_inner() { }
:info:build       |                                                            ^
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/test/common/FreeListAllocator.hpp:45:5: note: candidate: 'FreeListAllocator<T>::FreeListAllocator(FreeListAllocator<T>&&) [with T = char]'
:info:build    45 |     FreeListAllocator(FreeListAllocator&& other) noexcept :  list(other.list) {
:info:build       |     ^~~~~~~~~~~~~~~~~
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/test/common/FreeListAllocator.hpp:45:5: note:   candidate expects 1 argument, 0 provided
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/test/common/FreeListAllocator.hpp:42:5: note: candidate: 'FreeListAllocator<T>::FreeListAllocator(const FreeListAllocator<T>&) [with T = char]'
:info:build    42 |     FreeListAllocator(const FreeListAllocator&) noexcept {}
:info:build       |     ^~~~~~~~~~~~~~~~~
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/test/common/FreeListAllocator.hpp:42:5: note:   candidate expects 1 argument, 0 provided
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/test/common/FreeListAllocator.hpp:40:5: note: candidate: 'FreeListAllocator<T>::FreeListAllocator(int) [with T = char]'
:info:build    40 |     FreeListAllocator(int) noexcept
:info:build       |     ^~~~~~~~~~~~~~~~~
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/test/common/FreeListAllocator.hpp:40:5: note:   candidate expects 1 argument, 0 provided
:info:build [  7%] Building CXX object test/CMakeFiles/unit_tests.dir/cbor/src/cbor_cursor_tests.cpp.o
:info:build cd /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/build/test && /opt/local/bin/g++-mp-13  -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/test -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/third_party -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/third_party/catch -pipe -Os -DNDEBUG -I/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -mmacosx-version-min=10.6 -Wnon-virtual-dtor -Werror=stringop-overflow -Werror -Wall -Wextra -Wcast-align -Wcast-qual -Wimplicit-fallthrough -Wsign-compare -pedantic -Wnonnull -Werror=nonnull -MD -MT test/CMakeFiles/unit_tests.dir/cbor/src/cbor_cursor_tests.cpp.o -MF CMakeFiles/unit_tests.dir/cbor/src/cbor_cursor_tests.cpp.o.d -o CMakeFiles/unit_tests.dir/cbor/src/cbor_cursor_tests.cpp.o -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/test/cbor/src/cbor_cursor_tests.cpp
:info:build make[2]: *** [test/CMakeFiles/unit_tests.dir/bson/src/encode_decode_bson_tests.cpp.o] Error 1

Enumerate the steps to reproduce the bug

sudo port -v build jsoncons

What compiler, architecture, and operating system?

What jsoncons library version?

P. S. There is another error, but it is due to -Werror being the default, i.e. avoidable. Looks like due to bitness:

:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/cbor/cbor_encoder.hpp: In instantiation of 'bool jsoncons::cbor::basic_cbor_encoder<Sink, Allocator>::visit_begin_object(std::size_t, jsoncons::semantic_tag, const jsoncons::ser_context&, std::error_code&) [with Sink = jsoncons::bytes_sink<std::basic_string<char>, void>; Allocator = std::allocator<char>; std::size_t = long unsigned int]':
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/cbor/cbor_encoder.hpp:173:10:   required from here
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/cbor/cbor_encoder.hpp:208:25: error: comparison is always true due to limited range of data type [-Werror=type-limits]
:info:build   208 |         else if (length <= 0xffffffffffffffff)
:info:build       |                  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/cbor/cbor_encoder.hpp: In instantiation of 'bool jsoncons::cbor::basic_cbor_encoder<Sink, Allocator>::visit_begin_array(std::size_t, jsoncons::semantic_tag, const jsoncons::ser_context&, std::error_code&) [with Sink = jsoncons::bytes_sink<std::basic_string<char>, void>; Allocator = std::allocator<char>; std::size_t = long unsigned int]':
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/cbor/cbor_encoder.hpp:260:10:   required from here
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/cbor/cbor_encoder.hpp:294:25: error: comparison is always true due to limited range of data type [-Werror=type-limits]
:info:build   294 |         else if (length <= 0xffffffffffffffff)
:info:build       |                  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/cbor/cbor_encoder.hpp: In instantiation of 'void jsoncons::cbor::basic_cbor_encoder<Sink, Allocator>::write_bignum(jsoncons::bigint&) [with Sink = jsoncons::bytes_sink<std::basic_string<char>, void>; Allocator = std::allocator<char>; jsoncons::bigint = jsoncons::basic_bigint<std::allocator<unsigned char> >]':
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/cbor/cbor_encoder.hpp:818:17:   required from 'bool jsoncons::cbor::basic_cbor_encoder<Sink, Allocator>::visit_string(const jsoncons::basic_json_visitor<char>::string_view_type&, jsoncons::semantic_tag, const jsoncons::ser_context&, std::error_code&) [with Sink = jsoncons::bytes_sink<std::basic_string<char>, void>; Allocator = std::allocator<char>; jsoncons::basic_json_visitor<char>::string_view_type = std::basic_string_view<char>]'
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/cbor/cbor_encoder.hpp:811:10:   required from here
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/cbor/cbor_encoder.hpp:477:25: error: comparison is always true due to limited range of data type [-Werror=type-limits]
:info:build   477 |         else if (length <= 0xffffffffffffffff)
:info:build       |                  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/cbor/cbor_encoder.hpp: In instantiation of 'void jsoncons::cbor::basic_cbor_encoder<Sink, Allocator>::write_utf8_string(const std::string_view&) [with Sink = jsoncons::bytes_sink<std::basic_string<char>, void>; Allocator = std::allocator<char>; std::string_view = std::basic_string_view<char>]':
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/cbor/cbor_encoder.hpp:369:17:   required from 'void jsoncons::cbor::basic_cbor_encoder<Sink, Allocator>::write_string(const std::string_view&) [with Sink = jsoncons::bytes_sink<std::basic_string<char>, void>; Allocator = std::allocator<char>; std::string_view = std::basic_string_view<char>]'
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/cbor/cbor_encoder.hpp:335:9:   required from 'bool jsoncons::cbor::basic_cbor_encoder<Sink, Allocator>::visit_key(const jsoncons::basic_json_visitor<char>::string_view_type&, const jsoncons::ser_context&, std::error_code&) [with Sink = jsoncons::bytes_sink<std::basic_string<char>, void>; Allocator = std::allocator<char>; jsoncons::basic_json_visitor<char>::string_view_type = std::basic_string_view<char>]'
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/cbor/cbor_encoder.hpp:333:10:   required from here
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/cbor/cbor_encoder.hpp:414:25: error: comparison is always true due to limited range of data type [-Werror=type-limits]
:info:build   414 |         else if (length <= 0xffffffffffffffff)
:info:build       |                  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
:info:build In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/cbor/cbor_reader.hpp:17,
:info:build                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/cbor/cbor.hpp:19,
:info:build                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/test/cbor/src/cbor_cursor_tests.cpp:10:
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/cbor/cbor_encoder.hpp: In instantiation of 'bool jsoncons::cbor::basic_cbor_encoder<Sink, Allocator>::visit_begin_object(std::size_t, jsoncons::semantic_tag, const jsoncons::ser_context&, std::error_code&) [with Sink = jsoncons::bytes_sink<std::vector<unsigned char> >; Allocator = std::allocator<char>; std::size_t = long unsigned int]':
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/cbor/cbor_encoder.hpp:173:10:   required from here
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/cbor/cbor_encoder.hpp:208:25: error: comparison is always true due to limited range of data type [-Werror=type-limits]
:info:build   208 |         else if (length <= 0xffffffffffffffff)
:info:build       |                  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/cbor/cbor_encoder.hpp: In instantiation of 'bool jsoncons::cbor::basic_cbor_encoder<Sink, Allocator>::visit_begin_array(std::size_t, jsoncons::semantic_tag, const jsoncons::ser_context&, std::error_code&) [with Sink = jsoncons::bytes_sink<std::vector<unsigned char> >; Allocator = std::allocator<char>; std::size_t = long unsigned int]':
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/cbor/cbor_encoder.hpp:260:10:   required from here
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/cbor/cbor_encoder.hpp:294:25: error: comparison is always true due to limited range of data type [-Werror=type-limits]
:info:build   294 |         else if (length <= 0xffffffffffffffff)
:info:build       |                  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/cbor/cbor_encoder.hpp: In instantiation of 'void jsoncons::cbor::basic_cbor_encoder<Sink, Allocator>::write_bignum(jsoncons::bigint&) [with Sink = jsoncons::bytes_sink<std::vector<unsigned char> >; Allocator = std::allocator<char>; jsoncons::bigint = jsoncons::basic_bigint<std::allocator<unsigned char> >]':
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/cbor/cbor_encoder.hpp:818:17:   required from 'bool jsoncons::cbor::basic_cbor_encoder<Sink, Allocator>::visit_string(const jsoncons::basic_json_visitor<char>::string_view_type&, jsoncons::semantic_tag, const jsoncons::ser_context&, std::error_code&) [with Sink = jsoncons::bytes_sink<std::vector<unsigned char> >; Allocator = std::allocator<char>; jsoncons::basic_json_visitor<char>::string_view_type = std::basic_string_view<char>]'
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/cbor/cbor_encoder.hpp:811:10:   required from here
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/cbor/cbor_encoder.hpp:477:25: error: comparison is always true due to limited range of data type [-Werror=type-limits]
:info:build   477 |         else if (length <= 0xffffffffffffffff)
:info:build       |                  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/cbor/cbor_encoder.hpp: In instantiation of 'void jsoncons::cbor::basic_cbor_encoder<Sink, Allocator>::write_utf8_string(const std::string_view&) [with Sink = jsoncons::bytes_sink<std::vector<unsigned char> >; Allocator = std::allocator<char>; std::string_view = std::basic_string_view<char>]':
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/cbor/cbor_encoder.hpp:369:17:   required from 'void jsoncons::cbor::basic_cbor_encoder<Sink, Allocator>::write_string(const std::string_view&) [with Sink = jsoncons::bytes_sink<std::vector<unsigned char> >; Allocator = std::allocator<char>; std::string_view = std::basic_string_view<char>]'
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/cbor/cbor_encoder.hpp:335:9:   required from 'bool jsoncons::cbor::basic_cbor_encoder<Sink, Allocator>::visit_key(const jsoncons::basic_json_visitor<char>::string_view_type&, const jsoncons::ser_context&, std::error_code&) [with Sink = jsoncons::bytes_sink<std::vector<unsigned char> >; Allocator = std::allocator<char>; jsoncons::basic_json_visitor<char>::string_view_type = std::basic_string_view<char>]'
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/cbor/cbor_encoder.hpp:333:10:   required from here
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/include/jsoncons_ext/cbor/cbor_encoder.hpp:414:25: error: comparison is always true due to limited range of data type [-Werror=type-limits]
:info:build   414 |         else if (length <= 0xffffffffffffffff)
:info:build       |                  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
:info:build cc1plus: all warnings being treated as errors
:info:build make[2]: *** [test/CMakeFiles/unit_tests.dir/cbor/src/cbor_bitset_traits_tests.cpp.o] Error 1
:info:build cc1plus: all warnings being treated as errors
:info:build make[2]: *** [test/CMakeFiles/unit_tests.dir/cbor/src/cbor_cursor_tests.cpp.o] Error 1
:info:build make[2]: Leaving directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/build'
:info:build make[1]: *** [test/CMakeFiles/unit_tests.dir/all] Error 2
:info:build make[1]: Leaving directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/build'
:info:build make: *** [all] Error 2
danielaparker commented 5 months ago

This seems related to #440. I was never able to replicate it, but from your output it looks like your gcc is configured to use the old COW string rather than the C++11 conforming string. My understanding is that the old COW string doesn't work with stateful allocators, and will fail to compile with stateful allocators that don't have a default constructor. It should be possible to use the jsoncons library with the old COW strings but without stateful allocators, though.

For the second issue, could you confirm for me what is the maximum value of std::size_t with your compiler, i.e.

std::numeric_limits<std::size_t>::max() 
barracuda156 commented 5 months ago

@danielaparker Thank you for responding!

I am pretty sure we do not configure GCC specifically to achieve such a result, but Macports will pass -D_GLIBCXX_USE_CXX11_ABI=0 on a number of older systems for the sake of compatibility. Does this macro control cowstring choice? If it is still something inside GCC itself, macOS-specific setting are in gcc/config/darwin.h, maybe something there sets it. Wonder why Ubuntu on x86_64 was getting a similar error though.

P. S. I will check numeric limits once I am back to some PowerPC machine and update on that.

danielaparker commented 5 months ago

@barracuda156 My understanding is that _GLIBCXX_USE_CXX11_ABI=0 causes the old ABI to be used, which includes COW strings, see Dual ABI

barracuda156 commented 5 months ago

@danielaparker I had an impression that both ABI are functionally identical, just syntax differs. Is it not the case in reality?

P. S. While I never tested that, but presumably it could be possible to use the new ABI on any old systems, including PowerPC ones, but everything will have to be rebuilt with the C++11-capable GCC against the new libstdc++ (not the system one). I think this shall work, the only issue is that I won’t be able to push such radical change into Macports. (It may also break some stuff like Qt4.)

danielaparker commented 5 months ago

There are definitely issues with cow strings, I'll quote from a ycombinator post,

"In the early days of std::string multi-threading was much rarer, so reference counting was cheaper. As CPU count grows the relative cost of needing an atomic refcount on every string also grew.

The COW strings also were a constant source of surprising behavior. As with any COW object you have to make sure that the copy happens before the write. Simple enough, but the STL-style interface does not support this well. All you had to do is call operator[] or begin() on a non-const std::string and it would force a copy.

This meant that something that to the programmer clearly looked like a read-only operation like:

    if (str[2] == 'x') { ...}

...could end up copying the string. Worse, it also meant that any previously taken references are now invalidated. This lead to horrible bugs where you would hold a pointer at the previous copy of the string (which you no longer own a refcount on) and it would almost always work... but every so often another thread would come by and reuse the memory behind your back. So COW std::string was a long festering mess in C++. Their removal in C++11 was completely warranted."

Of course there are also issues with not maintaining backwards compatibility with existing code compiled under the old ABI :-)

barracuda156 commented 4 months ago

For the second issue, could you confirm for me what is the maximum value of std::size_t with your compiler, i.e.

@danielaparker Does this look reasonable?

size_t: 4294967295 or 0xffffffff
barracuda156 commented 4 months ago

I removed tests which were broken, and the remaining ones seem to pass, though there is a malloc error in one spot:

Start testing: Feb 20 09:26 CST
----------------------------------------------------------
1/1 Testing: unit_tests
1/1 Test: unit_tests
Command: "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/build/test/unit_tests"
Directory: /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.173.4/test
"unit_tests" start time: Feb 20 09:26 CST
Output:
----------------------------------------------------------
{"a":"1E-6176"}
n/a
bstr: d8,28,82,82,02,03,86,02,04,08,04,10,19,01,00

216 40 130 130 2 3 134 2 4 8 4 16 25 1 0 

[
    [2, 3], 
    [2, 4, 8, 4, 16, 256]
]unit_tests(51977) malloc: *** mmap(size=1073745920) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug

std::bad_alloc
Unknown type
{
    "name": ["Seattle", "New York", "Bellevue", "Olympia"], 
    "state": ["WA", "NY", "WA", "WA"]
}

$['store']['book'][1]['title']
$['store']['book'][2]['title']
Test ./jsonpath/input/test_data/regex.json
Test ./jsonpath/input/test_data/identifiers.json
Test ./jsonpath/input/test_data/dot-notation.json
Test ./jsonpath/input/test_data/indices.json
Test ./jsonpath/input/test_data/wildcard.json
Test ./jsonpath/input/test_data/recursive-descent.json
Test ./jsonpath/input/test_data/union.json
Test ./jsonpath/input/test_data/filters.json
Test ./jsonpath/input/test_data/functions.json
Test ./jsonpath/input/test_data/expressions.json
Test ./jsonpath/input/test_data/syntax.json
Test ./jsonpath/input/test_data/functions.json
Test ./jsonpath/input/test_data/slice.json
Test ./jsonpath/input/test_data/parent-operator.json
Test ./jsonpath/input/test.json
patch:
[
    {
        "op": "add", 
        "path": "#/bar", 
        "value": "bad"
    }
]
[true,false,null]
"1514862245678901234"

"-2208988801999999999"

"2147483648000000001"

j: "-2208988801999999999"

milliseconds elapsed since 1970-01-01 00:00:00 UTC: -2208988801999
MessagePack bytes:
c7,0c,ff,3b,8b,87,c0,ff,ff,ff,ff,7c,55,81,7f

j2: "-2208988801999000000"

-1e+100
{
    "field1": "MyNaN", 
    "field2": "MyInf", 
    "field3": "-MyInf"
}

{"a":"2","c":[4,5,6]}
16
sizeof(json): 16
{"data":{"cash":0,"coupons":0,"creditcard":0,"debit":0,"discounts":0,"name":null,"neworder":true,"operator":"","orders":[{"active":"1","addtoitem":"0","bar":"1","cat":"Beer","cooking":"","id":"7","kitchen":"0","modifier":"0","name":"Budwiser","noqty":"1","oneof":"[]","operator":"robert","options":"[]","price":"5","print":"","qty":1,"server":"robert","sideprice":"0","subtotal":5,"type":"Bar","uid":"0242.7559"}],"outstanding":5.25,"payments":[],"server":"robert","status":"0","subtotal":5,"tableid":"quickserv","taxes":0.25,"tip":0,"total":5.25,"uid":"2822.7128","voiditems":[]},"posstation":{"printers":{"kitchen":[{"arguments":{"baud":"9600","bits":"8","nparity":"0","port":"3","stopbit":"0","xonxoff":"5"},"model":"epson","path":"localhost","type":"com"},{"arguments":{"baud":"","bits":"","nparity":"","port":"","stopbit":"","xonxoff":""},"model":"screen","path":"temp-pc","type":"screen"}],"receipt":[{"arguments":{"baud":"9600","bits":"8","nparity":"0","port":"3","stopbit":"0","xonxoff":"5"},"model":"epson","path":"Temp-PC","type":"com"},{"arguments":{"baud":"","bits":"","nparity":"","port":"","stopbit":"","xonxoff":""},"model":"screen","path":"localhost","type":"screen"}]}}}
[true,false,null]
__GNUC__: 13
__GNUC_MINOR__2
JSONCONS_HAS_STD_REGEX
===============================================================================
All tests passed (12767 assertions in 671 test cases)

<end of output>
Test time = 109.61 sec
----------------------------------------------------------
Test Passed.
"unit_tests" end time: Feb 20 09:28 CST
"unit_tests" time elapsed: 00:01:49
----------------------------------------------------------

End testing: Feb 20 09:28 CST

Is this anything meaningful? )

barracuda156 commented 4 months ago

This is the patch for now:

--- test/CMakeLists.txt 2024-02-05 05:59:37.000000000 +0800
+++ test/CMakeLists.txt 2024-02-20 09:25:47.000000000 +0800
@@ -65,7 +65,6 @@
                bson/src/bson_decimal128_tests.cpp
                bson/src/bson_oid_tests.cpp
                bson/src/bson_test_suite.cpp
-               bson/src/encode_decode_bson_tests.cpp
                cbor/src/cbor_bitset_traits_tests.cpp
                cbor/src/cbor_cursor_tests.cpp
                cbor/src/cbor_event_reader_tests.cpp
@@ -75,7 +74,6 @@
                cbor/src/cbor_tests.cpp
                cbor/src/cbor_typed_array_tests.cpp
                cbor/src/decode_cbor_tests.cpp
-               cbor/src/encode_cbor_tests.cpp
                csv/src/csv_cursor_tests.cpp
                csv/src/csv_subfield_tests.cpp
                csv/src/csv_tests.cpp
@@ -96,16 +94,13 @@
                jsonpath/src/jsonpath_json_replace_tests.cpp
                jsonpath/src/jsonpath_select_paths_tests.cpp
                jsonpath/src/jsonpath_test_suite.cpp
-               jsonpath/src/jsonpath_stateful_allocator_tests.cpp
                jsonpointer/src/jsonpointer_flatten_tests.cpp
-               jsonpointer/src/jsonpointer_tests.cpp
                jsonschema/src/format_validator_tests.cpp
                jsonschema/src/jsonschema_defaults_tests.cpp
                jsonschema/src/jsonschema_output_format_tests.cpp
                jsonschema/src/jsonschema_draft7_tests.cpp
                jsonschema/src/schema_version_tests.cpp
                msgpack/src/decode_msgpack_tests.cpp
-               msgpack/src/encode_msgpack_tests.cpp
                msgpack/src/msgpack_bitset_traits_tests.cpp
                msgpack/src/msgpack_cursor_tests.cpp
                msgpack/src/msgpack_event_reader_tests.cpp
@@ -125,7 +120,6 @@
                corelib/src/double_round_trip_tests.cpp
                corelib/src/double_to_string_tests.cpp
                corelib/src/dtoa_tests.cpp
-               corelib/src/encode_decode_json_tests.cpp
                corelib/src/encode_traits_tests.cpp
                corelib/src/error_recovery_tests.cpp
                corelib/src/json_array_tests.cpp
@@ -145,7 +139,6 @@
                corelib/src/json_line_split_tests.cpp
                corelib/src/json_literal_operator_tests.cpp
                corelib/src/json_object_tests.cpp
-               corelib/src/ojson_object_tests.cpp
                corelib/src/json_options_tests.cpp
                corelib/src/json_parse_error_tests.cpp
                corelib/src/json_parser_position_tests.cpp
@@ -153,7 +146,6 @@
                corelib/src/json_proxy_tests.cpp
                corelib/src/json_push_back_tests.cpp
                corelib/src/json_reader_exception_tests.cpp
-               corelib/src/json_reader_tests.cpp
                corelib/src/json_storage_tests.cpp
                corelib/src/json_swap_tests.cpp
                corelib/src/json_traits_macro_functional_tests.cpp
@@ -173,13 +165,10 @@
                corelib/src/source_tests.cpp
                corelib/src/staj_iterator_tests.cpp
                corelib/src/extension_traits_tests.cpp
-               corelib/src/polymorphic_allocator_tests.cpp
-               corelib/src/scoped_allocator_adaptor_tests.cpp
                corelib/src/string_to_double_tests.cpp
                corelib/src/unicode_conv_tests.cpp
                corelib/src/wjson_tests.cpp
                ubjson/src/decode_ubjson_tests.cpp
-               ubjson/src/encode_ubjson_tests.cpp
                ubjson/src/ubjson_cursor_tests.cpp
                ubjson/src/ubjson_encoder_tests.cpp
                corelib/src/testmain.cpp
@@ -199,7 +188,7 @@
     message(STATUS Version " ${CMAKE_CXX_COMPILER_VERSION}")
     # older GCC versions don't support 
    target_compile_options(unit_tests PRIVATE
-       $<$<CXX_COMPILER_ID:GNU>:-Wnon-virtual-dtor -Werror=stringop-overflow -Werror -Wall -Wextra -Wcast-align -Wcast-qual -Wimplicit-fallthrough -Wsign-compare -pedantic -Wnonnull -Werror=nonnull>
+       $<$<CXX_COMPILER_ID:GNU>:-Wnon-virtual-dtor -Werror=stringop-overflow -Wall -Wextra -Wcast-align -Wcast-qual -Wimplicit-fallthrough -Wsign-compare -pedantic -Wnonnull -Werror=nonnull>
    )
 endif()

(At the moment the aim was merely to see what builds and what is the tests output, if it builds at all.)

danielaparker commented 4 months ago

My conclusion from the original build output is that the main issue has to do with your using a std::basic_string class that does not support stateful allocators.

I believe the files that you've removed from the build all contain stateful allocator tests. I think you could achieve the same result, without losing as much test coverage, by adding #undefine JSONCONS_HAS_STATEFUL_ALLOCATOR to the bottom of the header file jsoncons/config/jsoncons_config.hpp.

I've modified the configuration on branch main so that you can compile with -D JSONCONS_HAS_STATEFUL_ALLOCATOR=0 instead of modifying the file.

I'd like more information about the malloc failure, can you determine in which test that is happening?

I need to address the 32 bit warnings. I think the main issue is with binary formats that support 64 bit byte lengths. We need to throw or assert if a binary header contains a length that won't fit into a 32 bit integer.

barracuda156 commented 4 months ago

I've modified the configuration on branch main so that you can compile with -D JSONCONS_HAS_STATEFUL_ALLOCATOR=0 instead of modifying the file.

Thank you! Will try that.

I'd like more information about the malloc failure, can you determine in which test that is happening?

Could we somehow get per-test-case output in the log?

I need to address the 32 bit warnings.

That would be awesome.

barracuda156 commented 4 months ago

@danielaparker I am away from my PowerPC hardware for about a week more, so there is a bit of delay with testing. I return to this issue as soon as I am back.

If you could find time to address 32-bit warnings, please let me know.

danielaparker commented 3 months ago

@barracuda156 The 32-bit warning that you reported earlier has been addressed on master. If you find any others, please report them, thanks.

barracuda156 commented 3 months ago

@danielaparker Thank you! I will return to this in a couple of days then.

barracuda156 commented 3 months ago

@danielaparker Building from 08b1b4f6ac48155ee841f7092492208334679de1 I still get 32-bit-caused errors:

/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-08b1b4f6ac48155ee841f7092492208334679de1/include/jsoncons_ext/cbor/cbor_encoder.hpp: In instantiation of 'bool jsoncons::cbor::basic_cbor_encoder<Sink, Allocator>::visit_begin_object(std::size_t, jsoncons::semantic_tag, const jsoncons::ser_context&, std::error_code&) [with Sink = jsoncons::bytes_sink<std::basic_string<char>, void>; Allocator = std::allocator<char>; std::size_t = long unsigned int]':
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-08b1b4f6ac48155ee841f7092492208334679de1/include/jsoncons_ext/cbor/cbor_encoder.hpp:173:10:   required from here
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-08b1b4f6ac48155ee841f7092492208334679de1/include/jsoncons_ext/cbor/cbor_encoder.hpp:208:35: error: comparison is always true due to limited range of data type [-Werror=type-limits]
  208 |         else if (uint64_t(length) <= 0xffffffffffffffff)
      |                  ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-08b1b4f6ac48155ee841f7092492208334679de1/include/jsoncons_ext/cbor/cbor_encoder.hpp: In instantiation of 'bool jsoncons::cbor::basic_cbor_encoder<Sink, Allocator>::visit_begin_array(std::size_t, jsoncons::semantic_tag, const jsoncons::ser_context&, std::error_code&) [with Sink = jsoncons::bytes_sink<std::basic_string<char>, void>; Allocator = std::allocator<char>; std::size_t = long unsigned int]':
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-08b1b4f6ac48155ee841f7092492208334679de1/include/jsoncons_ext/cbor/cbor_encoder.hpp:260:10:   required from here
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-08b1b4f6ac48155ee841f7092492208334679de1/include/jsoncons_ext/cbor/cbor_encoder.hpp:294:25: error: comparison is always true due to limited range of data type [-Werror=type-limits]
  294 |         else if (length <= 0xffffffffffffffff)
      |                  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-08b1b4f6ac48155ee841f7092492208334679de1/include/jsoncons_ext/cbor/cbor_encoder.hpp: In instantiation of 'void jsoncons::cbor::basic_cbor_encoder<Sink, Allocator>::write_bignum(jsoncons::bigint&) [with Sink = jsoncons::bytes_sink<std::basic_string<char>, void>; Allocator = std::allocator<char>; jsoncons::bigint = jsoncons::basic_bigint<std::allocator<unsigned char> >]':
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-08b1b4f6ac48155ee841f7092492208334679de1/include/jsoncons_ext/cbor/cbor_encoder.hpp:818:17:   required from 'bool jsoncons::cbor::basic_cbor_encoder<Sink, Allocator>::visit_string(const jsoncons::basic_json_visitor<char>::string_view_type&, jsoncons::semantic_tag, const jsoncons::ser_context&, std::error_code&) [with Sink = jsoncons::bytes_sink<std::basic_string<char>, void>; Allocator = std::allocator<char>; jsoncons::basic_json_visitor<char>::string_view_type = std::basic_string_view<char>]'
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-08b1b4f6ac48155ee841f7092492208334679de1/include/jsoncons_ext/cbor/cbor_encoder.hpp:811:10:   required from here
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-08b1b4f6ac48155ee841f7092492208334679de1/include/jsoncons_ext/cbor/cbor_encoder.hpp:477:25: error: comparison is always true due to limited range of data type [-Werror=type-limits]
  477 |         else if (length <= 0xffffffffffffffff)
      |                  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
. . .

To be clear, I dropped all my patches and only pass -DJSONCONS_HAS_STATEFUL_ALLOCATOR=0 manually.

danielaparker commented 3 months ago

Could you check again with the latest code on master? Thanks.

danielaparker commented 3 months ago

Oh sorry, the latest will still fail, this is a "comparison is always true due to limited range of data type" warning rather than a 32 bit issue per se. It would compile if I commented out the last if condition, but I don't think that's right.

barracuda156 commented 3 months ago

@danielaparker What will be an appropriate solution here?

danielaparker commented 3 months ago

Either use a pragma to selectively deactivate the warning in basic_cbor_encoder, or find some other way of expressing

if (uint64_t(length) <= 0xffffffffffffffff)

that does not trigger the warning. I notice that another cbor project that compiles on many environments uses

 if (uint64_t(length) <= (std::numeric_limits<std::uint64_t>::max)())

I've changed it to that on master, you can try that.

barracuda156 commented 3 months ago

Building from 8088c81eb7fc608c98f4e286da9a021f506ee8ee still fails, but on msgpack_* stuff:

In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-8088c81eb7fc608c98f4e286da9a021f506ee8ee/include/jsoncons_ext/msgpack/msgpack.hpp:17,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-8088c81eb7fc608c98f4e286da9a021f506ee8ee/test/msgpack/src/decode_msgpack_tests.cpp:8:
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-8088c81eb7fc608c98f4e286da9a021f506ee8ee/include/jsoncons_ext/msgpack/msgpack_encoder.hpp: In instantiation of 'bool jsoncons::msgpack::basic_msgpack_encoder<Sink, Allocator>::visit_begin_object(std::size_t, jsoncons::semantic_tag, const jsoncons::ser_context&, std::error_code&) [with Sink = jsoncons::bytes_sink<std::vector<unsigned char> >; Allocator = std::allocator<char>; std::size_t = long unsigned int]':
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-8088c81eb7fc608c98f4e286da9a021f506ee8ee/include/jsoncons_ext/msgpack/msgpack_encoder.hpp:129:14:   required from here
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-8088c81eb7fc608c98f4e286da9a021f506ee8ee/include/jsoncons_ext/msgpack/msgpack_encoder.hpp:150:29: error: comparison is always true due to limited range of data type [-Werror=type-limits]
  150 |             else if (length <= 4294967295)
      |                      ~~~~~~~^~~~~~~~~~~~~
In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-8088c81eb7fc608c98f4e286da9a021f506ee8ee/include/jsoncons_ext/msgpack/msgpack.hpp:17,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-8088c81eb7fc608c98f4e286da9a021f506ee8ee/test/msgpack/src/encode_msgpack_tests.cpp:8:
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-8088c81eb7fc608c98f4e286da9a021f506ee8ee/include/jsoncons_ext/msgpack/msgpack_encoder.hpp: In instantiation of 'bool jsoncons::msgpack::basic_msgpack_encoder<Sink, Allocator>::visit_begin_object(std::size_t, jsoncons::semantic_tag, const jsoncons::ser_context&, std::error_code&) [with Sink = jsoncons::bytes_sink<std::vector<unsigned char> >; Allocator = std::allocator<char>; std::size_t = long unsigned int]':
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-8088c81eb7fc608c98f4e286da9a021f506ee8ee/include/jsoncons_ext/msgpack/msgpack_encoder.hpp:129:14:   required from here
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-8088c81eb7fc608c98f4e286da9a021f506ee8ee/include/jsoncons_ext/msgpack/msgpack_encoder.hpp:150:29: error: comparison is always true due to limited range of data type [-Werror=type-limits]
  150 |             else if (length <= 4294967295)
      |                      ~~~~~~~^~~~~~~~~~~~~
[ 39%] Building CXX object test/CMakeFiles/unit_tests.dir/msgpack/src/msgpack_bitset_traits_tests.cpp.o
cd /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/build/test && /opt/local/bin/g++-mp-13  -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-8088c81eb7fc608c98f4e286da9a021f506ee8ee/include -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-8088c81eb7fc608c98f4e286da9a021f506ee8ee/test -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-8088c81eb7fc608c98f4e286da9a021f506ee8ee/third_party -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-8088c81eb7fc608c98f4e286da9a021f506ee8ee/third_party/catch -pipe -Os -DNDEBUG -I/opt/local/include -DJSONCONS_HAS_STATEFUL_ALLOCATOR=0 -D_GLIBCXX_USE_CXX11_ABI=0 -mmacosx-version-min=10.6 -Wnon-virtual-dtor -Werror=stringop-overflow -Werror -Wall -Wextra -Wcast-align -Wcast-qual -Wimplicit-fallthrough -Wsign-compare -pedantic -Wnonnull -Werror=nonnull -MD -MT test/CMakeFiles/unit_tests.dir/msgpack/src/msgpack_bitset_traits_tests.cpp.o -MF CMakeFiles/unit_tests.dir/msgpack/src/msgpack_bitset_traits_tests.cpp.o.d -o CMakeFiles/unit_tests.dir/msgpack/src/msgpack_bitset_traits_tests.cpp.o -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-8088c81eb7fc608c98f4e286da9a021f506ee8ee/test/msgpack/src/msgpack_bitset_traits_tests.cpp
In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-8088c81eb7fc608c98f4e286da9a021f506ee8ee/include/jsoncons_ext/msgpack/msgpack.hpp:17,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-8088c81eb7fc608c98f4e286da9a021f506ee8ee/test/msgpack/src/msgpack_bitset_traits_tests.cpp:6:
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-8088c81eb7fc608c98f4e286da9a021f506ee8ee/include/jsoncons_ext/msgpack/msgpack_encoder.hpp: In instantiation of 'bool jsoncons::msgpack::basic_msgpack_encoder<Sink, Allocator>::visit_begin_object(std::size_t, jsoncons::semantic_tag, const jsoncons::ser_context&, std::error_code&) [with Sink = jsoncons::bytes_sink<std::basic_string<char>, void>; Allocator = std::allocator<char>; std::size_t = long unsigned int]':
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-8088c81eb7fc608c98f4e286da9a021f506ee8ee/include/jsoncons_ext/msgpack/msgpack_encoder.hpp:129:14:   required from here
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-8088c81eb7fc608c98f4e286da9a021f506ee8ee/include/jsoncons_ext/msgpack/msgpack_encoder.hpp:150:29: error: comparison is always true due to limited range of data type [-Werror=type-limits]
  150 |             else if (length <= 4294967295)
      |                      ~~~~~~~^~~~~~~~~~~~~
[ 40%] Building CXX object test/CMakeFiles/unit_tests.dir/msgpack/src/msgpack_cursor_tests.cpp.o
cd /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/build/test && /opt/local/bin/g++-mp-13  -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-8088c81eb7fc608c98f4e286da9a021f506ee8ee/include -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-8088c81eb7fc608c98f4e286da9a021f506ee8ee/test -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-8088c81eb7fc608c98f4e286da9a021f506ee8ee/third_party -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-8088c81eb7fc608c98f4e286da9a021f506ee8ee/third_party/catch -pipe -Os -DNDEBUG -I/opt/local/include -DJSONCONS_HAS_STATEFUL_ALLOCATOR=0 -D_GLIBCXX_USE_CXX11_ABI=0 -mmacosx-version-min=10.6 -Wnon-virtual-dtor -Werror=stringop-overflow -Werror -Wall -Wextra -Wcast-align -Wcast-qual -Wimplicit-fallthrough -Wsign-compare -pedantic -Wnonnull -Werror=nonnull -MD -MT test/CMakeFiles/unit_tests.dir/msgpack/src/msgpack_cursor_tests.cpp.o -MF CMakeFiles/unit_tests.dir/msgpack/src/msgpack_cursor_tests.cpp.o.d -o CMakeFiles/unit_tests.dir/msgpack/src/msgpack_cursor_tests.cpp.o -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-8088c81eb7fc608c98f4e286da9a021f506ee8ee/test/msgpack/src/msgpack_cursor_tests.cpp
cc1plus: all warnings being treated as errors
make[2]: *** [test/CMakeFiles/unit_tests.dir/msgpack/src/encode_msgpack_tests.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-8088c81eb7fc608c98f4e286da9a021f506ee8ee/include/jsoncons_ext/msgpack/msgpack.hpp:17,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-8088c81eb7fc608c98f4e286da9a021f506ee8ee/test/msgpack/src/msgpack_cursor_tests.cpp:10:
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-8088c81eb7fc608c98f4e286da9a021f506ee8ee/include/jsoncons_ext/msgpack/msgpack_encoder.hpp: In instantiation of 'bool jsoncons::msgpack::basic_msgpack_encoder<Sink, Allocator>::visit_begin_object(std::size_t, jsoncons::semantic_tag, const jsoncons::ser_context&, std::error_code&) [with Sink = jsoncons::bytes_sink<std::vector<unsigned char> >; Allocator = std::allocator<char>; std::size_t = long unsigned int]':
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-8088c81eb7fc608c98f4e286da9a021f506ee8ee/include/jsoncons_ext/msgpack/msgpack_encoder.hpp:129:14:   required from here
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-8088c81eb7fc608c98f4e286da9a021f506ee8ee/include/jsoncons_ext/msgpack/msgpack_encoder.hpp:150:29: error: comparison is always true due to limited range of data type [-Werror=type-limits]
  150 |             else if (length <= 4294967295)
      |                      ~~~~~~~^~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
danielaparker commented 3 months ago

Oh, good. We'll try the same strategy for msgpack.

danielaparker commented 3 months ago

When you get a chance, can you check master again?

barracuda156 commented 3 months ago

When you get a chance, can you check master again?

Sure, thanks!

(In the mid of 12 hrs rebuild of gcc and libgcc now, so perhaps update on this tomorrow.)

barracuda156 commented 3 months ago

@danielaparker Running the build now, will update on result.

barracuda156 commented 3 months ago

Failed on this:

In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-9368ac68c4e6164b5c7678ce8957e1fef22df00d/include/jsoncons/json.hpp:10,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-9368ac68c4e6164b5c7678ce8957e1fef22df00d/test/corelib/src/json_const_pointer_tests.cpp:4:
In member function 'jsoncons::basic_json<CharT, Policy, Allocator>::array& jsoncons::basic_json<CharT, Policy, Allocator>::array_storage::value() [with CharT = char; Policy = jsoncons::sorted_policy; Allocator = std::allocator<char>]',
    inlined from 'jsoncons::basic_json<CharT, Policy, Allocator>& jsoncons::basic_json<CharT, Policy, Allocator>::at(std::size_t) [with CharT = char; Policy = jsoncons::sorted_policy; Allocator = std::allocator<char>]' at /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-9368ac68c4e6164b5c7678ce8957e1fef22df00d/include/jsoncons/basic_json.hpp:4819:57,
    inlined from 'void C_A_T_C_H_T_E_S_T_0()' at /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-9368ac68c4e6164b5c7678ce8957e1fef22df00d/test/corelib/src/json_const_pointer_tests.cpp:31:9:
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-9368ac68c4e6164b5c7678ce8957e1fef22df00d/include/jsoncons/basic_json.hpp:1045:25: error: '*(jsoncons::basic_json<char, jsoncons::sorted_policy, std::allocator<char> >::array_storage*)((char*)&v + offsetof(jsoncons::json, jsoncons::basic_json<char, jsoncons::sorted_policy, std::allocator<char> >::<unnamed>)).jsoncons::basic_json<char, jsoncons::sorted_policy, std::allocator<char> >::array_storage::ptr_' may be used uninitialized [-Werror=maybe-uninitialized]
 1045 |                 return *ptr_;
      |                         ^~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-9368ac68c4e6164b5c7678ce8957e1fef22df00d/test/corelib/src/json_const_pointer_tests.cpp: In function 'void C_A_T_C_H_T_E_S_T_0()':
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-9368ac68c4e6164b5c7678ce8957e1fef22df00d/test/corelib/src/json_const_pointer_tests.cpp:29:14: note: 'v' declared here
   29 |         json v(json_const_pointer_arg, &j);
      |              ^
cc1plus: all warnings being treated as errors
make[2]: *** [test/CMakeFiles/unit_tests.dir/corelib/src/json_const_pointer_tests.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....

Build attempted from 9368ac68c4e6164b5c7678ce8957e1fef22df00d

danielaparker commented 3 months ago

Should be fixed on master

barracuda156 commented 3 months ago

Apparently not yet, from f67f926d0fdbb887c2c09cc85d31d260bf47fefb it still fails:

[ 69%] Building CXX object test/CMakeFiles/unit_tests.dir/corelib/src/json_literal_operator_tests.cpp.o
cd /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/build/test && /opt/local/bin/g++-mp-13  -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-f67f926d0fdbb887c2c09cc85d31d260bf47fefb/include -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-f67f926d0fdbb887c2c09cc85d31d260bf47fefb/test -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-f67f926d0fdbb887c2c09cc85d31d260bf47fefb/third_party -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-f67f926d0fdbb887c2c09cc85d31d260bf47fefb/third_party/catch -pipe -Os -DNDEBUG -I/opt/local/include -DJSONCONS_HAS_STATEFUL_ALLOCATOR=0 -D_GLIBCXX_USE_CXX11_ABI=0 -mmacosx-version-min=10.6 -Wnon-virtual-dtor -Werror=stringop-overflow -Werror -Wall -Wextra -Wcast-align -Wcast-qual -Wimplicit-fallthrough -Wsign-compare -pedantic -Wnonnull -Werror=nonnull -MD -MT test/CMakeFiles/unit_tests.dir/corelib/src/json_literal_operator_tests.cpp.o -MF CMakeFiles/unit_tests.dir/corelib/src/json_literal_operator_tests.cpp.o.d -o CMakeFiles/unit_tests.dir/corelib/src/json_literal_operator_tests.cpp.o -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-f67f926d0fdbb887c2c09cc85d31d260bf47fefb/test/corelib/src/json_literal_operator_tests.cpp
In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-f67f926d0fdbb887c2c09cc85d31d260bf47fefb/include/jsoncons/json.hpp:10,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-f67f926d0fdbb887c2c09cc85d31d260bf47fefb/test/corelib/src/json_const_pointer_tests.cpp:4:
In member function 'jsoncons::basic_json<CharT, Policy, Allocator>::array& jsoncons::basic_json<CharT, Policy, Allocator>::array_storage::value() [with CharT = char; Policy = jsoncons::sorted_policy; Allocator = std::allocator<char>]',
    inlined from 'jsoncons::basic_json<CharT, Policy, Allocator>& jsoncons::basic_json<CharT, Policy, Allocator>::at(std::size_t) [with CharT = char; Policy = jsoncons::sorted_policy; Allocator = std::allocator<char>]' at /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-f67f926d0fdbb887c2c09cc85d31d260bf47fefb/include/jsoncons/basic_json.hpp:4819:57,
    inlined from 'void C_A_T_C_H_T_E_S_T_0()' at /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-f67f926d0fdbb887c2c09cc85d31d260bf47fefb/test/corelib/src/json_const_pointer_tests.cpp:31:9:
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-f67f926d0fdbb887c2c09cc85d31d260bf47fefb/include/jsoncons/basic_json.hpp:1045:25: error: '*(jsoncons::basic_json<char, jsoncons::sorted_policy, std::allocator<char> >::array_storage*)((char*)&v + offsetof(jsoncons::json, jsoncons::basic_json<char, jsoncons::sorted_policy, std::allocator<char> >::<unnamed>)).jsoncons::basic_json<char, jsoncons::sorted_policy, std::allocator<char> >::array_storage::ptr_' may be used uninitialized [-Werror=maybe-uninitialized]
 1045 |                 return *ptr_;
      |                         ^~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-f67f926d0fdbb887c2c09cc85d31d260bf47fefb/test/corelib/src/json_const_pointer_tests.cpp: In function 'void C_A_T_C_H_T_E_S_T_0()':
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-f67f926d0fdbb887c2c09cc85d31d260bf47fefb/test/corelib/src/json_const_pointer_tests.cpp:29:14: note: 'v' declared here
   29 |         json v(json_const_pointer_arg, &j);
      |              ^
[ 70%] Building CXX object test/CMakeFiles/unit_tests.dir/corelib/src/json_object_tests.cpp.o
cd /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/build/test && /opt/local/bin/g++-mp-13  -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-f67f926d0fdbb887c2c09cc85d31d260bf47fefb/include -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-f67f926d0fdbb887c2c09cc85d31d260bf47fefb/test -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-f67f926d0fdbb887c2c09cc85d31d260bf47fefb/third_party -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-f67f926d0fdbb887c2c09cc85d31d260bf47fefb/third_party/catch -pipe -Os -DNDEBUG -I/opt/local/include -DJSONCONS_HAS_STATEFUL_ALLOCATOR=0 -D_GLIBCXX_USE_CXX11_ABI=0 -mmacosx-version-min=10.6 -Wnon-virtual-dtor -Werror=stringop-overflow -Werror -Wall -Wextra -Wcast-align -Wcast-qual -Wimplicit-fallthrough -Wsign-compare -pedantic -Wnonnull -Werror=nonnull -MD -MT test/CMakeFiles/unit_tests.dir/corelib/src/json_object_tests.cpp.o -MF CMakeFiles/unit_tests.dir/corelib/src/json_object_tests.cpp.o.d -o CMakeFiles/unit_tests.dir/corelib/src/json_object_tests.cpp.o -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-f67f926d0fdbb887c2c09cc85d31d260bf47fefb/test/corelib/src/json_object_tests.cpp
cc1plus: all warnings being treated as errors
make[2]: *** [test/CMakeFiles/unit_tests.dir/corelib/src/json_const_pointer_tests.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/build'
make[1]: *** [test/CMakeFiles/unit_tests.dir/all] Error 2
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/build'
make: *** [all] Error 2
barracuda156 commented 1 month ago

@danielaparker So should this be fixed now? I will test it then.

danielaparker commented 1 month ago

I think there's still a (innocuous) uninitialized warning in this one environment. I haven't seen it in any other. May need to suppress it.

danielaparker commented 1 month ago

@barracuda156 , could you have another go at testing the code on master? Thanks!

barracuda156 commented 1 month ago

@danielaparker Sure, gonna try today.

barracuda156 commented 1 month ago

Using 640c0e4d43884c64bf387b6da9a989688d603cad does not work still:

:info:build [ 66%] Building CXX object test/CMakeFiles/unit_tests.dir/corelib/src/json_in_place_update_tests.cpp.o
:info:build cd /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/build/test && /opt/local/bin/g++-mp-13  -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-640c0e4d43884c64bf387b6da9a989688d603cad/include -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-640c0e4d43884c64bf387b6da9a989688d603cad/test -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-640c0e4d43884c64bf387b6da9a989688d603cad/test/thirdparty -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-640c0e4d43884c64bf387b6da9a989688d603cad/test/thirdparty/catch -pipe -Os -DNDEBUG -I/opt/local/include -DJSONCONS_HAS_STATEFUL_ALLOCATOR=0 -D_GLIBCXX_USE_CXX11_ABI=0 -mmacosx-version-min=10.6 -Werror=maybe-uninitialized -Wnon-virtual-dtor -Werror=stringop-overflow -Werror -Wall -Wextra -Wcast-align -Wcast-qual -Wimplicit-fallthrough -Wsign-compare -pedantic -Wnonnull -Werror=nonnull -MD -MT test/CMakeFiles/unit_tests.dir/corelib/src/json_in_place_update_tests.cpp.o -MF CMakeFiles/unit_tests.dir/corelib/src/json_in_place_update_tests.cpp.o.d -o CMakeFiles/unit_tests.dir/corelib/src/json_in_place_update_tests.cpp.o -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-640c0e4d43884c64bf387b6da9a989688d603cad/test/corelib/src/json_in_place_update_tests.cpp
:info:build In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-640c0e4d43884c64bf387b6da9a989688d603cad/include/jsoncons/json.hpp:10,
:info:build                  from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-640c0e4d43884c64bf387b6da9a989688d603cad/test/corelib/src/json_const_pointer_tests.cpp:4:
:info:build In member function 'jsoncons::basic_json<CharT, Policy, Allocator>::array& jsoncons::basic_json<CharT, Policy, Allocator>::array_storage::value() [with CharT = char; Policy = jsoncons::sorted_policy; Allocator = std::allocator<char>]',
:info:build     inlined from 'jsoncons::basic_json<CharT, Policy, Allocator>& jsoncons::basic_json<CharT, Policy, Allocator>::at(std::size_t) [with CharT = char; Policy = jsoncons::sorted_policy; Allocator = std::allocator<char>]' at /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-640c0e4d43884c64bf387b6da9a989688d603cad/include/jsoncons/basic_json.hpp:4827:57,
:info:build     inlined from 'void C_A_T_C_H_T_E_S_T_0()' at /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-640c0e4d43884c64bf387b6da9a989688d603cad/test/corelib/src/json_const_pointer_tests.cpp:31:9:
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-640c0e4d43884c64bf387b6da9a989688d603cad/include/jsoncons/basic_json.hpp:1049:25: error: '*(jsoncons::basic_json<char, jsoncons::sorted_policy, std::allocator<char> >::array_storage*)((char*)&v + offsetof(jsoncons::json, jsoncons::basic_json<char, jsoncons::sorted_policy, std::allocator<char> >::<unnamed>)).jsoncons::basic_json<char, jsoncons::sorted_policy, std::allocator<char> >::array_storage::ptr_' may be used uninitialized [-Werror=maybe-uninitialized]
:info:build  1049 |                 return *ptr_;
:info:build       |                         ^~~~
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-640c0e4d43884c64bf387b6da9a989688d603cad/test/corelib/src/json_const_pointer_tests.cpp: In function 'void C_A_T_C_H_T_E_S_T_0()':
:info:build /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-640c0e4d43884c64bf387b6da9a989688d603cad/test/corelib/src/json_const_pointer_tests.cpp:29:14: note: 'v' declared here
:info:build    29 |         json v(json_const_pointer_arg, &j);
:info:build       |              ^
:info:build cc1plus: all warnings being treated as errors
:info:build make[2]: *** [test/CMakeFiles/unit_tests.dir/corelib/src/json_const_pointer_tests.cpp.o] Error 1
:info:build make[2]: *** Waiting for unfinished jobs....

Looks like the same -Werror=maybe-uninitialized error as last time.

No patches applied, only passing -DJSONCONS_HAS_STATEFUL_ALLOCATOR=0 to CMake.

danielaparker commented 1 month ago

Passing -DJSONCONS_HAS_STATEFUL_ALLOCATOR=0 is no longer necessary.

I've been reading up on maybe-uninitialized, gcc's version of "not sure, but", one way to disable it is -Wno-maybe-uninitialized. But I'd prefer not to do that. I've tried to disable it with a #pragma around this particular section of code. Could you test once again :-)

danielaparker commented 1 month ago

Actually, hold off on testing again, there's a few more things I can check.

barracuda156 commented 1 month ago

@danielaparker Has this already been addressed? 0.176.0 fails here:

[ 93%] Building CXX object test/CMakeFiles/unit_tests.dir/corelib/src/string_to_double_tests.cpp.o
cd /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/build/test && /opt/local/bin/g++-mp-13  -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/include -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/test -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/test/thirdparty -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/test/thirdparty/catch -pipe -Os -DNDEBUG -I/opt/local/include -DJSONCONS_HAS_STATEFUL_ALLOCATOR=0 -D_GLIBCXX_USE_CXX11_ABI=0 -mmacosx-version-min=10.6 -Werror=maybe-uninitialized -Wnon-virtual-dtor -Werror=stringop-overflow -Werror -Wall -Wextra -Wcast-align -Wcast-qual -Wimplicit-fallthrough -Wsign-compare -pedantic -Wnonnull -Werror=nonnull -MD -MT test/CMakeFiles/unit_tests.dir/corelib/src/string_to_double_tests.cpp.o -MF CMakeFiles/unit_tests.dir/corelib/src/string_to_double_tests.cpp.o.d -o CMakeFiles/unit_tests.dir/corelib/src/string_to_double_tests.cpp.o -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/test/corelib/src/string_to_double_tests.cpp
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/test/corelib/src/polymorphic_allocator_tests.cpp: In function 'void C_A_T_C_H_T_E_S_T_3()':
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/test/corelib/src/polymorphic_allocator_tests.cpp:72:15: error: 'string' is not a member of 'std::pmr'
   72 |     std::pmr::string key1{"foo", alloc1};
      |               ^~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/test/corelib/src/polymorphic_allocator_tests.cpp:72:15: note: suggested alternatives:
In file included from /opt/local/include/gcc13/c++/string:41,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/include/jsoncons/basic_json.hpp:11,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/include/jsoncons/json.hpp:10,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/test/corelib/src/polymorphic_allocator_tests.cpp:4:
/opt/local/include/gcc13/c++/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/include/jsoncons/json_reader.hpp:20,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/include/jsoncons/basic_json.hpp:36:
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/include/jsoncons/json_parser.hpp:53:5: note:   'jsoncons::json_parse_state::string'
   53 |     string,
      |     ^~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/test/corelib/src/polymorphic_allocator_tests.cpp:73:15: error: 'string' is not a member of 'std::pmr'
   73 |     std::pmr::string key2{"bar", alloc1};
      |               ^~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/test/corelib/src/polymorphic_allocator_tests.cpp:73:15: note: suggested alternatives:
/opt/local/include/gcc13/c++/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/include/jsoncons/json_parser.hpp:53:5: note:   'jsoncons::json_parse_state::string'
   53 |     string,
      |     ^~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/test/corelib/src/polymorphic_allocator_tests.cpp:88:23: error: 'key1' was not declared in this scope; did you mean 'y1'?
   88 |         j.try_emplace(key1, pmr_json{});
      |                       ^~~~
      |                       y1
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/test/corelib/src/polymorphic_allocator_tests.cpp:89:33: error: 'key2' was not declared in this scope
   89 |         j.try_emplace(std::move(key2), a_long_string);
      |                                 ^~~~
[ 94%] Building CXX object test/CMakeFiles/unit_tests.dir/corelib/src/unicode_conv_tests.cpp.o
cd /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/build/test && /opt/local/bin/g++-mp-13  -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/include -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/test -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/test/thirdparty -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/test/thirdparty/catch -pipe -Os -DNDEBUG -I/opt/local/include -DJSONCONS_HAS_STATEFUL_ALLOCATOR=0 -D_GLIBCXX_USE_CXX11_ABI=0 -mmacosx-version-min=10.6 -Werror=maybe-uninitialized -Wnon-virtual-dtor -Werror=stringop-overflow -Werror -Wall -Wextra -Wcast-align -Wcast-qual -Wimplicit-fallthrough -Wsign-compare -pedantic -Wnonnull -Werror=nonnull -MD -MT test/CMakeFiles/unit_tests.dir/corelib/src/unicode_conv_tests.cpp.o -MF CMakeFiles/unit_tests.dir/corelib/src/unicode_conv_tests.cpp.o.d -o CMakeFiles/unit_tests.dir/corelib/src/unicode_conv_tests.cpp.o -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/test/corelib/src/unicode_conv_tests.cpp
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/test/corelib/src/polymorphic_allocator_tests.cpp:104:23: error: 'key1' was not declared in this scope; did you mean 'y1'?
  104 |         j.try_emplace(key1, pmr_ojson{});
      |                       ^~~~
      |                       y1
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/test/corelib/src/polymorphic_allocator_tests.cpp:105:33: error: 'key2' was not declared in this scope
  105 |         j.try_emplace(std::move(key2), a_long_string);
      |                                 ^~~~
[ 95%] Building CXX object test/CMakeFiles/unit_tests.dir/corelib/src/wjson_tests.cpp.o
cd /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/build/test && /opt/local/bin/g++-mp-13  -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/include -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/test -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/test/thirdparty -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/test/thirdparty/catch -pipe -Os -DNDEBUG -I/opt/local/include -DJSONCONS_HAS_STATEFUL_ALLOCATOR=0 -D_GLIBCXX_USE_CXX11_ABI=0 -mmacosx-version-min=10.6 -Werror=maybe-uninitialized -Wnon-virtual-dtor -Werror=stringop-overflow -Werror -Wall -Wextra -Wcast-align -Wcast-qual -Wimplicit-fallthrough -Wsign-compare -pedantic -Wnonnull -Werror=nonnull -MD -MT test/CMakeFiles/unit_tests.dir/corelib/src/wjson_tests.cpp.o -MF CMakeFiles/unit_tests.dir/corelib/src/wjson_tests.cpp.o.d -o CMakeFiles/unit_tests.dir/corelib/src/wjson_tests.cpp.o -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/test/corelib/src/wjson_tests.cpp
[ 96%] Building CXX object test/CMakeFiles/unit_tests.dir/ubjson/src/decode_ubjson_tests.cpp.o
cd /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/build/test && /opt/local/bin/g++-mp-13  -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/include -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/test -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/test/thirdparty -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/test/thirdparty/catch -pipe -Os -DNDEBUG -I/opt/local/include -DJSONCONS_HAS_STATEFUL_ALLOCATOR=0 -D_GLIBCXX_USE_CXX11_ABI=0 -mmacosx-version-min=10.6 -Werror=maybe-uninitialized -Wnon-virtual-dtor -Werror=stringop-overflow -Werror -Wall -Wextra -Wcast-align -Wcast-qual -Wimplicit-fallthrough -Wsign-compare -pedantic -Wnonnull -Werror=nonnull -MD -MT test/CMakeFiles/unit_tests.dir/ubjson/src/decode_ubjson_tests.cpp.o -MF CMakeFiles/unit_tests.dir/ubjson/src/decode_ubjson_tests.cpp.o.d -o CMakeFiles/unit_tests.dir/ubjson/src/decode_ubjson_tests.cpp.o -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_jsoncons/jsoncons/work/jsoncons-0.176.0/test/ubjson/src/decode_ubjson_tests.cpp
make[2]: *** [test/CMakeFiles/unit_tests.dir/corelib/src/polymorphic_allocator_tests.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....

Also, I had to pass -DJSONCONS_HAS_STATEFUL_ALLOCATOR=0 explicitly with it.

barracuda156 commented 1 month ago

@danielaparker This is the only failure, provided -DJSONCONS_HAS_STATEFUL_ALLOCATOR=0 is passed manually (otherwise it fails in the very beginning).

BTW, isn't some C++17 standard needed here? I see nothing passed on the command line. Maybe that is why things break down?

danielaparker commented 1 month ago

The polymorphic allocator tests will only be compiled if JSONCONS_HAS_POLYMORPHIC_ALLOCATOR is defined. If you look at polymorphic_allocator_tests.cpp, you'll see the code is surrounded by

#if defined(JSONCONS_HAS_POLYMORPHIC_ALLOCATOR) && JSONCONS_HAS_POLYMORPHIC_ALLOCATOR == 1

...

#endif

JSONCONS_HAS_POLYMORPHIC_ALLOCATOR is defined in compiler_support.hpp based on whether jsoncons detects that you are using C++ 17 or above,

#if !defined(JSONCONS_HAS_2017)
#  if defined(__clang__)
#   if (__cplusplus >= 201703)
#     define JSONCONS_HAS_2017 1
#   endif // (__cplusplus >= 201703)
#  endif // defined(__clang__)
#  if defined(__GNUC__)
#   if (__GNUC__ >= 7)
#    if (__cplusplus >= 201703)
#     define JSONCONS_HAS_2017 1
#    endif // (__cplusplus >= 201703)
#   endif // (__GNUC__ >= 7)
#  endif // defined(__GNUC__)
#  if defined(_MSC_VER)
#   if (_MSC_VER >= 1910 && _MSVC_LANG >= 201703)
#    define JSONCONS_HAS_2017 1
#   endif // (_MSC_VER >= 1910 && MSVC_LANG >= 201703)
#  endif // defined(_MSC_VER)
#endif

We test with C++11, C++14, C++17 and C++20 compilers.

barracuda156 commented 1 month ago

@danielaparker Yes, I have seen that, and gcc13 certainly supports C++17. What I mean is that -std=c++17 is not passed (though it may not be needed, if the compiler defaults to it anyway).

However I get the error with that file, and only there (JSONCONS_HAS_POLYMORPHIC_ALLOCATOR is used elsewhere too). Why would this be the case?

danielaparker commented 1 month ago

No idea. It may compile if you explicitly set JSONCONS_HAS_POLYMORPHIC_ALLOCATOR=0. Or set -std=c++14. But you certainly shouldn't need to.

danielaparker commented 1 month ago

Although if I were guessing based on your compiler output, I'd guess that your compiler/standard library might be supporting the pmr namespace and polymorphic allocators, but not the alias std::pmr::string. If you wanted to do an experiment, you could try changing std::pmr::string to std::basic_string<char,std::char_traits<char>,std::pmr::polymorphic_allocator<char>> in polymorphic_allocator_tests.cpp, and see if that compiled.

barracuda156 commented 1 month ago

No idea. It may compile if you explicitly set JSONCONS_HAS_POLYMORPHIC_ALLOCATOR=0.

Obviously, disabling is an easy fix, but I wanted to figure out why that case fails specifically.

I will try your suggestion.

danielaparker commented 4 weeks ago

A quick search suggests that it's related to your _GLIBCXX_USE_CXX11_ABI setting.

barracuda156 commented 4 weeks ago

@danielaparker Ok, then perhaps if replacement does not work, we have to add a patch to skip that test with gcc builds.