Skip to content

Conversation

@unicornx
Copy link
Contributor

@unicornx unicornx commented Sep 9, 2025

和 PR #10674 类似,src/scheduler_mp.c 和 src/scheduler_up.c 也有类似的问题。

经研究发现:commit 2c98ce4 "[HUST CSE][document] Fix some comments, invalid grouping commands and warnings in Doxygen." 曾经对这个问题做过修复。当时的解法是将 src/scheduler_mp.csrc/scheduler_up.c 排除出 Doxygen 的构建,并引入 documentation/doxygen/thread.h(现经调整后新的文件路径是 documentation/0.doxygen/core/thread.h), 将一部分函数的 doxygen 注释放在这个文件中。但这么做存在问题,体现在:

  • documentation/0.doxygen/core/thread.h 这里的注释脱离了源码存在,很难维护,这也导致了 src/scheduler_mp.csrc/scheduler_up.c 中新增的其他函数的注释因为没有及时更新,也不能进入 Doxygen 编译(成为 html)
  • 对于普通程序员来说,不太可能想到去 documentation/0.doxygen/ 目录下看函数的声明和注释,更不太可能想到要去持续地维护整个目录下的 doxygen 注释。目前 documentation/0.doxygen/ 下的 header 文件严格意义上应该只用于定义 doxygen 的 group,而不应该包括代码的 doxygen 注释。(类似的问题还有一些,譬如 documentation/0.doxygen/3.hardware.h 和 documentation/0.doxygen/core/systeminit.h, 有待进一步清理。)

解决方案类似 PR #10674,默认只生成 MP 的文档。对于那些在 MP 中定义了的函数,而 UP 中没有定义的函数,我们会在函数的 doxygen 注释中采用 “@note” 命令说明该函数是否是 UP 和 MP 都支持还是只支持 MP。

采用以上解决方案后 documentation/0.doxygen/core/thread.h 这个文件可以删除。

Similar to PR RT-Thread#10674, `src/scheduler_mp.c` and
`src/scheduler_up.c` also have similar issues.

After investigation, we found: in commit 2c98ce4
"[HUST CSE][document] Fix some comments, invalid
grouping commands and warnings in Doxygen." This patch
excluded `src/scheduler_mp.c` and `src/scheduler_up.c`
from the Doxygen build and include
`documentation/doxygen/thread.h` (the new file path
after adjustment is `documentation/0.doxygen/core/thread.h`),
placing the Doxygen comments for some functions in this file.

However, this approach has its problems:

- The comments in `documentation/0.doxygen/core/thread.h`
  are separated from the source code, making them
  difficult to maintain. This also results in the
  comments for the newly added functions in
  `src/scheduler_mp.c` and `src/scheduler_up.c` not
  being updated in a timely manner and failing to
  be compiled into Doxygen (becoming HTML).

- For the average programmer, it's unlikely that
  they'll consider the `documentation/0.doxygen/`
  directory for function declarations and comments,
  let alone the need to maintain the Doxygen comments
  in that directory. Currently, the header files under
  `documentation/0.doxygen/` should strictly be used
  only to define Doxygen groups and should not include
  Doxygen comments for the code itself. (Similar
  issues exist in documentation/0.doxygen/3.hardware.h
  and documentation/0.doxygen/core/systeminit.h, which
  require further cleanup.)

The solution is similar to PR RT-Thread#10674, where only MP
documentation is generated by default. For functions
defined in MP but not in UP, we use the "@note"
directive in the function's doxygen comment to indicate
whether the function is supported in both UP and MP,
or only in MP.

After implementing this solution, the file
`documentation/0.doxygen/core/thread.h` can be deleted.

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
@github-actions github-actions bot added Doc This PR/issue related with documents Kernel PR has src relate code labels Sep 9, 2025
@github-actions
Copy link

github-actions bot commented Sep 9, 2025

📌 Code Review Assignment

🏷️ Tag: documentation

Reviewers: @CXSforHPU @GorrayLi @lianux-mm @unicornx

Changed Files (Click to expand)
  • documentation/0.doxygen/core/thread.h

🏷️ Tag: kernel

Reviewers: @GorrayLi @ReviewSun @hamburger-os @lianux-mm @wdfk-prog @xu18838022837

Changed Files (Click to expand)
  • src/scheduler_mp.c
  • src/scheduler_up.c

📊 Current Review Status (Last Updated: 2025-09-09 14:25 CST)


📝 Review Instructions

  1. 维护者可以通过单击此处来刷新审查状态: 🔄 刷新状态
    Maintainers can refresh the review status by clicking here: 🔄 Refresh Status

  2. 确认审核通过后评论 LGTM/lgtm
    Comment LGTM/lgtm after confirming approval

  3. PR合并前需至少一位维护者确认
    PR must be confirmed by at least one maintainer before merging

ℹ️ 刷新CI状态操作需要具备仓库写入权限。
ℹ️ Refresh CI status operation requires repository Write permission.

@unicornx unicornx requested review from Rbb666 and removed request for Cathy-lulu and mysterywolf September 9, 2025 06:28
@Rbb666 Rbb666 merged commit 1034e5b into RT-Thread:master Sep 9, 2025
66 checks passed
@unicornx unicornx deleted the dev-doxyen-scheduler-mp-up branch September 10, 2025 02:32
@Rbb666 Rbb666 mentioned this pull request Sep 18, 2025
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Doc This PR/issue related with documents Kernel PR has src relate code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants