Skip to content

Conversation

@unicornx
Copy link
Contributor

@unicornx unicornx commented Sep 8, 2025

参考 PR #10599 描述的问题。当时只是一个临时的解决。

经研究后,发现可以使用 Doxygen 支持的 “@cond” 命令解决。

由于在目前生成 doxygen 文档时我们并不打算为 UP 和 MP 生成两套文档。所以目前的解决方案是,默认只生成 MP 的文档。对于那些在 MP 中定义了的函数,而 UP 中没有定义的函数,我们会在函数的 doxygen 注释中采用 “@note” 命令说明该函数是否是 UP 和 MP 都支持还是只支持 MP。

总之,目前这样改动后,cpu_mp.ccpu_up.c 中的注释可以随意改动,互不影响,但 doxygen 创建文档时将以 cpu_mp.c 中的内容为准。考虑到 mp 应该兼容 up,所以这么做也是合理的。

Refer to the issue described in PR RT-Thread#10599. This was a
temporary fix at that time.

After further research, we discovered that this issue
can be addressed using the "@cond" command supported
by Doxygen.

Since we currently do not intend to generate two sets
of documentation for UP and MP when generating Doxygen
documentation, the current solution is to generate only
MP documentation by default. For functions defined in
MP but not in UP, we will use the "@note" command in
the function's Doxygen comment to indicate whether the
function supports both UP and MP, or only MP.

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 8, 2025
@github-actions
Copy link

github-actions bot commented Sep 8, 2025

📌 Code Review Assignment

🏷️ Tag: documentation

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

Changed Files (Click to expand)
  • documentation/Doxyfile

🏷️ Tag: kernel

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

Changed Files (Click to expand)
  • src/cpu_mp.c
  • src/cpu_up.c

📊 Current Review Status (Last Updated: 2025-09-08 15: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 8, 2025 07:25
@lianux-mm
Copy link
Contributor

lgtm

@Rbb666 Rbb666 merged commit afb3f22 into RT-Thread:master Sep 8, 2025
66 checks passed
@unicornx unicornx deleted the dev-doxygen-cpu-mp-up branch September 9, 2025 02:19
unicornx added a commit to unicornx/rt-thread that referenced this pull request Sep 9, 2025
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>
Rbb666 pushed a commit that referenced this pull request Sep 9, 2025
Similar to PR #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 #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>
@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.

3 participants