Skip to content
Commit a6540164 authored by Marc Herbert's avatar Marc Herbert Committed by Fabio Baltieri
Browse files

util.h: #include zephyr/toolchain.h, not zephyr/toolchain/common.h



Commit 9c5dafed ("util: add type checking to CONTAINER_OF") made
`util.h` #include `toolchain/common.h` in order to get `BUILD_ASSERT()`
used by CONTAINER_OF_VALIDATE() when compiling C code.

However `toolchain/common.h` is not supposed to be included directly but
indirectly through `toolchain/<your_toolchain>.h` and in a very specific
order.

The direct inclusion caused the following warning when compiling C++:

```
toolchain/gcc.h:87: error: "ZRESTRICT" redefined [-Werror]
   87 | #define ZRESTRICT __restrict
      |
In file included from include/zephyr/sys/util.h:18:
note: this is the location of the previous definition:
include/zephyr/toolchain/common.h:33:
   33 | #define ZRESTRICT
```

Fix this issue #62464 by including `zephyr/toolchain.h` instead, as done
by 350 other files.

Fixes commit 9c5dafed ("util: add type checking to CONTAINER_OF")

Signed-off-by: default avatarMarc Herbert <marc.herbert@intel.com>
parent 7b8b5620
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment