[libc-commits] [libc] [libc][docs] Fix POSIX basedefs links for nested headers (PR #188738)
Petter Berntsson via libc-commits
libc-commits at lists.llvm.org
Fri Mar 27 08:58:23 PDT 2026
https://github.com/petbernt updated https://github.com/llvm/llvm-project/pull/188738
>From bca8f42c5a23651604f23d0d0911beea6aefdc53 Mon Sep 17 00:00:00 2001
From: Petter Berntsson <petter.berntsson at arm.com>
Date: Thu, 26 Mar 2026 12:35:01 +0000
Subject: [PATCH] [libc][docs] Fix POSIX basedefs links for nested headers
The Open Group publishes basedefs pages for nested headers by
replacing '/' with '_'. Use that filename form when generating
macro links so headers like sys/wait.h point to a valid page.
---
libc/utils/docgen/docgen.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/libc/utils/docgen/docgen.py b/libc/utils/docgen/docgen.py
index 59cfbd54561c7..40e5377ba0b12 100755
--- a/libc/utils/docgen/docgen.py
+++ b/libc/utils/docgen/docgen.py
@@ -149,6 +149,12 @@ def print_functions_rst(header: Header, functions: Dict):
print(" -")
+def posix_basedefs_url(header: Header) -> str:
+ """Return the Open Group basedefs URL for a header."""
+ posix_header_name = header.name.replace("/", "_")
+ return f"https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/{posix_header_name}.html"
+
+
def print_macros_rst(header: Header, macros: Dict):
tbl_hdr = "Macros"
print(tbl_hdr)
@@ -171,7 +177,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 <{posix_basedefs_url(header)}>`__"
)
else:
print(" -")
More information about the libc-commits
mailing list