-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
sys: device_mmio.h remove #include <toolchain/common.h> #41555
Conversation
Warning found in unrelated https://github.com/zephyrproject-rtos/zephyr/runs/4697416054 / #41553 |
6667731
to
eb2a7c9
Compare
This adds to the macros for device MMIO declaration so they can be put into boot or pinned linker sections as needed. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, this change doesn't really resolve the original problem. First, <sys/device_mmio.h>
seems to be a header that is not self-contained (e.g., relies on DT API but doesn't include <devicetree.h>
). Second, is <toolchain/common.h>
really needed? Removing it seems to resolve the issue, too. Related issue: #41543
eb2a7c9
to
4c2fcd6
Compare
@@ -15,7 +15,6 @@ | |||
#ifndef ZEPHYR_INCLUDE_SYS_DEVICE_MMIO_H | |||
#define ZEPHYR_INCLUDE_SYS_DEVICE_MMIO_H | |||
|
|||
#include <toolchain/common.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file seems to make use of ARG_UNUSED
, <toolchain.h>
is probably the right header then?
As mentioned in the commit message, this In this particular test
Yes that's why I copied you :-) |
In include/sys/device_mmio.h, replacing <toolchain/common.h> fixes the following warning: $ west build -b qemu_x86 tests/arch/x86/static_idt/ In file included from zephyr/include/toolchain.h:50, from zephyr/include/linker/section_tags.h:12, from zephyr/include/linker/sections.h:132, from zephyr/include/sys/device_mmio.h:19, from zephyr/include/drivers/interrupt_controller/loapic.h:14, from zephyr/include/drivers/interrupt_controller/sysapic.h:10, from zephyr/include/arch/x86/arch.h:231, from zephyr/include/arch/cpu.h:15, from zephyr/tests/arch/x86/static_idt/src/test_stubs.S:17: zephyr/include/toolchain/gcc.h:61: error: BUILD_ASSERT redefined [-Werror] 61 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert(EXPR, "" MSG) | In file included from zephyr/include/sys/device_mmio.h:18, from zephyr/include/drivers/interrupt_controller/loapic.h:14, from zephyr/include/drivers/interrupt_controller/sysapic.h:10, from zephyr/include/arch/x86/arch.h:231, from zephyr/include/arch/cpu.h:15, from zephyr/tests/arch/x86/static_idt/src/test_stubs.S:17: zephyr/include/toolchain/common.h:165: note: this is the location of the previous definition 165 | #define BUILD_ASSERT(EXPR, MSG...) \ <toolchain.h> provides a compiler-specific BUILD_ASSERT. <toolchain/common.h> provides a generic, fallback BUILD_ASSERT and should probably never be included directly. Thanks to Gerard Marull-Paretas for recommending this fix. Related to commit af20208 ("devices: mark device MMIO declarations to boot/pinned sections") that added #include <linker/sections.h> Signed-off-by: Marc Herbert <marc.herbert@intel.com>
4c2fcd6
to
ee16aea
Compare
Slightly different and interesting warning reproduction when removing Just another datapoint / faint glow in the big and scary
|
Twister fix that would have caught this earlier: |
v1: re-order
#include <toolchain/common.h>
v2: remove
#include <toolchain/common.h>
v3: replace
#include <toolchain/common.h>
with#include <toolchain.h>
Any version fixes the following warning:
Thanks to Gerard Marull-Paretas for recommending v3
Related to commit af20208 ("devices: mark device MMIO declarations to
boot/pinned sections") that added
#include <linker/sections.h>
#include <toolchain/common.h>
was here since the dawn of time (= commit db0ca08)Signed-off-by: Marc Herbert marc.herbert@intel.com