summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwdfk-prog <[email protected]>2026-01-06 16:10:27 +0800
committerR b b666 <[email protected]>2026-01-07 17:47:48 +0800
commit3a2d67e965fe89e38b768acb60d4c4bc0028240b (patch)
tree9a01dcee9990d36f11eb5f4b2308398fed8aec3e
parent3d8114bcfe48f0d2adc75af028117911de99d701 (diff)
fix(components): validate RT_MAIN_THREAD_PRIORITY range at build time
-rw-r--r--src/components.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/components.c b/src/components.c
index 9a1db27617..7d47683dd0 100644
--- a/src/components.c
+++ b/src/components.c
@@ -28,6 +28,11 @@
#ifndef RT_MAIN_THREAD_PRIORITY
#define RT_MAIN_THREAD_PRIORITY (RT_THREAD_PRIORITY_MAX / 3)
#endif /* RT_MAIN_THREAD_PRIORITY */
+#if (RT_MAIN_THREAD_PRIORITY >= RT_THREAD_PRIORITY_MAX)
+#error "RT_MAIN_THREAD_PRIORITY must be < RT_THREAD_PRIORITY_MAX"
+#elif (RT_MAIN_THREAD_PRIORITY < 0)
+#error "RT_MAIN_THREAD_PRIORITY must be non-negative"
+#endif /* RT_MAIN_THREAD_PRIORITY range check */
#endif /* RT_USING_USER_MAIN */
#ifdef RT_USING_COMPONENTS_INIT