Commit Graph

1389 Commits (master)

Author SHA1 Message Date
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
Billy Donahue fe9663e7ed `Json::ValueIterator` operators `*` and `->` need to be const
Fixes #1249.
2021-01-10 00:40:21 -06:00
Christopher Dunn 5c4219b8ae Update version in dox
We should automate this, but for now we can at least update:

    make -f dev.makefile update-version
    make -f dev.makefile dox
    # Then, go to jsoncpp-doc repo, add, and push.

* https://github.com/open-source-parsers/jsoncpp-docs/issues/2
2021-01-10 00:18:59 -06:00
Christopher Dunn be4a512887
Remove trailing space characters (#1256)
Also add two newlines

(rebased from `aaronfranke/formatting`)

resolves #1220

Co-authored-by: Aaron Franke <arnfranke@yahoo.com>
2021-01-09 22:39:07 -06:00
Lei 940982438d
Fix a precision bug of valueToString, prevent to give an error result… (#1246)
* Fix a precision bug of valueToString, prevent to give an error result on input of wanted precision 0 and a double value which end of zero before decimal point ,such as 1230.01,12300.1;
Add test cases for double valueToString with precision 0;

* Delete a test case with platform differences in the previous commit

* Fix clang-format.

* Fix clang-format!

Co-authored-by: lilei <dlilei@126.com>
2020-12-15 11:08:05 -08:00
Hans Johnson 8954092f0a
ENH: Prevent cmake in source builds (#1091)
* ENH: Prevent cmake in source builds

Building directly inside the root of the source tree
can cause problems where the build intermediate files
overwrite or conflict with the intended source code
files.

This modification identifies this problem and
issues failure messages and suggestions to over
come the problem with more robust build suggestion.

Co-authored-by: Jordan Bayles <jophba@chromium.org>
2020-11-06 13:35:51 -08:00
Marcel Opprecht ceae0e3867
Fix clang-tidy warnings (#1231)
* Fix clang-tidy warnings

Signed-off-by: Marcel Opprecht <marcel.opprecht@scandit.com>

* Fixup/clang-format

Co-authored-by: Marcel Opprecht <marcel.opprecht@scandit.com>
Co-authored-by: Jordan Bayles <jophba@chromium.org>
2020-11-06 13:22:26 -08:00
Christian Ledergerber 30170d651c Fix c++20 compilation problem for clang10 and fix potential bug due to compiler optimization 2020-11-02 10:51:39 -05:00
Christopher Dunn 5f4e10462f
Merge pull request #1229 from open-source-parsers/pypi
Try meson/ninja from pypi
2020-10-10 11:30:19 -05:00
Christopher Dunn bb9db78fe2 Do not allow failures on osx 2020-10-10 11:20:19 -05:00
Christopher Dunn 1664b6bbf8 Try meson/ninja from pypi
This lets us simplify linux a little.

However, we still want to test cmake, so there is only so much we
can simplify.

For OSX, we still need `clang-format` from homebrew.

* Add PYTHONUSERBASE/bin to PATH for linux
2020-10-10 11:19:28 -05:00
Christopher Dunn 5d1cb30e40 clang-format 2020-10-10 11:10:09 -05:00
Ben Boeckel c60ebf787a test: ensure the version numbers agree 2020-10-03 23:09:25 -05:00
Ben Boeckel 72db276986 version.h: fix the version number in the header
Fixes: #1224
2020-10-03 23:09:25 -05:00
Jordan Bayles 9059f5cad0
Roll version numbers for 1.9.4 release (#1223) 2020-09-25 19:19:16 -07:00
Daniel Engberg 45733df96c meson: Don't specifically look for python3
Not all distributions provide Python as python3 and as Meson already depends on 3.5+ just use what Meson uses.
References: https://mesonbuild.com/Getting-meson.html
https://mesonbuild.com/Python-module.html#find_installation

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
2020-09-01 23:02:57 -05:00
Ben Wolsieffer 5be07bdc5e
Fix generation of pkg-config file with absolute includedir/libdir. (#1199) 2020-07-20 20:36:30 +08:00
Chen bf0cfa5b46
hot fix for building static lib (#1203)
Fix #1197
2020-07-14 16:37:22 +08:00
Chen cfc1ad72ad
Enhance cmake script (#1197)
* BUILD_TYPE corresponds to Release/Debug
   but LIB_TYPE corresponds to shared/static.

* Add support to build shared, static and object lib at the same time.
2020-07-13 20:33:58 +08:00