Skip to content

hwspinlock context initializer build warning #98961

@MaureenHelm

Description

@MaureenHelm

Describe the bug

A build warning occurs in the hardware spinlock driver context initializer, HWSPINLOCK_CTX_INITIALIZER when struct k_spinlock has no members. This happens with the following Kconfig settings:

CONFIG_SMP=n
CONFIG_SPIN_VALIDATE=n
CONFIG_CPP=n

Regression

  • This is a regression.

Steps to reproduce

The issue was observed on an out-of-tree Arm Cortex-M board. Unfortunately there are no in-tree usages of HWSPINLOCK_CTX_INITIALIZER, so it currently isn't possible to reproduce upstream.

Relevant log output

In file included from /home/mhelm/zephyrproject/zephyr/include/zephyr/sys/util_macro.h:34,
                 from /home/mhelm/zephyrproject/zephyr/include/zephyr/sys/util.h:17,
                 from /home/mhelm/zephyrproject/zephyr/include/zephyr/sys/atomic.h:18,
                 from /home/mhelm/zephyrproject/zephyr/include/zephyr/kernel_includes.h:25,
                 from /home/mhelm/zephyrproject/zephyr/include/zephyr/kernel.h:17,
<snip>
/home/mhelm/zephyrproject/zephyr/include/zephyr/drivers/hwspinlock.h:76:26: warning: excess elements in struct initializer
   76 |                 .lock = {0},                                                                       \
      |                          ^

Impact

Annoyance – Minor irritation; no significant impact on usability or functionality.

Environment

  • OS: Linux
  • Toolchain: zephyr-sdk-0.17.4
  • Tag: v4.3.0-rc2

Additional Context

No response

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions