From b1f1bdcc78a8e4dff8ca1c85d30fbe556afad474 Mon Sep 17 00:00:00 2001 From: James Roy Date: Wed, 16 Jul 2025 15:18:21 +0800 Subject: [PATCH 1/4] toolchain: gcc: Add the __deprecated_version macro Add the `__deprecated_version` macro to print version information when deprecation warnings are triggered. Signed-off-by: James Roy --- include/zephyr/toolchain/gcc.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/zephyr/toolchain/gcc.h b/include/zephyr/toolchain/gcc.h index b6dc87283b817..0eb4f9c89b72f 100644 --- a/include/zephyr/toolchain/gcc.h +++ b/include/zephyr/toolchain/gcc.h @@ -286,6 +286,11 @@ do { \ */ #endif +#ifndef __deprecated_version +#define __deprecated_version(version) \ + __attribute__((deprecated("planned removal in v" #version))) +#endif + #ifndef __attribute_const__ #define __attribute_const__ __attribute__((__const__)) #endif From beb00cc634e2e8c2cab9310a1acf7a831f6b0a64 Mon Sep 17 00:00:00 2001 From: James Roy Date: Wed, 16 Jul 2025 15:18:49 +0800 Subject: [PATCH 2/4] toolchain: iar: Add the __deprecated_version macro Add the `__deprecated_version` macro to print version information when deprecation warnings are triggered. Signed-off-by: James Roy --- include/zephyr/toolchain/iar/iccarm.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/zephyr/toolchain/iar/iccarm.h b/include/zephyr/toolchain/iar/iccarm.h index 3e9c79e0d693a..99d7e2cf1fd46 100644 --- a/include/zephyr/toolchain/iar/iccarm.h +++ b/include/zephyr/toolchain/iar/iccarm.h @@ -187,6 +187,11 @@ do { \ #define __deprecated __attribute__((deprecated)) #endif +#ifndef __deprecated_version +#define __deprecated_version(version) \ + __attribute__((deprecated("planned removal in v" #version))) +#endif + #define FUNC_NO_STACK_PROTECTOR _Pragma("no_stack_protect") #ifndef __attribute_const__ From 8d96ad4c0e32f39f9516b5fb5c34215764922ebb Mon Sep 17 00:00:00 2001 From: James Roy Date: Wed, 8 Oct 2025 13:47:42 +0800 Subject: [PATCH 3/4] scripts: Add __deprecated_version to the checkpatch checklist Add macro __deprecated_version to the checklists of `scripts/checkpatch.pl` and `scripts/tags.sh`. Signed-off-by: James Roy --- scripts/checkpatch.pl | 1 + scripts/tags.sh | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 8f964bc654b2e..257f846ccd0a6 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -394,6 +394,7 @@ sub hash_show_words { __pure| __noclone| __deprecated| + __deprecated_version| __read_mostly| __ro_after_init| __kprobes| diff --git a/scripts/tags.sh b/scripts/tags.sh index 2a3dd16494a8a..1e7a1c6472247 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh @@ -1,4 +1,6 @@ #!/bin/sh +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: Copyright The Zephyr Project Contributors # Generate tags or cscope files # Usage tags.sh # @@ -58,7 +60,7 @@ exuberant() -I __initdata,__exitdata,__initconst, \ -I __initdata_memblock \ -I __refdata,__attribute,__maybe_unused,__always_unused \ - -I __acquires,__releases,__deprecated \ + -I __acquires,__releases,__deprecated,__deprecated_version \ -I __read_mostly,__aligned,____cacheline_aligned \ -I ____cacheline_aligned_in_smp \ -I __cacheline_aligned,__cacheline_aligned_in_smp \ From 2a6ace8161d2ffb171d30bfffed0d26c2e1e10e2 Mon Sep 17 00:00:00 2001 From: James Roy Date: Wed, 8 Oct 2025 13:47:54 +0800 Subject: [PATCH 4/4] doc: release: Add a release entry Add `__deprecated_version` macro to the Toolchain entry list. Signed-off-by: James Roy --- doc/releases/release-notes-4.3.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/releases/release-notes-4.3.rst b/doc/releases/release-notes-4.3.rst index 8a3692e6aea90..5669394ef7974 100644 --- a/doc/releases/release-notes-4.3.rst +++ b/doc/releases/release-notes-4.3.rst @@ -261,6 +261,10 @@ New APIs and options * :kconfig:option:`CONFIG_TASK_WDT_DUMMY` +* Toolchain + + * :c:macro:`__deprecated_version` + .. zephyr-keep-sorted-stop New Boards