[libc-commits] [libc] [libc][docs] Fix POSIX basedefs links for nested headers (PR #188738)
via libc-commits
libc-commits at lists.llvm.org
Thu Mar 26 06:11:42 PDT 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
Author: Petter Berntsson (petbernt)
<details>
<summary>Changes</summary>
Fix broken POSIX basedefs links for nested headers in llvm-libc docs.
The docgen script currently emits paths like `sys/wait.h.html`, but the Open Group uses `sys_wait.h.html`, for example:
- https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_wait.h.html
This updates nested-header link generation while leaving flat headers unchanged.
---
Full diff: https://github.com/llvm/llvm-project/pull/188738.diff
1 Files Affected:
- (modified) libc/utils/docgen/docgen.py (+6-1)
``````````diff
diff --git a/libc/utils/docgen/docgen.py b/libc/utils/docgen/docgen.py
index 59cfbd54561c7..a2296dcab1a32 100755
--- a/libc/utils/docgen/docgen.py
+++ b/libc/utils/docgen/docgen.py
@@ -149,6 +149,11 @@ def print_functions_rst(header: Header, functions: Dict):
print(" -")
+def posix_header_name(header: Header) -> str:
+ """Map nested header names to the Open Group basedefs filename form."""
+ return header.name.replace("/", "_")
+
+
def print_macros_rst(header: Header, macros: Dict):
tbl_hdr = "Macros"
print(tbl_hdr)
@@ -171,7 +176,7 @@ def print_macros_rst(header: Header, macros: Dict):
if "in-latest-posix" in macros[name]:
print(
- f" - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/{header.name}.html>`__"
+ f" - `POSIX.1-2024 <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/{posix_header_name(header)}.html>`__"
)
else:
print(" -")
``````````
</details>
https://github.com/llvm/llvm-project/pull/188738
More information about the libc-commits
mailing list