Skip to content

Commit 7a8f165

Browse files
committed
toolchain: Add the TOOLCHAIN_DEPRECATED macro
Add the `TOOLCHAIN_DEPRECATED` macro to encapsulate the `__deprecated_version` implementation. It's provided by both LLVM and GCC compilers. Signed-off-by: James Roy <rruuaanng@outlook.com>
1 parent c109eba commit 7a8f165

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

doc/releases/release-notes-4.2.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ New APIs and options
116116
* :kconfig:option:`CONFIG_SRAM_VECTOR_TABLE` moved from ``zephyr/Kconfig.zephyr`` to
117117
``zephyr/arch/Kconfig`` and added dependencies to it.
118118

119+
* Toolchain
120+
121+
* :c:macro:`TOOLCHAIN_DEPRECATED`
122+
119123
* Kernel
120124

121125
* :c:macro:`K_TIMEOUT_ABS_SEC`

include/zephyr/toolchain.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,18 @@
318318
#define TOOLCHAIN_ENABLE_IAR_WARNING(warning)
319319
#endif
320320

321+
/**
322+
* @def TOOLCHAIN_DEPRECATED
323+
* @brief Marks a function or symbol as deprecated as of @p removal_version.
324+
*
325+
* @param removal_version Version of planned removal
326+
*/
327+
#if defined(__GNUC__) || defined(__llvm__)
328+
#define TOOLCHAIN_DEPRECATED(removal_version) __deprecated_version(removal_version)
329+
#else
330+
#define TOOLCHAIN_DEPRECATED(removal_version)
331+
#endif
332+
321333
/*
322334
* Ensure that __BYTE_ORDER__ and related preprocessor definitions are defined,
323335
* and that they match the Kconfig option that is used in the code itself to

0 commit comments

Comments
 (0)