Skip to content

docs: expand EXTERN_C guard macros in the Doxygen API build#620

Merged
DavidCozens merged 1 commit into
mainfrom
chore/doxygen-externc-macro-expansion
Jul 14, 2026
Merged

docs: expand EXTERN_C guard macros in the Doxygen API build#620
DavidCozens merged 1 commit into
mainfrom
chore/doxygen-externc-macro-expansion

Conversation

@DavidCozens

@DavidCozens DavidCozens commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

What

Doxygen runs (via mkdoxy) with MACRO_EXPANSION off, so the unexpanded EXTERN_C_BEGIN token gets glued onto the first declaration in each public header. For example, SolidSyslogSsize in SolidSyslogStream.h rendered with type EXTERN_C_BEGIN typedef intptr_t instead of intptr_t. This hit ~37 headers — whichever symbol immediately follows EXTERN_C_BEGIN in each (SolidSyslogCrc16_Compute, SolidSyslogFatFsFile_Create, SolidSyslogConfigLockFunction, …).

Fix

In mkdocs.yml under doxy-cfg:

  • MACRO_EXPANSION: true — let the preprocessor expand macros
  • EXPAND_ONLY_PREDEF: true — but only the ones we list, so the SOLIDSYSLOG_* constants stay documented by name rather than expanded to their values
  • PREDEFINED: "EXTERN_C_BEGIN= EXTERN_C_END=" — expand both C-linkage guard macros to nothing

Doxygen then sees plain file-scope C declarations, which matches OPTIMIZE_OUTPUT_FOR_C.

Verification

Built the docs locally in the mkdocs-mkdoxy:sha-34173c0 container with mkdocs build --strict:

  • mkdocs build --strict passes
  • Regenerated XML: <definition>EXTERN_C_BEGIN count dropped from 37 → 0; SolidSyslogSsize type is now typedef intptr_t
  • Rendered HTML for the Stream page shows a clean SolidSyslogSsize with zero EXTERN_C_BEGIN leakage

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Improved API reference generation for C declarations wrapped in linkage guards.
    • Public type definitions are now displayed more clearly without carrying over internal linkage macros.
    • Documented constants continue to appear by their defined names rather than expanded values.

Doxygen ran with MACRO_EXPANSION off, so the unexpanded EXTERN_C_BEGIN
token was glued onto the first declaration in each public header — e.g.
SolidSyslogSsize rendered with type "EXTERN_C_BEGIN typedef intptr_t"
instead of "intptr_t", across ~37 headers.

Turn on MACRO_EXPANSION with EXPAND_ONLY_PREDEF and predefine both guard
macros to empty, so Doxygen sees plain file-scope C declarations while
every other macro (the SOLIDSYSLOG_* constants) stays documented by name.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: dd796e53-d4a4-46d4-bcd0-9ead8df4c227

📥 Commits

Reviewing files that changed from the base of the PR and between ed5ffeb and bc0fe73.

📒 Files selected for processing (1)
  • mkdocs.yml

Walkthrough

The Doxygen configuration now enables controlled macro expansion and explicitly removes EXTERN_C_BEGIN and EXTERN_C_END during parsing, allowing wrapped C declarations to render without unexpanded guard tokens.

Changes

Doxygen documentation configuration

Layer / File(s) Summary
Configure C-linkage macro expansion
mkdocs.yml
Enables controlled macro expansion and defines EXTERN_C_BEGIN and EXTERN_C_END as empty values for Doxygen parsing, while retaining named documentation for other macros.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise, Conventional Commits-formatted, and accurately describes the Doxygen macro-expansion fix.
Description check ✅ Passed The description covers purpose, change, verification, and affected area in substance, though it uses non-template headings.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/doxygen-externc-macro-expansion

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

☀️   Quality Summary

   🚦   build-linux-gcc: 100% successful (✔️ 1522 passed)
   🚦   build-freertos-host-tdd-plustcp: 100% successful (✔️ 1873 passed)
   🚦   build-linux-clang: 100% successful (✔️ 1453 passed)
   🚦   sanitize-linux-gcc: 100% successful (✔️ 1453 passed)
   🚦   integration-linux-openssl: 100% successful (✔️ 16 passed)
   🚦   integration-linux-mbedtls: 100% successful (✔️ 14 passed)
   🚦   integration-windows-openssl: 100% successful (✔️ 16 passed)
   🚦   bdd-linux-syslog-ng: 94% successful (✔️ 49 passed, 🙈 3 skipped)
   🚦   bdd-windows-otel: 88% successful (✔️ 46 passed, 🙈 6 skipped)
   🚦   bdd-freertos-qemu-plustcp: 87% successful (✔️ 45 passed, 🙈 7 skipped)
   🚦   bdd-freertos-qemu-lwip: 87% successful (✔️ 45 passed, 🙈 7 skipped)
   🚦   build-windows-msvc: 100% successful (✔️ 1298 passed)
   🚦   build-linux-tunable-override: 100% successful (✔️ 1453 passed)
   ⚠️   Clang-Tidy: No warnings
   ⚠️   CPPCheck: No warnings


Created by Quality Monitor v1.14.0 (#f3859fd). More details are shown in the GitHub Checks Result.

@DavidCozens DavidCozens merged commit ad4fbd4 into main Jul 14, 2026
30 checks passed
@DavidCozens DavidCozens deleted the chore/doxygen-externc-macro-expansion branch July 14, 2026 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant