nrfx: drivers: avoid using c23 unnamed parameters#144
Conversation
Using C23 unnamed parameters for function definitions breaks C11/C17 compatibility.
|
|
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. */ | |||
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) \ | ||
| { \ |
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) \ |
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. |
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