fix: 在没有定义FINSH_USING_SYMTAB时编译报错以及IPC及finsh启用时自动选择必要的功能#10667
fix: 在没有定义FINSH_USING_SYMTAB时编译报错以及IPC及finsh启用时自动选择必要的功能#10667Rbb666 merged 1 commit intoRT-Thread:masterfrom
Conversation
📌 Code Review Assignment🏷️ Tag: componentsReviewers: @Maihuanyi Changed Files (Click to expand)
📊 Current Review Status (Last Updated: 2025-09-02 17:36 CST)
📝 Review Instructions
|
There was a problem hiding this comment.
Pull Request Overview
This PR fixes compilation errors when FINSH_USING_SYMTAB is not defined and adds automatic selection of necessary IPC features when finsh and device IPC are enabled.
- Wraps symbol table access code with
#if defined(FINSH_USING_SYMTAB)guards - Adds empty macro definition for
MSH_FUNCTION_EXPORT_CMDwhen symbol table is disabled - Automatically selects required semaphore and mutex features for MSH and device IPC
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| components/finsh/msh.c | Guards symbol table iteration code with conditional compilation |
| components/finsh/finsh.h | Provides empty macro definition when FINSH_USING_SYMTAB is disabled |
| components/finsh/Kconfig | Automatically selects RT_USING_SEMAPHORE for MSH |
| components/drivers/ipc/Kconfig | Automatically selects RT_USING_MUTEX and RT_USING_SEMAPHORE for device IPC |
| #if defined(FINSH_USING_SYMTAB) | ||
| for (index = _syscall_table_begin; | ||
| index < _syscall_table_end; | ||
| FINSH_NEXT_SYSCALL(index)) | ||
| { | ||
| #if defined(FINSH_USING_DESCRIPTION) && defined(FINSH_USING_SYMTAB) | ||
| #if defined(FINSH_USING_DESCRIPTION) | ||
| rt_kprintf("%-16s - %s\n", index->name, index->desc); | ||
| #else | ||
| rt_kprintf("%s ", index->name); | ||
| #endif | ||
| #endif /* FINSH_USING_DESCRIPTION */ | ||
| } | ||
| #endif /* FINSH_USING_SYMTAB */ |
There was a problem hiding this comment.
[maintainability/可维护性]: The nested conditional compilation blocks create complex structure that could be simplified.
English: The nested #ifdef FINSH_USING_DESCRIPTION inside the #ifdef FINSH_USING_SYMTAB block increases complexity. Consider extracting the loop body into a separate inline function to improve readability and maintainability.
中文:嵌套的条件编译块增加了代码复杂度。在 #ifdef FINSH_USING_SYMTAB 内部再嵌套 #ifdef FINSH_USING_DESCRIPTION 使结构变得复杂。建议将循环体提取为独立的内联函数以提高可读性和可维护性。
| }; | ||
|
|
||
| #endif /* _MSC_VER */ | ||
| #else |
There was a problem hiding this comment.
[documentation/文档]: Empty macro definition lacks explanatory comment.
English: The empty macro definition should include a comment explaining why it's empty and its purpose when FINSH_USING_SYMTAB is not defined. This helps maintainers understand the design decision.
中文:空宏定义缺少解释性注释。应该包含注释说明为什么在未定义 FINSH_USING_SYMTAB 时该宏为空,以及其设计目的。这有助于维护者理解设计决策。
|
LGTM |
拉取/合并请求描述:(PR description)
[
为什么提交这份PR (why to submit this PR)
你的解决方案是什么 (what is your solution)
请提供验证的bsp和config (provide the config and bsp)
]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up