forked from thesofproject/sof
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rtos: branch compiler_attributes.h for XTOS and Zephyr
Introduce a separate file for Zephyr compiler_attributes.h and move all Zephyr-specific definitions to this file. This is a prerequisite to build with CONFIG_SOF_ZEPHYR_STRICT_HEADERS=y. Link: thesofproject#9015 Signed-off-by: Kai Vehmanen <[email protected]>
- Loading branch information
Showing
2 changed files
with
52 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,50 +5,9 @@ | |
* Author: Karol Trzcinski <[email protected]> | ||
*/ | ||
|
||
#ifdef __ZEPHYR__ | ||
|
||
#include <zephyr/toolchain.h> | ||
|
||
/* Get __sparse_cache and __sparse_force definitions if __CHECKER__ is defined */ | ||
#include <zephyr/debug/sparse.h> | ||
|
||
#else | ||
|
||
#define __sparse_cache | ||
#define __sparse_force | ||
|
||
#ifndef __packed | ||
#define __packed __attribute__((packed)) | ||
#endif | ||
|
||
#ifndef __unused | ||
#define __unused __attribute__((unused)) | ||
#endif | ||
|
||
#endif | ||
|
||
#ifndef __aligned | ||
#define __aligned(x) __attribute__((__aligned__(x))) | ||
#endif | ||
|
||
#ifndef __section | ||
#define __section(x) __attribute__((section(x))) | ||
#endif | ||
|
||
/* The fallthrough attribute is supported since GCC 7.0 | ||
* and Clang 10.0.0. | ||
* | ||
* Note that Clang sets __GNUC__ == 4 so the GCC version | ||
* test will not be true here, and must go through | ||
* the Clang version test. | ||
*/ | ||
#if ((defined(__GNUC__) && (__GNUC__ >= 7)) || \ | ||
(defined(__clang__) && (__clang_major__ >= 10))) && !defined(__CHECKER__) | ||
|
||
#define COMPILER_FALLTHROUGH __attribute__((fallthrough)) | ||
|
||
#else | ||
#ifndef __SOF_COMPILER_ATTRIBUTES_H__ | ||
#define __SOF_COMPILER_ATTRIBUTES_H__ | ||
|
||
#define COMPILER_FALLTHROUGH /* fallthrough */ | ||
|
||
#endif | ||
#endif /* __SOF_COMPILER_ATTRIBUTES_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* SPDX-License-Identifier: BSD-3-Clause | ||
* | ||
* Copyright(c) 2024 Intel Corporation. | ||
*/ | ||
|
||
#ifndef __SOF_COMPILER_ATTRIBUTES_H__ | ||
#define __SOF_COMPILER_ATTRIBUTES_H__ | ||
|
||
#include <zephyr/toolchain.h> | ||
|
||
/* Get __sparse_cache and __sparse_force definitions if __CHECKER__ is defined */ | ||
#include <zephyr/debug/sparse.h> | ||
|
||
#else | ||
|
||
#define __sparse_cache | ||
#define __sparse_force | ||
|
||
#ifndef __packed | ||
#define __packed __attribute__((packed)) | ||
#endif | ||
|
||
#ifndef __unused | ||
#define __unused __attribute__((unused)) | ||
#endif | ||
|
||
#endif | ||
|
||
#ifndef __aligned | ||
#define __aligned(x) __attribute__((__aligned__(x))) | ||
#endif | ||
|
||
#ifndef __section | ||
#define __section(x) __attribute__((section(x))) | ||
#endif | ||
|
||
/* The fallthrough attribute is supported since GCC 7.0 | ||
* and Clang 10.0.0. | ||
* | ||
* Note that Clang sets __GNUC__ == 4 so the GCC version | ||
* test will not be true here, and must go through | ||
* the Clang version test. | ||
*/ | ||
#if ((defined(__GNUC__) && (__GNUC__ >= 7)) || \ | ||
(defined(__clang__) && (__clang_major__ >= 10))) && !defined(__CHECKER__) | ||
|
||
#define COMPILER_FALLTHROUGH __attribute__((fallthrough)) | ||
|
||
#endif /* __SOF_COMPILER_ATTRIBUTES_H__ */ |