[libc][docs] Avoid docgen target collisions and restore pthread docs (#188221)

Fixes llvm/llvm-project#123821.

Re-enabling pthread docs created a global CMake utility target named
`pthread`, which collides in combined runtime builds where `pthread` is
expected to be a library name. Namespace the internal libc docgen helper
targets under `libc-docgen-*` and restore the generated pthread docs
page. `docs-libc-html` is unchanged.
This commit is contained in:
Petter Berntsson 2026-03-24 14:33:34 +00:00 committed by GitHub
parent 376874a345
commit da439d5426
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 7 deletions

View File

@ -54,8 +54,7 @@ if (SPHINX_FOUND)
locale
net/if
netinet/in
# TODO: https://github.com/llvm/llvm-project/issues/123821
# pthread
pthread
setjmp
signal
stdbit
@ -81,15 +80,17 @@ if (SPHINX_FOUND)
foreach(stem IN LISTS docgen_list)
# It is an error in cmake to have a target name that contains a "/", but
# docgen relies on the "/" to find headers nested under directories.
# Replace with underscore.
# Replace with underscore and namespace the target to avoid collisions
# with other runtime targets in combined builds.
string(REPLACE "/" "_" stem_rst ${stem})
set(docgen_target_name libc-docgen-${stem_rst})
# docgen invocation.
add_custom_target(${stem_rst}
add_custom_target(${docgen_target_name}
COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../utils/docgen/docgen.py ${stem}.h >
${CMAKE_CURRENT_BINARY_DIR}/headers/${stem}.rst)
# depend on the docgen invocation.
add_dependencies(docs-libc-html ${stem_rst})
add_dependencies(docs-libc-html ${docgen_target_name})
endforeach()
endif()
endif()

View File

@ -44,6 +44,4 @@ Implementation Status
unistd
wchar
wctype
..
TODO: https://github.com/llvm/llvm-project/issues/123821
pthread