toolchain: do not allow including toolchain-specific headers

Toolchain utilities need to be used through the <zephyr/toolchain.h>
parent header, where the right header is chosen.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
This commit is contained in:
Gerard Marull-Paretas 2023-09-14 11:51:56 +02:00 committed by Carles Cufí
parent aaeb0a672e
commit 6ee650a917
6 changed files with 23 additions and 0 deletions

View file

@ -7,6 +7,9 @@
#ifndef ZEPHYR_INCLUDE_TOOLCHAIN_ARMCLANG_H_
#define ZEPHYR_INCLUDE_TOOLCHAIN_ARMCLANG_H_
#ifndef ZEPHYR_INCLUDE_TOOLCHAIN_H_
#error Please do not include toolchain-specific headers directly, use <zephyr/toolchain.h> instead
#endif
#include <zephyr/toolchain/llvm.h>

View file

@ -6,6 +6,11 @@
#ifndef ZEPHYR_INCLUDE_TOOLCHAIN_COMMON_H_
#define ZEPHYR_INCLUDE_TOOLCHAIN_COMMON_H_
#ifndef ZEPHYR_INCLUDE_TOOLCHAIN_H_
#error Please do not include toolchain-specific headers directly, use <zephyr/toolchain.h> instead
#endif
/**
* @file
* @brief Common toolchain abstraction

View file

@ -7,6 +7,10 @@
#ifndef ZEPHYR_INCLUDE_TOOLCHAIN_GCC_H_
#define ZEPHYR_INCLUDE_TOOLCHAIN_GCC_H_
#ifndef ZEPHYR_INCLUDE_TOOLCHAIN_H_
#error Please do not include toolchain-specific headers directly, use <zephyr/toolchain.h> instead
#endif
/**
* @file
* @brief GCC toolchain abstraction

View file

@ -7,6 +7,9 @@
#ifndef ZEPHYR_INCLUDE_TOOLCHAIN_LLVM_H_
#define ZEPHYR_INCLUDE_TOOLCHAIN_LLVM_H_
#ifndef ZEPHYR_INCLUDE_TOOLCHAIN_H_
#error Please do not include toolchain-specific headers directly, use <zephyr/toolchain.h> instead
#endif
#define __no_optimization __attribute__((optnone))

View file

@ -8,6 +8,10 @@
#ifndef ZEPHYR_INCLUDE_TOOLCHAIN_MWDT_H_
#define ZEPHYR_INCLUDE_TOOLCHAIN_MWDT_H_
#ifndef ZEPHYR_INCLUDE_TOOLCHAIN_H_
#error Please do not include toolchain-specific headers directly, use <zephyr/toolchain.h> instead
#endif
#ifndef _LINKER
#if defined(_ASMLANGUAGE)

View file

@ -7,6 +7,10 @@
#ifndef ZEPHYR_INCLUDE_TOOLCHAIN_XCC_H_
#define ZEPHYR_INCLUDE_TOOLCHAIN_XCC_H_
#ifndef ZEPHYR_INCLUDE_TOOLCHAIN_H_
#error Please do not include toolchain-specific headers directly, use <zephyr/toolchain.h> instead
#endif
/* toolchain/gcc.h errors out if __BYTE_ORDER__ cannot be determined
* there. However, __BYTE_ORDER__ is actually being defined later in
* this file. So define __BYTE_ORDER__ to skip the check in gcc.h