Skip to content

Commit 3a2d67e

Browse files
wdfk-progRbb666
authored andcommitted
fix(components): validate RT_MAIN_THREAD_PRIORITY range at build time
1 parent 3d8114b commit 3a2d67e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/components.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
#ifndef RT_MAIN_THREAD_PRIORITY
2929
#define RT_MAIN_THREAD_PRIORITY (RT_THREAD_PRIORITY_MAX / 3)
3030
#endif /* RT_MAIN_THREAD_PRIORITY */
31+
#if (RT_MAIN_THREAD_PRIORITY >= RT_THREAD_PRIORITY_MAX)
32+
#error "RT_MAIN_THREAD_PRIORITY must be < RT_THREAD_PRIORITY_MAX"
33+
#elif (RT_MAIN_THREAD_PRIORITY < 0)
34+
#error "RT_MAIN_THREAD_PRIORITY must be non-negative"
35+
#endif /* RT_MAIN_THREAD_PRIORITY range check */
3136
#endif /* RT_USING_USER_MAIN */
3237

3338
#ifdef RT_USING_COMPONENTS_INIT

0 commit comments

Comments
 (0)