From 07e9394dba661ab776c7f4f7f6debab4312a8c32 Mon Sep 17 00:00:00 2001 From: Stephanos Ioannidis Date: Mon, 9 Sep 2019 21:34:47 +0900 Subject: [PATCH] sys: Explicitly include toolchain.h to check for endianness definitions. This commit adds an explicit inclusion of toolchain.h from byteorder.h. The endianness preprocessor definitions (__BYTE_ORDER__, __ORDER_LITTLE_ENDIAN__, __ORDER_BIG_ENDIAN__) are used by byteorder.h; these being not defined can easily go unnoticed and cause unexpected behaviours, as detailed in PR #18922. toolchain.h ensures that these preprocessor definitions are defined and *must* be included in a file that uses these definitions. Signed-off-by: Stephanos Ioannidis --- include/sys/byteorder.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/sys/byteorder.h b/include/sys/byteorder.h index d98c16bc4bc..1c329666075 100644 --- a/include/sys/byteorder.h +++ b/include/sys/byteorder.h @@ -14,6 +14,7 @@ #include #include #include +#include /* Internal helpers only used by the sys_* APIs further below */ #define __bswap_16(x) ((u16_t) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)))