Skip to content

Conversation

raffi-g
Copy link
Contributor

@raffi-g raffi-g commented Oct 16, 2025

I adjusted GET_ARG_N and GET_ARGS_LESS_N to use UTIL_CAT instead of simple concatenation. This allows to use a macro as the argument N instead of only literal numbers. So for example this would be possible now:

#define CONFIG_BAUDRATE_INDEX 3 /* from kconfig */
uint32_t baudrate = GET_ARG_N(CONFIG_BAUDRATE_INDEX, 9600, 19200, 38400, 57600);
/* baudrate == 38400 */

I also adjusted the unit tests to showcase this. (I can also revert this part, if it is not wished to have this in the tests.)

@zephyrbot zephyrbot added area: Tests Issues related to a particular existing or missing test area: Testsuite Testsuite area: Base OS Base OS Library (lib/os) labels Oct 16, 2025
Adjusted GET_ARG_N and GET_ARGS_LESS_N to use UTIL_CAT instead of simple
concatenation. This allows to use a macro as the argument N instead of
only numbers.

Adjusted the unit tests to showcase this.

Signed-off-by: Greter Raffael <[email protected]>
Copy link

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

Labels

area: Base OS Base OS Library (lib/os) area: Tests Issues related to a particular existing or missing test area: Testsuite Testsuite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants