diff --git a/include/rtdef.h b/include/rtdef.h index dd5dffc6c5..94c2466f0b 100644 --- a/include/rtdef.h +++ b/include/rtdef.h @@ -42,6 +42,7 @@ * 2022-01-07 Gabriel move some __on_rt_xxxxx_hook to dedicated c source files * 2022-01-12 Meco Man remove RT_THREAD_BLOCK * 2022-04-20 Meco Man change version number to v4.1.1 + * 2022-04-21 THEWON add macro RT_VERSION_CHECK * 2022-06-29 Meco Man add RT_USING_LIBC and standard libc headers */ @@ -71,8 +72,11 @@ extern "C" { #define RT_REVISION 1 /**< revise version number */ /* RT-Thread version */ -#define RTTHREAD_VERSION ((RT_VERSION * 10000) + \ - (RT_SUBVERSION * 100) + RT_REVISION) +#define RTTHREAD_VERSION RT_VERSION_CHECK(RT_VERSION, RT_SUBVERSION, RT_REVISION) + +/* e.g. #if (RTTHREAD_VERSION >= RT_VERSION_CHECK(4, 1, 0) */ +#define RT_VERSION_CHECK(major, minor, revise) ((major * 10000) + \ + (minor * 100) + revise) /* RT-Thread basic data type definitions */ #ifndef RT_USING_ARCH_DATA_TYPE