Commit c67034e
authored
* ci: suppress Node 20 deprecation and missing python-version warnings
- Injects `FORCE_JAVASCRIPT_ACTIONS_TO_NODE24=true` in all workflows to
opt-in to Node.js 24 and suppress the deprecation warnings from
multiple GitHub Actions.
- Specifies `python-version: '3.x'` for `actions/setup-python@v5` in
`meson.yml` to fix the missing input warning.
* Fix C++11 ABI breakage when compiled with C++17 (#1668)
When JSONCPP_HAS_STRING_VIEW was defined, the library dropped the
`const char*` and `const String&` overloads for `operator[]`, `get`,
`removeMember`, and `isMember`, breaking ABI compatibility for projects
consuming the library with C++11.
This change unconditionally declares and defines the legacy overloads
so they are always exported, restoring compatibility.
* ci: add ABI compatibility matrix workflow
This adds a new GitHub Actions workflow to verify ABI compatibility across C++ standard boundaries. It explicitly tests the scenario where JsonCpp is built with one standard (e.g., C++11) and consumed by an application built with a newer one (e.g., C++23), and vice versa.
To facilitate testing the specific `std::string_view` boundary that is conditionally compiled, a new `stringView` demo application has been added to the `example/` directory and is consumed directly by the CI matrix to ensure standard library symbols link correctly across standard versions, build types (shared/static), and operating systems.
* fix: inline std::string_view methods to prevent ABI breaks
This commit completely eliminates the ABI breakage that occurs across C++ standard boundaries when using `std::string_view`.
Previously, when the library was built with C++17+, CMake would leak `JSONCPP_HAS_STRING_VIEW=1` as a PUBLIC definition. A C++11 consumer would receive this definition, attempt to parse the header, and fail with compiler errors because `std::string_view` is not available in their environment.
Conversely, if the library was built in C++11 (without `string_view` symbols), a C++17 consumer would naturally define `JSONCPP_HAS_STRING_VIEW` based on `__cplusplus` inside `value.h`. The consumer would then call the declared `string_view` methods, resulting in linker errors because the methods weren't compiled into the library.
By moving all `std::string_view` overloads directly into `value.h` as `inline` methods that delegate to the fundamental `const char*, const char*` methods:
1. The consumer's compiler dictates whether the overloads are visible (via `__cplusplus >= 201703L`).
2. The consumer compiles the inline wrappers locally, removing any reliance on the library's exported symbols for `std::string_view`.
3. CMake no longer needs to pollute the consumer's environment with PUBLIC compile definitions.
* run clang format
* finish clang format
1 parent 2c2754f commit c67034e
File tree
7 files changed
+151
-93
lines changed- .github/workflows
- example
- stringView
- include/json
- src/lib_json
7 files changed
+151
-93
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
357 | 357 | | |
358 | 358 | | |
359 | 359 | | |
360 | | - | |
| 360 | + | |
| 361 | + | |
361 | 362 | | |
362 | 363 | | |
363 | 364 | | |
| |||
405 | 406 | | |
406 | 407 | | |
407 | 408 | | |
408 | | - | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
409 | 417 | | |
410 | 418 | | |
411 | 419 | | |
| |||
496 | 504 | | |
497 | 505 | | |
498 | 506 | | |
499 | | - | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
500 | 510 | | |
501 | 511 | | |
502 | 512 | | |
503 | | - | |
504 | | - | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
505 | 520 | | |
506 | 521 | | |
507 | 522 | | |
| |||
516 | 531 | | |
517 | 532 | | |
518 | 533 | | |
519 | | - | |
520 | 534 | | |
521 | 535 | | |
522 | 536 | | |
| |||
533 | 547 | | |
534 | 548 | | |
535 | 549 | | |
536 | | - | |
537 | | - | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
538 | 554 | | |
539 | 555 | | |
540 | 556 | | |
541 | 557 | | |
542 | 558 | | |
543 | 559 | | |
544 | 560 | | |
545 | | - | |
546 | 561 | | |
547 | 562 | | |
548 | 563 | | |
| |||
588 | 603 | | |
589 | 604 | | |
590 | 605 | | |
591 | | - | |
592 | | - | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
593 | 610 | | |
594 | 611 | | |
595 | 612 | | |
596 | 613 | | |
597 | | - | |
598 | 614 | | |
599 | 615 | | |
600 | 616 | | |
601 | 617 | | |
602 | 618 | | |
603 | 619 | | |
604 | 620 | | |
605 | | - | |
606 | | - | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
607 | 625 | | |
608 | 626 | | |
609 | 627 | | |
610 | 628 | | |
611 | | - | |
612 | 629 | | |
613 | 630 | | |
614 | 631 | | |
| |||
622 | 639 | | |
623 | 640 | | |
624 | 641 | | |
625 | | - | |
626 | | - | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
627 | 646 | | |
628 | 647 | | |
629 | 648 | | |
630 | 649 | | |
631 | 650 | | |
632 | 651 | | |
633 | | - | |
634 | 652 | | |
635 | 653 | | |
636 | 654 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | 134 | | |
138 | 135 | | |
139 | 136 | | |
| |||
168 | 165 | | |
169 | 166 | | |
170 | 167 | | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | 168 | | |
175 | 169 | | |
176 | 170 | | |
| |||
198 | 192 | | |
199 | 193 | | |
200 | 194 | | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | 195 | | |
205 | 196 | | |
206 | 197 | | |
| |||
0 commit comments