cmake: fix macro names for nodiscard/unreachable feature flags#385
Merged
PJK merged 1 commit intoPJK:masterfrom Feb 8, 2026
Merged
cmake: fix macro names for nodiscard/unreachable feature flags#385PJK merged 1 commit intoPJK:masterfrom
PJK merged 1 commit intoPJK:masterfrom
Conversation
CMake defined _CBOR_HAS_* while headers check CBOR_HAS_*, so the feature flags never took effect. Align the CMake definitions with the header checks.
ac38e64 to
784ff8d
Compare
Contributor
Author
|
The bazel test failure seems unrelated to this PR. |
Contributor
Author
|
It’s Bazel 9 behavior: cc_test is no longer a native rule and must be loaded from cc:defs.bzl. In examples/bazel/src/BUILD it’s used without being loaded, so Bazel errors out and then can’t find //src:hello. I'll leave that to another PR. |
Owner
|
Thank you! |
bmwiedemann
pushed a commit
to bmwiedemann/openSUSE
that referenced
this pull request
May 8, 2026
https://build.opensuse.org/request/show/1351351 by user dirkmueller + dimstar_suse - update to 0.14.0: * Fix NULL dereference in `cbor_move`, `cbor_serialized_size`, and `cbor_serialize_tag` when a tag has no item set (reported by Benjamin608608) * Document large-allocation risk in `cbor_load` and clarify test-only CMake flags * Fix NULL dereference in `cbor_copy`/`cbor_copy_definite` on allocation failure (reported by Benjamin608608) * Explicitly guard against `size * 2` overflow in `cbor_builder_map_start_callback` (reported by Benjamin608608) * Only generate CMake coverage build targets when explicitly enabled * [Fix CMake feature macro names and ensure `_CBOR_NODISCARD` is defined with `[[nodiscard]]`](PJK/libcbor#385) * Fix integer overflow in `cbor_copy_definite()` when accumulating indefi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix CMake feature flag macro names to match the header checks.
CMake defined
_CBOR_HAS_*while headers checkCBOR_HAS_*, so thefeature flags for
[[nodiscard]]and__builtin_unreachable()nevertook effect. This aligns the definitions.
Checklist
I have added testsI have updated the documentationAre there any breaking changes?If yes: I have marked them in the CHANGELOG (example)Does this PR introduce any platform specific code?Security: Does this PR potentially affect security?Performance: Does this PR potentially affect performance?