Skip to content

Conversation

@tpambor
Copy link
Contributor

@tpambor tpambor commented Jun 17, 2025

The macro SHELL_SUBCMD_SET_END was defined as {NULL}, which triggers a -Wmissing-field-initializers warning

shell.c:100:5: warning: missing field 'help' initializer [-Wmissing-field-initializers]
  100 |     SHELL_SUBCMD_SET_END
      |     ^
zephyr/include/zephyr/shell/shell.h:513:35: note: expanded from macro 'SHELL_SUBCMD_SET_END'
  513 | #define SHELL_SUBCMD_SET_END {NULL}

Replacing {NULL} with {0} silences this warning.

Usage of {0} is also a common pattern across the zephyr codebase.

$ grep -R "{0}" . | wc -l
1756

$ grep -R "{NULL}" . | wc -l
14

The macro SHELL_SUBCMD_SET_END was defined as {NULL}, which triggers a
-Wmissing-field-initializers warning due to the missing 'help' field in
the shell_cmd struct. Replacing {NULL} with {0} silences the warning.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
@github-actions github-actions bot added size: XS A PR changing only a single line of code area: Shell Shell subsystem labels Jun 17, 2025
@github-actions github-actions bot requested review from carlescufi and jakub-uC June 17, 2025 10:26
@sonarqubecloud
Copy link

@dkalowsk dkalowsk merged commit 15ce6e0 into zephyrproject-rtos:main Jun 25, 2025
27 checks passed
@ghost ghost mentioned this pull request Jul 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Shell Shell subsystem size: XS A PR changing only a single line of code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants