Skip to content

cmake: fix macro names for nodiscard/unreachable feature flags#385

Merged
PJK merged 1 commit intoPJK:masterfrom
huven:fix-macro-names
Feb 8, 2026
Merged

cmake: fix macro names for nodiscard/unreachable feature flags#385
PJK merged 1 commit intoPJK:masterfrom
huven:fix-macro-names

Conversation

@huven
Copy link
Copy Markdown
Contributor

@huven huven commented Feb 5, 2026

Description

Fix CMake feature flag macro names to match the header checks.
CMake defined _CBOR_HAS_* while headers check CBOR_HAS_*, so the
feature flags for [[nodiscard]] and __builtin_unreachable() never
took effect. This aligns the definitions.

Checklist

  • I have read followed CONTRIBUTING.md
    • I have added tests
    • I have updated the documentation
    • I have updated the CHANGELOG
  • Are 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?

CMake defined _CBOR_HAS_* while headers check CBOR_HAS_*, so the
feature flags never took effect. Align the CMake definitions with
the header checks.
@huven
Copy link
Copy Markdown
Contributor Author

huven commented Feb 5, 2026

The bazel test failure seems unrelated to this PR.

@huven
Copy link
Copy Markdown
Contributor Author

huven commented Feb 5, 2026

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.

@PJK PJK merged commit 432c95c into PJK:master Feb 8, 2026
14 of 16 checks passed
@PJK
Copy link
Copy Markdown
Owner

PJK commented Feb 8, 2026

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants