Skip to content

sw_isr_table: Add braces around subobject #90881

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 3, 2025

Conversation

thughes
Copy link
Contributor

@thughes thughes commented May 30, 2025

When building with clang, it warns:

subsys/mgmt/ec_host_cmd/backends/ec_host_cmd_backend_shi_npcx.c:1000:2:
error: suggest braces around initialization of subobject
[-Werror,-Wmissing-braces]

IRQ_CONNECT(DT_INST_IRQN(0), DT_INST_IRQ(0, priority), shi_npcx_isr,
            DEVICE_DT_INST_GET(0), 0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/zephyr/irq.h:49:2: note: expanded from macro 'IRQ_CONNECT'
ARCH_IRQ_CONNECT(irq_p, priority_p, isr_p, isr_param_p, flags_p)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/zephyr/arch/arm/irq.h:124:2: note: expanded from macro
'ARCH_IRQ_CONNECT'
Z_ISR_DECLARE(irq_p, 0, isr_p, isr_param_p); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/zephyr/sw_isr_table.h:227:2: note: expanded from macro
'Z_ISR_DECLARE'
Z_ISR_DECLARE_C(irq, flags, func, param, __COUNTER__)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0
to see all)
include/zephyr/sw_isr_table.h:218:16: note: expanded from macro
'_Z_ISR_DECLARE_C'
{irq, flags, _MK_ISR_ELEMENT_SECTION(counter)}
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/zephyr/sw_isr_table.h:197:42: note: expanded from macro
'_MK_ISR_ELEMENT_SECTION'
#define _MK_ISR_ELEMENT_SECTION(counter) _MK_ISR_SECTION_NAME(irq,
                                         __FILE__, counter)
                                         ^~~~~~~~~~~~~~~~~~~~~~~~~
include/zephyr/sw_isr_table.h:195:2: note: expanded from macro
'_MK_ISR_SECTION_NAME'
"." Z_STRINGIFY(prefix) "." file "." Z_STRINGIFY(counter)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

When building with clang, it warns:

subsys/mgmt/ec_host_cmd/backends/ec_host_cmd_backend_shi_npcx.c:1000:2:
error: suggest braces around initialization of subobject
[-Werror,-Wmissing-braces]

IRQ_CONNECT(DT_INST_IRQN(0), DT_INST_IRQ(0, priority), shi_npcx_isr,
            DEVICE_DT_INST_GET(0), 0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/zephyr/irq.h:49:2: note: expanded from macro 'IRQ_CONNECT'
ARCH_IRQ_CONNECT(irq_p, priority_p, isr_p, isr_param_p, flags_p)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/zephyr/arch/arm/irq.h:124:2: note: expanded from macro
'ARCH_IRQ_CONNECT'
Z_ISR_DECLARE(irq_p, 0, isr_p, isr_param_p); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/zephyr/sw_isr_table.h:227:2: note: expanded from macro
'Z_ISR_DECLARE'
Z_ISR_DECLARE_C(irq, flags, func, param, __COUNTER__)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0
to see all)
include/zephyr/sw_isr_table.h:218:16: note: expanded from macro
'_Z_ISR_DECLARE_C'
{irq, flags, _MK_ISR_ELEMENT_SECTION(counter)}
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/zephyr/sw_isr_table.h:197:42: note: expanded from macro
'_MK_ISR_ELEMENT_SECTION'
#define _MK_ISR_ELEMENT_SECTION(counter) _MK_ISR_SECTION_NAME(irq,
                                         __FILE__, counter)
                                         ^~~~~~~~~~~~~~~~~~~~~~~~~
include/zephyr/sw_isr_table.h:195:2: note: expanded from macro
'_MK_ISR_SECTION_NAME'
"." Z_STRINGIFY(prefix) "." file "." Z_STRINGIFY(counter)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Tom Hughes <[email protected]>
@thughes thughes force-pushed the push-umymxzkwsuqt branch from cf45ace to 6b6f21e Compare May 30, 2025 17:33
@thughes thughes changed the title sw_isr_table: Fix compilation warning sw_isr_table: Add braces around subobject May 30, 2025
@thughes
Copy link
Contributor Author

thughes commented May 30, 2025

The diff is a bit hard to read, but it's just adding {} around _MK_ISR_ELEMENT_SECTION(counter). The whitespace and formatting changes were required by the clang-format check.

Copy link

@thughes
Copy link
Contributor Author

thughes commented May 30, 2025

@ycsin @kartben No reviewers or assignees were assigned. Could you help me find a reviewer? (I can't modify assignee/reviewer.)

@thughes
Copy link
Contributor Author

thughes commented May 30, 2025

cc @fabiobaltieri

@kartben kartben merged commit 2c851d9 into zephyrproject-rtos:main Jun 3, 2025
33 checks passed
@thughes thughes deleted the push-umymxzkwsuqt branch June 4, 2025 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants