Skip to content

Commit

Permalink
sys: device_mmio.h replace <toolchain/common.h> with <toolchain.h>
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
marc-hb authored and nashif committed Jan 7, 2022
1 parent bd8cc59 commit 61fe69d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/sys/device_mmio.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#ifndef ZEPHYR_INCLUDE_SYS_DEVICE_MMIO_H
#define ZEPHYR_INCLUDE_SYS_DEVICE_MMIO_H

#include <toolchain/common.h>
#include <toolchain.h>
#include <linker/sections.h>

/**
Expand Down

0 comments on commit 61fe69d

Please sign in to comment.