0ad/source/third_party/jsonspirit
Ralph Sennhauser 9a43c43a33
Avoid gcc warning in json_spirit
Gcc-14 triggers a warning for substitute_esc_chars in
json_spirit_reader_template.h if optimizations are enabled.

../../../source/third_party/jsonspirit/json_spirit_reader_template.h:138:62:
/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/char_traits.h:427:56: warning: ‘void* __builtin_memcpy(void*, const void*, long unsigned int)’ accessing 9223372036854775808 or more bytes at offsets 0 and 0 may overlap up to 9223372036854775809 bytes at offset -1 [-Wrestrict]
  427 |         return static_cast<char_type*>(__builtin_memcpy(__s1, __s2, __n));

for with lto enabled

/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/char_traits.h:427:56: warning: ‘__builtin_memcpy’ specified bound between 9223372036854775808 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
  427 |         return static_cast<char_type*>(__builtin_memcpy(__s1, __s2, __n));

This looks like another incarnation of bugs like:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105329
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100366

Add quirk to avoid the warning

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-02-19 21:52:50 +01:00
..
json_spirit_error_position.h Update JSON_SPIRIT from 4.06 to 4.08 2020-12-31 10:25:34 +00:00
json_spirit_reader_template.h Avoid gcc warning in json_spirit 2025-02-19 21:52:50 +01:00
json_spirit_value.h Fix most Clang 10 Warnings 2020-12-31 14:25:37 +00:00
json_spirit_writer_options.h Update JSON_SPIRIT from 4.06 to 4.08 2020-12-31 10:25:34 +00:00
json_spirit_writer_template.h Remove unused typedef in json_spirit 2024-09-28 21:55:30 +02:00
LICENSE.txt Update JSON_SPIRIT from 4.06 to 4.08 2020-12-31 10:25:34 +00:00
README.txt Update JSON_SPIRIT from 4.06 to 4.08 2020-12-31 10:25:34 +00:00

This separate JSON library is used for Atlas to avoid the SpiderMonkey dependency.
SpiderMonkey is a fully featured JS engine and even though we already use it for the main engine, it's too heavy-weight to use it in Atlas.
The SpiderMonkey API also changes frequently and we hope that the JSON parsing code needs less changes when we use this separate library.

Get the library from here:
http://www.codeproject.com/Articles/20027/JSON-Spirit-A-C-JSON-Parser-Generator-Implemented

The currently used version was released on the 10 of May 2014.

Search for this comment in json_spirit_value.h and uncomment the lines we don't need:
// comment out the value types you don't need to reduce build times and intermediate file sizes