Doxygen 跳过 ifdef

发布于 2025-01-20 11:30:45 字数 1951 浏览 1 评论 0原文

我正在使用doxygen记录我的代码,并且有一个问题。我希望doxygen记录并披露标头文件。我正在使用ceedling进行单元测试,并且经常必须为测试代码添加辅助功能才能访问数据。我的Doxygen标头之一如下。

#ifndef INCLUDE_THREAD_HEALTH_H_
 #define INCLUDE_THREAD_HEALTH_H_
  
 #include <stdbool.h>
 #include <stdint.h>
 #include <pthread.h>
  
 #define MAX_TRACKED_THREADS 100U
  
 struct thread_health {
     bool thread_alive;          
     char* thread_name;          
     pthread_t* thread;          
 };
  
 void thread_health_init(void);
  
 int32_t thread_health_create_and_register_thread(pthread_t* thread, pthread_attr_t* attributes, char *thread_name, void *(*ThreadTask) (void *));
  
 bool thread_health_destroy_unregister_thread(const pthread_t* thread);
  
 void thread_health_task(uint32_t period);
  
 #ifdef CEEDLING_TESTS
 struct thread_health thread_health_get_health(uint8_t index);
 #endif
  
 #endif /* INCLUDE_THREAD_HEALTH_H_ */

我有IFDEF宏,我希望Doxygen忽略此宏中的所有内容。我似乎找不到这样做的方法。

编辑:添加doxygen信息,

# Difference with default Doxyfile 1.8.17
PROJECT_NAME           = "MAIN Application"
JAVADOC_AUTOBRIEF      = YES
OPTIMIZE_OUTPUT_FOR_C  = YES
RECURSIVE              = YES
EXCLUDE_PATTERNS       = */build/* \
                         */test/*
MACRO_EXPANSION        = YES

我希望找到一个Undef选项。但这似乎并不存在于Doxygen中。

编辑2:我的ceedling测试助手功能的定义值是CEEDLING_TESTS。如果Doxygen无法报告此标签之间的函数声明,我会喜欢它。

编辑3:我在a 不幸的是,这对我不起作用,这可能是一个版本问题。我找不到FAQ版本,但我将尝试更新。

编辑4:我在此之后更新为doxygen 1.9.4 指南。同样的问题。

I am using doxygen to document my code and I have one concern. I want doxygen to record and disclose the header files. I am using ceedling for my unit tests and I often have to add helper functions for the test code to gain access to data. One of my doxygen headers is as follows.

#ifndef INCLUDE_THREAD_HEALTH_H_
 #define INCLUDE_THREAD_HEALTH_H_
  
 #include <stdbool.h>
 #include <stdint.h>
 #include <pthread.h>
  
 #define MAX_TRACKED_THREADS 100U
  
 struct thread_health {
     bool thread_alive;          
     char* thread_name;          
     pthread_t* thread;          
 };
  
 void thread_health_init(void);
  
 int32_t thread_health_create_and_register_thread(pthread_t* thread, pthread_attr_t* attributes, char *thread_name, void *(*ThreadTask) (void *));
  
 bool thread_health_destroy_unregister_thread(const pthread_t* thread);
  
 void thread_health_task(uint32_t period);
  
 #ifdef CEEDLING_TESTS
 struct thread_health thread_health_get_health(uint8_t index);
 #endif
  
 #endif /* INCLUDE_THREAD_HEALTH_H_ */

I have the ifdef macro, I want doxygen to ignore everything in this macro. I cannot seem to find a way to do this.

Edit: Adding doxygen info

# Difference with default Doxyfile 1.8.17
PROJECT_NAME           = "MAIN Application"
JAVADOC_AUTOBRIEF      = YES
OPTIMIZE_OUTPUT_FOR_C  = YES
RECURSIVE              = YES
EXCLUDE_PATTERNS       = */build/* \
                         */test/*
MACRO_EXPANSION        = YES

My hope was to find an undef option. But that does not seem to exist in Doxygen.

Edit 2: My defined value for my ceedling test helper functions is CEEDLING_TESTS. I would like it if Doxygen could not report the function declarations between this tag.
enter image description here

Edit 3: I found this in a FAQ
enter image description here
Unfortunately this is not working for me, it may be a version issue. I cannot find a version for the FAQ but I will attempt to update.

Edit 4: I updated to doxygen 1.9.4 following this guide. Same issue.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文