Skip to content

Conversation

@maribu
Copy link
Member

@maribu maribu commented Dec 19, 2025

Contribution description

This brings the compile time configuration of assert in line with current expectations:

  1. Use a CONFIG_ prefix
  2. The value needs to be defined as 1 to enable a feature. When undefined or defined as 0, the feature is disabled.

To not break existing code, backward compatibility is added. If the old macros are used, a notice about the use of the deprecated macro and what to use instead is printed.

Testing procedure

Adding CFLAGS += -DDEBUG_ASSERT_VERBOSE should still give verbose assertion messages, but also print:

core/lib/assert.c:31:11: note: '#pragma message: Macro -DDEBUG_ASSERT_VERBOSE is deprecated, use -DCONFIG_ASSERT_VERBOSE=1 instead'
   31 | #  pragma message "Macro -DDEBUG_ASSERT_VERBOSE is deprecated, use -DCONFIG_ASSERT_VERBOSE=1 instead"
      |           ^~~~~~~

Adding CFLAGS += -DCONFIG_ASSERT_VERBOSE=1 should give verbose asserts, e.g.

2025-12-19 17:09:55,674 # main(): This is RIOT! (Version: 2026.01-devel-290-g56b29-assert/use-config-prefix)
2025-12-19 17:09:55,675 # examples/basic/hello-world/main.c:25 => FAILED ASSERTION.

Defining it to 0 or not defining it should give compact asserts instead, e.g.

2025-12-19 17:11:51,901 # main(): This is RIOT! (Version: 2026.01-devel-290-g56b29-assert/use-config-prefix)
2025-12-19 17:11:51,901 # 0x4025f5 => FAILED ASSERTION.

Note

If testing on native*: In makefiles/arch/native.inc.mk:129 verbose assertions are forced (already in master).

Issues/PRs references

None

This brings the compile time configuration of assert in line with
current expectations:

1. Use a `CONFIG_` prefix
2. The value needs to be defined as `1` to enable a feature. When
   undefined or defined as `0`, the feature is disabled.

To not break existing code, backward compatibility is added. If the
old macros are used, a notice about the use of the deprecated macro
and what to use instead is printed.
@maribu maribu requested a review from miri64 as a code owner December 19, 2025 16:15
@maribu maribu added the Area: core Area: RIOT kernel. Handle PRs marked with this with care! label Dec 19, 2025
@maribu maribu added the Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation label Dec 19, 2025
@maribu maribu added Process: API change Integration Process: PR contains or issue proposes an API change. Should be handled with care. CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Process: needs >1 ACK Integration Process: This PR requires more than one ACK labels Dec 19, 2025
@github-actions github-actions bot added Platform: native Platform: This PR/issue effects the native platform Area: tests Area: tests and testing framework Area: build system Area: Build system Platform: ESP Platform: This PR/issue effects ESP-based platforms Area: cpu Area: CPU/MCU ports Area: sys Area: System Area: examples Area: Example Applications Process: missing approvals Integration Process: PR needs more ACKS (handled by action) labels Dec 19, 2025
@riot-ci
Copy link

riot-ci commented Dec 19, 2025

Murdock results

✔️ PASSED

98879de core/lib: control assert with CONFIG_* macros

Success Failures Total Runtime
10967 0 10968 13m:51s

Artifacts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: build system Area: Build system Area: core Area: RIOT kernel. Handle PRs marked with this with care! Area: cpu Area: CPU/MCU ports Area: examples Area: Example Applications Area: sys Area: System Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ESP Platform: This PR/issue effects ESP-based platforms Platform: native Platform: This PR/issue effects the native platform Process: API change Integration Process: PR contains or issue proposes an API change. Should be handled with care. Process: missing approvals Integration Process: PR needs more ACKS (handled by action) Process: needs >1 ACK Integration Process: This PR requires more than one ACK Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants