Skip to content

Commit ce6b5c5

Browse files
add arpa/inet and sys/mman
1 parent 70f09ec commit ce6b5c5

File tree

5 files changed

+65
-276
lines changed

5 files changed

+65
-276
lines changed

libc/docs/CMakeLists.txt

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@ if (SPHINX_FOUND)
1010
COMMAND "${CMAKE_COMMAND}" -E copy_directory
1111
"${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}")
1212

13+
# For headers that are nested in directories, we need to
14+
# `mkdir $build_dir/libc/docs/headers/$dir` since the above copy_directory
15+
# command does not create such copies. Otherwise, the invocation of docgen
16+
# below will fail since the output file would be placed in a directory that
17+
# does not exist, leading to a `No such file or directory` error from the
18+
# shell.
19+
file(MAKE_DIRECTORY
20+
"${CMAKE_CURRENT_BINARY_DIR}/headers/arpa/"
21+
"${CMAKE_CURRENT_BINARY_DIR}/headers/sys/"
22+
)
23+
1324
# Change sphinx to build from $build_dir/libc/docs/ rather than
1425
# llvm-project/libc/docs/.
1526
add_sphinx_target(html libc SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}")
@@ -21,6 +32,7 @@ if (SPHINX_FOUND)
2132
# math.h), those should be omitted and exist statically in
2233
# libc/docs/headers/.
2334
list(APPEND docgen_list
35+
arpa/inet
2436
assert
2537
ctype
2638
errno
@@ -34,19 +46,25 @@ if (SPHINX_FOUND)
3446
stdlib
3547
string
3648
strings
49+
sys/mman
3750
threads
3851
uchar
3952
wchar
4053
wctype
4154
)
4255

4356
foreach(stem IN LISTS docgen_list)
57+
# It is an error in cmake to have a target name that contains a "/", but
58+
# docgen relies on the "/" to find headers nested under directories.
59+
# Replace with underscore.
60+
string(REPLACE "/" "_" stem_rst ${stem})
61+
4462
# docgen invocation.
45-
add_custom_target(${stem}_rst
63+
add_custom_target(${stem_rst}
4664
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../utils/docgen/docgen.py ${stem}.h >
4765
${CMAKE_CURRENT_BINARY_DIR}/headers/${stem}.rst)
4866
# depend on the docgen invocation.
49-
add_dependencies(docs-libc-html ${stem}_rst)
67+
add_dependencies(docs-libc-html ${stem_rst})
5068
endforeach()
5169
endif()
5270
endif()

libc/docs/headers/arpa/inet.rst

Lines changed: 0 additions & 50 deletions
This file was deleted.

libc/docs/headers/sys/mman.rst

Lines changed: 0 additions & 179 deletions
This file was deleted.

libc/utils/docgen/arpa/inet.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
functions:
22
htonl:
3-
posix-definition: ''
3+
in-latest-posix: ''
44
htons:
5-
posix-definition: ''
5+
in-latest-posix: ''
66
inet_addr:
7-
posix-definition: ''
7+
in-latest-posix: ''
88
inet_ntoa:
9-
posix-definition: ''
9+
in-latest-posix: ''
1010
inet_ntop:
11-
posix-definition: ''
11+
in-latest-posix: ''
1212
inet_pton:
13-
posix-definition: ''
13+
in-latest-posix: ''
1414
ntohl:
15-
posix-definition: ''
15+
in-latest-posix: ''
1616
ntohs:
17-
posix-definition: ''
17+
in-latest-posix: ''
1818

0 commit comments

Comments
 (0)