nrfx: drivers: avoid using c23 unnamed parameters#144
Open
ItsShunya wants to merge 1 commit intoNordicSemiconductor:masterfrom
Open
nrfx: drivers: avoid using c23 unnamed parameters#144ItsShunya wants to merge 1 commit intoNordicSemiconductor:masterfrom
ItsShunya wants to merge 1 commit intoNordicSemiconductor:masterfrom
Conversation
Using C23 unnamed parameters for function definitions breaks C11/C17 compatibility.
nika-nordic
reviewed
Feb 27, 2026
Contributor
nika-nordic
left a comment
There was a problem hiding this comment.
left some formatting-related comments.
We have also added this "imperfection" to the scope of next nrfx release, so you can also disregard this review and wait for next nrfx release. Thanks!
| @@ -97,7 +97,7 @@ extern "C" { | |||
| #define NRFX_RELEASE_VER_MICRO 1 | |||
|
|
|||
| /** @brief IRQ handler type. */ | |||
Contributor
There was a problem hiding this comment.
p_context needs documentation in Doxygen block, as done for driver-specific handlers
| #define NRFX_INSTANCE_IRQ_HANDLER_DEFINE(periph_name_small, inst_idx, p_instance) \ | ||
| void NRFX_CONCAT(nrfx_, periph_name_small, _, inst_idx, _irq_handler)(void *) \ | ||
| void NRFX_CONCAT(nrfx_, periph_name_small, _, inst_idx, _irq_handler)(void * p_context) \ | ||
| { \ |
Contributor
There was a problem hiding this comment.
subsequent \ should be aligned to match column of \ in the modified line (also in the line above)
| */ | ||
| #define _NRFX_IRQ_HANDLER(periph_name, prefix, i, periph_name_small) \ | ||
| void NRFX_CONCAT(nrfx_, periph_name_small, _, prefix, i, _irq_handler)(void *) \ | ||
| void NRFX_CONCAT(nrfx_, periph_name_small, _, prefix, i, _irq_handler)(void * p_context) \ |
Contributor
There was a problem hiding this comment.
as above - \ should be aligned to the same column
|
Hi @ItsShunya, this issue has been fixed with the new nrfx 4.2.0 release. Please check if this answers your problem. |
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.
During the 4.0.0 update, many macros to generate IRQ handlers had their function signature updated to accept a pointer as parameter, which is typically used in some vector tables for passing some context.
The way it was done was leaving the parameter unnamed in the macros, which is a feature added in C23. This breaks compatibility with older C versions. My suggestion is to simply add
p_contextto keep a name for the parameter so nrfx does not complain in