Commit Graph

1407 Commits

Author SHA1 Message Date
vslashg
0a9b9d9c6e
Fix a parser bug where tokens are misidentified as commas. (#1502)
* Fix a parser bug where tokens are misidentified as commas.

In the old and new readers, when parsing an object, a comment
followed by any non-`}` token is treated as a comma.

The new unit test required changing the runjsontests.py
flag regime so that failure tests could be run with default settings.

* Honor allowComments==false mode.

Much of the comment handling in the parsers is bespoke, and does not
honor this flag.  By unfiying it under a common API, the parser is
simplified and strict mode is now more correctly strict.

Note that allowComments mode does not allow for comments in
arbitrary locations; they are allowed only in certain positions.
Rectifying this is a bigger effort, since collectComments mode requires
storing the comments somewhere, and it's not immediately clear
where in the DOM all such comments should live.

---------

Co-authored-by: Jordan Bayles <bayles.jordan@gmail.com>
2024-09-09 17:30:16 -07:00
Jordan Bayles
c3a986600f
Update clang-format.yml 2024-09-09 17:19:14 -07:00
Jordan Bayles
073ad7e96e
Update meson.yml 2024-09-09 17:19:04 -07:00
Jordan Bayles
65d92a4313
Update meson.yml (#1554)
* Update meson.yml

* Update meson.yml

* Update meson.yml

* Update meson.yml

* Update meson.yml

* Update meson.yml

* Update meson.yml

* Update meson.yml

Switch to clang-format-check

* Update meson.yml

* Update meson.yml

* Update meson.yml

* Update meson.yml

* Update meson.yml

Add multilple OSes

* Update meson.yml

Add ninja version

* Update meson.yml

* Update meson.yml

* Update meson.yml

* Update meson.yml

* Update meson.yml
2024-09-09 17:10:48 -07:00
Jordan Bayles
ccea7db6c3
Clang format updates (#1560)
* add comment space directive

* Fix clang format issue

* wrap in clang-format off
2024-09-09 17:07:11 -07:00
Jordan Bayles
4290915354
Update clang-format.yml 2024-09-09 16:56:02 -07:00
Jordan Bayles
cc28be0590
Update clang-format.yml 2024-09-09 16:54:56 -07:00
Jordan Bayles
255ebc54af
Create clang-format.yml 2024-09-09 16:52:59 -07:00
Jordan Bayles
c8166ddf1c
add comment space directive (#1558) 2024-09-09 16:30:33 -07:00
Jordan Bayles
73c94501ed
Delete .travis_scripts directory (#1556) 2024-09-09 15:50:39 -07:00
Jordan Bayles
d2a9495fda
Delete .travis.yml (#1557) 2024-09-09 15:50:23 -07:00
Jordan Bayles
5c003ecacc
Fix clang format issues (#1555) 2024-09-09 15:48:18 -07:00
Jordan Bayles
6668fa51ee
Delete .github/workflows/c-cpp.yml 2024-09-09 11:50:31 -07:00
Jordan Bayles
79ade90248
Rename meson_build_and_run to meson.yml 2024-09-09 11:46:57 -07:00
Jordan Bayles
01b11d2e4b
Create meson_build_and_run (#1553) 2024-09-09 11:40:13 -07:00
Jordan Bayles
cd8173c6d3
Create c-cpp.yml 2024-09-09 11:39:17 -07:00
Mykola
69098a18b9
Avoid using cmake glob vars if we are a subproject (#1459)
If jsoncpp is a subproject (like a git submodule), setting the
global cmake variables affect the entire project (changes the
structure of the output folders) and these changes prevent it.
2023-06-27 10:42:38 -04:00
Jakob Widauer
3d9bf8ee54
feat: adds front and back methods to Value type (#1458)
Value::front and Value::back
2023-06-07 12:11:01 -04:00
mwestphal
8190e061bc
Fix wrong usage of doxygen groups (#1417) 2022-07-14 17:57:37 -04:00
Jessica Clarke
42e892d96e
Use default rather than hard-coded 8 for maximum aggregate member alignment (#1378)
On CHERI, and thus Arm's Morello prototype, pointers are represented as
hardware capabilities. These capabilities are comprised of not just an
integer address, as is the representation for traditional pointers, but
also bounds, permissions and other metadata, plus a tag bit used as the
validity bit, which provides fine-grained spatial and referential safety
for C and C++ in hardware. This tag bit is not part of the data itself
and is instead kept on the side, flowing with the capability between
registers and the memory subsystem, and any attempt to amplify the
privilege of or corrupt a capability clears this tag (or, in some cases,
traps), rendering them impossible to forge; you can only create
capabilities that are (possibly trivial) subsets of existing ones.

When the capability is stored in memory, this tag bit needs to be
preserved, which is done through the use of tagged memory. Every
capability-sized word gains an additional non-addressable (from the
CPU's perspective; depending on the implementation the tag bits may be
stored in a small block of memory carved out of normal DRAM that the CPU
is blocked from accessing) bit. This means that capabilities can only be
stored to aligned locations; attempting to store them to unaligned
locations will trap with an alignment fault or, if you end up using a
memcpy call, will copy the raw bytes of the capability's representation
but lose the tag, so when it is eventually loaded back as a capability
and dereferenced it will fault.

Since, on 64-bit architectures, our capabilities, used to implement C
language pointers, are 128-bit quantities, this means they need 16-byte
alignment. Currently the various #pragma pack directives, used to work
around (extremely broken and bogus) code that includes jsoncpp in a
context where the maximum alignment has been overridden, hard-code 8 as
the maximum alignment to use, and so do not sufficiently align CHERI /
Morello capabilities on 64-bit architectures. On Windows x64, the
default is also not 8 but 16 (ARM64 is supposedly 8), so this is
slightly dodgy to do there too, but in practice likely not an issue so
long as you don't use any 128-bit types there.

Instead of hard-coding a width, use a directive that resets the packing
back to the default. Unfortunately, whilst GCC and Clang both accept
using #pragma pack(push, 0) as shorthand like for any non-zero value,
MSVC does not, so this needs to be two directives.
2022-01-12 16:27:16 -05:00
luzpaz
a1f1613bdd
Fix various typos (#1350)
Found via `codespell -q 3 -L alue,alse`

Co-authored-by: Christopher Dunn <cdunn2001@gmail.com>
Co-authored-by: Jordan Bayles <jophba@chromium.org>
2021-12-14 18:04:47 -08:00
Tero Kinnunen
2d55c7445f
Parse large floats as infinity (#1349) (#1353)
Return 1.9.1 functionality where values too large to fit in
double are converted to positive or negative infinity.

Commit 645cd04 changed functionality so that large floats cause
parse error, while version 1.9.1 accepted them as infinite.
This is problematic because writer outputs infinity values
as `1e+9999`, which could no longer be parsed back.

Fixed also legacy Reader even though it did not parse large values
even before breaking change, due to problematic output/parse asymmetry.

`>>` operator sets value to numeric_limits::max/lowest value if
representation is too large to fit to double. [1][2] In macos
value appears to be parsed to infinity.

> | value in *val*           | description |
> |--------------------------|-------------|
> | numeric_limits::max()    | The sequence represents a value too large for the type of val |
> | numeric_limits::lowest() | The sequence represents a value too large negative for the type of val |

[1] https://www.cplusplus.com/reference/istream/istream/operator%3E%3E/
[2] https://www.cplusplus.com/reference/locale/num_get/get/

Signed-off-by: Tero Kinnunen <tero.kinnunen@vaisala.com>

Co-authored-by: Tero Kinnunen <tero.kinnunen@vaisala.com>
2021-12-14 18:00:28 -08:00
Christopher Dunn
5defb4ed1a
Merge pull request #1351 from open-source-parsers/drop-deprecation-warnings
Drop compile-time deprecation warning
2021-11-03 12:53:28 -05:00
Christopher Dunn
c4904b2c0d Bump micro version 2021-11-03 11:39:54 -05:00
Christopher Dunn
54a5432c01 Drop compile-time deprecation warning 2021-11-03 11:35:15 -05:00
Christopher Dunn
b22302e560
Merge pull request #1347 from fjtrujy/position_independent_code
Fix POSITION_INDEPENDENT_CODE
2021-11-03 10:41:12 -05:00
Francisco Javier Trujillo Mata
29f9853455 Fix cmake config for POSITION_INDEPENDENT_CODE enabling it just when BUILD_SHARED_LIBS is ON 2021-10-29 10:41:41 +02:00
Christopher Dunn
fa747b1ae3 clang-format is not available by default 2021-10-28 13:38:53 -05:00
Alex Beregszaszi
94a6220f7c
Document skipBom in CharReaderBuilder (#1332) 2021-09-21 01:55:25 -04:00
Jack Ullery
c39fbdac0f
minor fix for code examples (#1317) 2021-08-12 17:08:46 -04:00
Frank Dana
65bb1b1c1d
CMake: Remove ancient version checks (#1299)
The minimum version for the project is CMake 3.8.0, so there's
no point in keeping legacy code for pre-3.0 or pre-2.8 CMake.
2021-06-23 11:03:44 -07:00
Mariusz Glebocki
375a1119f8
Add support for Bazel build system (#1275)
Co-authored-by: Christopher Dunn <cdunn2001@gmail.com>
2021-05-05 21:03:02 -05:00
SpaceIm
5fabc5e6d2
conversion errors only if warnings as errors enabled (#1284) 2021-05-05 20:55:25 -05:00
Christopher Dunn
ed1ab7ac45 Avoid getline(s, EOF)
Fixes #1288
2021-05-05 01:21:22 -05:00
Christopher Dunn
bb34617267 Merge branch 'cmake-config-improvements' #1271
(creating merge-commit late, after accidental "rebase-and-merge")
2021-05-04 23:49:10 -05:00
Sergey Rachev
993e4e2828 - isolated namespace targets into separate file 2021-05-04 23:34:28 -05:00
Sergey Rachev
2af4a4c6c8 - workaround for CMake < 3.18 ALIAS target limitation to not point to non-GLOBAL IMPORTED target 2021-05-04 23:34:28 -05:00
Sergey Rachev
a3914b792f - narrowed lines to be aligned with overall file line width 2021-05-04 23:34:28 -05:00
Sergey Rachev
cee42e0bd7 - empty line at end of file 2021-05-04 23:34:28 -05:00
Sergey Rachev
62f3e03475 - declare namespaced export target to simplify the library usage
When the static libary is available use it as exported alias, otherwise use shared library. Cmake takes care about import library when Windows platform DLL is used
2021-05-04 23:34:28 -05:00
Sergey Rachev
b640795571 - exported targets go to separate generated file and package config file generated from template to use automatic package resolving and resolution logic
CMake  provides helpers to generate config file. Generated config file has usefull macro check_required_components() to set necessary variables like PackageName_FOUND if requirements has been satisfied. An absence of dedicated config file confuses user project as necessary variables are not set.
2021-05-04 23:34:28 -05:00
Billy Donahue
94cda30dbd
Rearrange Comments::set (#1278)
* slightly optimize Comments::set

Avoid allocation if the set is going to be rejected anyway.

Prototype suggestion from #1277 review thread
2021-03-18 05:22:35 -04:00
PinkD
1ee39a6752 add comment for emitUTF8 in header 2021-03-06 01:33:15 -06:00
Billy Donahue
b1bd848241
fix sign-conversion warning (#1268)
Use ArrayIndex instead of int.  Fixes #1266
2021-02-20 16:07:34 -05:00
Sven Köhler
09c5ecd84f only append _static suffix for microsoft toolchains 2021-02-20 13:40:52 -06:00
Billy Donahue
fda274ddd2
Fix Value::resize to fill all array elements (#1265)
* Fix Value::resize to fill all array elements

Fixes #1264
2021-02-09 23:50:37 -05:00
Yixing Lao
da9e17d257 allow selection of Windows MSVC runtime 2021-02-03 14:29:20 -06:00
Derick Vigne
ac2870298e Fixed pkg-config Version 2021-02-03 13:40:56 -06:00
GermanAizek
c9a976238b minor fixes for 64 bits and refactor code 2021-01-15 11:49:10 -05:00
Riccardo Corsi
eab8ebe644 Disable also Visual Studio warning C4275 (std::exception used as base class in dll-interface class) when building as DLL and JSONCPP_DISABLE_DLL_INTERFACE_WARNING is defined. 2021-01-10 00:50:48 -06:00