doxygen: fix build error
Some checks failed
RT-Thread BSP Static Build Check / 🔍 Summary of Git Diff Changes (push) Has been cancelled
RT-Thread BSP Static Build Check / ${{ matrix.legs.RTT_BSP }} (push) Has been cancelled
RT-Thread BSP Static Build Check / collect-artifacts (push) Has been cancelled
AutoTestCI / components/cpp11 (push) Has been cancelled
AutoTestCI / kernel/atomic (push) Has been cancelled
AutoTestCI / kernel/atomic/riscv64 (push) Has been cancelled
AutoTestCI / kernel/atomic_c11 (push) Has been cancelled
AutoTestCI / kernel/atomic_c11/riscv64 (push) Has been cancelled
AutoTestCI / kernel/device (push) Has been cancelled
AutoTestCI / kernel/ipc (push) Has been cancelled
AutoTestCI / kernel/irq (push) Has been cancelled
AutoTestCI / kernel/mem (push) Has been cancelled
AutoTestCI / kernel/mem/riscv64 (push) Has been cancelled
AutoTestCI / kernel/thread (push) Has been cancelled
AutoTestCI / kernel/timer (push) Has been cancelled
AutoTestCI / rtsmart/aarch64 (push) Has been cancelled
AutoTestCI / rtsmart/arm (push) Has been cancelled
AutoTestCI / rtsmart/riscv64 (push) Has been cancelled
AutoTestCI / components/utest (push) Has been cancelled
doc_doxygen / doxygen_doc generate (push) Has been cancelled
pkgs_test / change (push) Has been cancelled
utest_auto_run / AARCH64-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / A9-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / RISCV-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / XUANTIE-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / AARCH64 :default.cfg (push) Has been cancelled
utest_auto_run / A9 :default.cfg (push) Has been cancelled
utest_auto_run / A9-smp :default.cfg (push) Has been cancelled
utest_auto_run / RISCV :default.cfg (push) Has been cancelled
doc_doxygen / deploy (push) Has been cancelled

fixed: b084503b6d "[kernel] add UP scheduler critical switch flag."

After this commit, doxygen build with warning:
include/rtthread.h:658: warning: argument 'lock' from the argument list of rt_spin_unlock has multiple @param documentation sections
include/rtthread.h:660: warning: argument 'lock' from the argument list of rt_spin_unlock_irqrestore has multiple @param documentation sections
include/rtthread.h:660: warning: argument 'level' from the argument list of rt_spin_unlock_irqrestore has multiple @param documentation sections

Rootcasue analysis:
src/cpu_up.c and src/cpu_mp.c define two identical functions.
Because the INPUT parameter in the documentation/Doxyfile currently
compiles all source files under ./src, i.e both of them, Doxygen
automatically merges the Doxygen comments for identically named
functions if it finds the content of doxygen comments different,
resulting in multiple @param.

Previously, the API comments in both files were identical, so there
was no problem. However, the b084503b6d change only modified the
comments in src/cpu_up.c but not in src/cpu_mp.c, causing problems.

Another drawback of the b084503b6d change is that Doxygen recommends
a single line for the @brief; multiple lines are not recommended.

Solution:
Given the requirement for a single line for the @brief, this issue
is relatively simple to resolve: simply list the extra content as @note.

Regarding the warning: A perfect solution has not yet been found.
One possible approach is to write a single Doxygen comment for a kernel
API with two implementations. This approach involves writing Doxygen
comments in only one file, such as src/cpu_up.c , while omitting them
in src/cpu_mp.c .

Another solution is to add API comments to include/rtthread.h , but the
RT-Thread include/rtthread.h file is already quite large, and adding
comments there would be even more cumbersome.

A temporary solution currently in use is to ensure that the Doxygen
comments for the same API are identical in both src/cpu_up.c and
src/cpu_mp.c . This ensures that Doxygen compilation does not
generate warnings, and the files are automatically merged into a
single file in the HTML document.

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
This commit is contained in:
Chen Wang
2025-08-11 21:52:10 +08:00
committed by R b b666
parent dce06ba907
commit 715334f357
2 changed files with 8 additions and 2 deletions

View File

@@ -59,6 +59,8 @@ RTM_EXPORT(rt_spin_lock)
/**
* @brief This function will unlock the spinlock, will unlock the thread scheduler.
*
* @note If the scheduling function is called before unlocking, it will be scheduled in this function.
*
* @param lock is a pointer to the spinlock.
*/
void rt_spin_unlock(struct rt_spinlock *lock)
@@ -95,6 +97,8 @@ RTM_EXPORT(rt_spin_lock_irqsave)
/**
* @brief This function will unlock the spinlock and then restore current cpu interrupt status, will unlock the thread scheduler.
*
* @note If the scheduling function is called before unlocking, it will be scheduled in this function.
*
* @param lock is a pointer to the spinlock.
*
* @param level is interrupt status returned by rt_spin_lock_irqsave().

View File

@@ -40,7 +40,8 @@ void rt_spin_lock(struct rt_spinlock *lock)
/**
* @brief This function will unlock the spinlock, will unlock the thread scheduler.
* If the scheduling function is called before unlocking, it will be scheduled in this function.
*
* @note If the scheduling function is called before unlocking, it will be scheduled in this function.
*
* @param lock is a pointer to the spinlock.
*/
@@ -73,7 +74,8 @@ rt_base_t rt_spin_lock_irqsave(struct rt_spinlock *lock)
/**
* @brief This function will unlock the spinlock and then restore current cpu interrupt status, will unlock the thread scheduler.
* If the scheduling function is called before unlocking, it will be scheduled in this function.
*
* @note If the scheduling function is called before unlocking, it will be scheduled in this function.
*
* @param lock is a pointer to the spinlock.
*