diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e38f42de78..6a716a4a659 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -166,7 +166,7 @@ if(CONFIG_COMPILER_WARNINGS_AS_ERRORS) zephyr_link_libraries($) endif() -if(CONFIG_DEPRECATION_TEST) +if(CONFIG_DEPRECATION_TEST OR NOT CONFIG_WARN_DEPRECATED) zephyr_compile_options($<$:$>) zephyr_compile_options($<$:$>) zephyr_compile_options($<$:$>) diff --git a/Kconfig.zephyr b/Kconfig.zephyr index d534c1c7543..8e3934ac746 100644 --- a/Kconfig.zephyr +++ b/Kconfig.zephyr @@ -1021,7 +1021,8 @@ config WARN_DEPRECATED prompt "Warn on deprecated usage" help Print a warning when the Kconfig tree is parsed if any deprecated - features are enabled. + features are enabled, or at compile time, when deprecated macros or + symbols are used. config EXPERIMENTAL bool diff --git a/include/zephyr/toolchain/gcc.h b/include/zephyr/toolchain/gcc.h index fde3b9c0cb7..899e245ed37 100644 --- a/include/zephyr/toolchain/gcc.h +++ b/include/zephyr/toolchain/gcc.h @@ -349,7 +349,7 @@ do { \ #define __WARN1(s) _Pragma(#s) /* Generic message */ -#ifndef CONFIG_DEPRECATION_TEST +#if !(defined(CONFIG_DEPRECATION_TEST) || !defined(CONFIG_WARN_DEPRECATED)) #define __DEPRECATED_MACRO __WARN("Macro is deprecated") /* When adding this, remember to follow the instructions in * https://docs.zephyrproject.org/latest/develop/api/api_lifecycle.html#deprecated diff --git a/include/zephyr/toolchain/iar/iccarm.h b/include/zephyr/toolchain/iar/iccarm.h index 99d7e2cf1fd..8d197ddf04b 100644 --- a/include/zephyr/toolchain/iar/iccarm.h +++ b/include/zephyr/toolchain/iar/iccarm.h @@ -248,7 +248,7 @@ do { \ #define __WARN1(s) __PRAGMA(message = #s) /* Generic message */ -#ifndef CONFIG_DEPRECATION_TEST +#if !(defined(CONFIG_DEPRECATION_TEST) || !defined(CONFIG_WARN_DEPRECATED)) #define __DEPRECATED_MACRO __WARN("Macro is deprecated") #else #define __DEPRECATED_MACRO