From 82655b6dfb85033908892cd3023b5724560281e9 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 de2713f5ad425..e68a4e141c657 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 defd3b943092f90095a84bde0c5394b8a523b2a8 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 e6a3cb96d3b29..e5fe19e821d85 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 04a3d258a3a6bcc824a3e74b00695372b4984c94 Mon Sep 17 00:00:00 2001 From: James Roy Date: Wed, 16 Jul 2025 15:19:11 +0800 Subject: [PATCH 3/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 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/releases/release-notes-4.3.rst b/doc/releases/release-notes-4.3.rst index 71aea3a12018e..4fa3584a07d32 100644 --- a/doc/releases/release-notes-4.3.rst +++ b/doc/releases/release-notes-4.3.rst @@ -63,6 +63,11 @@ New APIs and options like you need to add more details, add them in the API documentation code instead. +* Toolchain + + * :c:macro:`__deprecated_version` + + New Boards ********** From 927ad956eefc39e923df5add52cd49c1c54dfd84 Mon Sep 17 00:00:00 2001 From: James Roy Date: Wed, 16 Jul 2025 15:19:30 +0800 Subject: [PATCH 4/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 | 2 +- 2 files changed, 2 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..958457dd9848e 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh @@ -58,7 +58,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 \