Skip to content

[libc][docs] split "String Functions" into string.h, strings.h, stdlib.h, and inttypes.h #118860

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 10, 2024

Conversation

nickdesaulniers
Copy link
Member

bcmp, bcopy, and bzero should be moved from libc/src/string/ to
lib/src/strings/ in order for docgen to use existing conventions to find
whether we implement a function or not.

We should add support to docgen for mentioning glibc extensions (mempcpy) or
extensions from other libcs.

@llvmbot llvmbot added the libc label Dec 5, 2024
@nickdesaulniers
Copy link
Member Author

Note to reviewers, this PR is stacked on top of #118836 AND #118852. The first 2 commits should be skipped in review for this PR.

@llvmbot
Copy link
Member

llvmbot commented Dec 5, 2024

@llvm/pr-subscribers-libc

Author: Nick Desaulniers (nickdesaulniers)

Changes

bcmp, bcopy, and bzero should be moved from libc/src/string/ to
lib/src/strings/ in order for docgen to use existing conventions to find
whether we implement a function or not.

We should add support to docgen for mentioning glibc extensions (mempcpy) or
extensions from other libcs.


Patch is 28.52 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/118860.diff

31 Files Affected:

  • (added) libc/docs/headers/assert.rst (+27)
  • (renamed) libc/docs/headers/complex.rst (+1-1)
  • (renamed) libc/docs/headers/ctype.rst (+1-1)
  • (added) libc/docs/headers/errno.rst (+35)
  • (renamed) libc/docs/headers/fenv.rst (+1-1)
  • (added) libc/docs/headers/index.rst (+24)
  • (added) libc/docs/headers/inttypes.rst (+42)
  • (added) libc/docs/headers/locale.rst (+63)
  • (renamed) libc/docs/headers/math/index.rst (+4-4)
  • (renamed) libc/docs/headers/math/log.rst ()
  • (renamed) libc/docs/headers/math/stdfix.rst (+1-1)
  • (renamed) libc/docs/headers/search.rst (+4-4)
  • (renamed) libc/docs/headers/setjmp.rst (+1-1)
  • (renamed) libc/docs/headers/signal.rst (+1-1)
  • (renamed) libc/docs/headers/stdbit.rst (+1-1)
  • (renamed) libc/docs/headers/stdio.rst (+4-4)
  • (added) libc/docs/headers/stdlib.rst (+255)
  • (added) libc/docs/headers/string.rst (+155)
  • (added) libc/docs/headers/strings.rst (+30)
  • (renamed) libc/docs/headers/threads.rst (+1-1)
  • (renamed) libc/docs/headers/time.rst (+4-4)
  • (modified) libc/docs/index.rst (+1-12)
  • (removed) libc/docs/strings.rst (-166)
  • (added) libc/utils/docgen/assert.json (+10)
  • (modified) libc/utils/docgen/docgen.py (+1-1)
  • (added) libc/utils/docgen/errno.json (+16)
  • (added) libc/utils/docgen/inttypes.json (+22)
  • (added) libc/utils/docgen/locale.json (+30)
  • (added) libc/utils/docgen/stdlib.json (+174)
  • (added) libc/utils/docgen/string.json (+99)
  • (added) libc/utils/docgen/strings.json (+13)
diff --git a/libc/docs/headers/assert.rst b/libc/docs/headers/assert.rst
new file mode 100644
index 00000000000000..06ea27966de1ae
--- /dev/null
+++ b/libc/docs/headers/assert.rst
@@ -0,0 +1,27 @@
+.. include:: ../check.rst
+
+========
+assert.h
+========
+
+Macros
+======
+
+.. list-table::
+  :widths: auto
+  :align: center
+  :header-rows: 1
+
+  * - Macro
+    - Implemented
+    - C23 Standard Section
+    - POSIX.1-2024 Standard Section
+  * - __STDC_VERSION_ASSERT_H__
+    - |check|
+    - 7.2.1
+    -
+  * - assert
+    -
+    - 7.2.1
+    -
+
diff --git a/libc/docs/complex.rst b/libc/docs/headers/complex.rst
similarity index 99%
rename from libc/docs/complex.rst
rename to libc/docs/headers/complex.rst
index 1e74f16b60e660..2e81aba97b0ef6 100644
--- a/libc/docs/complex.rst
+++ b/libc/docs/headers/complex.rst
@@ -1,4 +1,4 @@
-.. include:: check.rst
+.. include:: ../check.rst
 
 =========
 complex.h
diff --git a/libc/docs/ctype.rst b/libc/docs/headers/ctype.rst
similarity index 97%
rename from libc/docs/ctype.rst
rename to libc/docs/headers/ctype.rst
index 66e6f12b87818c..e506830809f795 100644
--- a/libc/docs/ctype.rst
+++ b/libc/docs/headers/ctype.rst
@@ -1,4 +1,4 @@
-.. include:: check.rst
+.. include:: ../check.rst
 
 =======
 ctype.h
diff --git a/libc/docs/headers/errno.rst b/libc/docs/headers/errno.rst
new file mode 100644
index 00000000000000..f25aae4f23b2c7
--- /dev/null
+++ b/libc/docs/headers/errno.rst
@@ -0,0 +1,35 @@
+.. include:: ../check.rst
+
+=======
+errno.h
+=======
+
+Macros
+======
+
+.. list-table::
+  :widths: auto
+  :align: center
+  :header-rows: 1
+
+  * - Macro
+    - Implemented
+    - C23 Standard Section
+    - POSIX.1-2024 Standard Section
+  * - EDOM
+    -
+    - 7.5
+    -
+  * - EILSEQ
+    -
+    - 7.5
+    -
+  * - ERANGE
+    -
+    - 7.5
+    -
+  * - errno
+    -
+    - 7.5
+    -
+
diff --git a/libc/docs/fenv.rst b/libc/docs/headers/fenv.rst
similarity index 98%
rename from libc/docs/fenv.rst
rename to libc/docs/headers/fenv.rst
index d910ba8852f68c..374b46ef57be0a 100644
--- a/libc/docs/fenv.rst
+++ b/libc/docs/headers/fenv.rst
@@ -1,4 +1,4 @@
-.. include:: check.rst
+.. include:: ../check.rst
 
 ======
 fenv.h
diff --git a/libc/docs/headers/index.rst b/libc/docs/headers/index.rst
new file mode 100644
index 00000000000000..4d220d9da63071
--- /dev/null
+++ b/libc/docs/headers/index.rst
@@ -0,0 +1,24 @@
+Implementation Status
+=====================
+
+.. toctree::
+   :maxdepth: 1
+
+   assert
+   complex
+   ctype
+   errno
+   fenv
+   inttypes
+   locale
+   math/index.rst
+   search
+   setjmp
+   signal
+   stdbit
+   stdio
+   stdlib
+   string
+   strings
+   threads
+   time
diff --git a/libc/docs/headers/inttypes.rst b/libc/docs/headers/inttypes.rst
new file mode 100644
index 00000000000000..f43c80f095c6a8
--- /dev/null
+++ b/libc/docs/headers/inttypes.rst
@@ -0,0 +1,42 @@
+.. include:: ../check.rst
+
+==========
+inttypes.h
+==========
+
+Functions
+=========
+
+.. list-table::
+  :widths: auto
+  :align: center
+  :header-rows: 1
+
+  * - Function
+    - Implemented
+    - C23 Standard Section
+    - POSIX.1-2024 Standard Section
+  * - imaxabs
+    - |check|
+    - 7.8.2.1
+    -
+  * - imaxdiv
+    - |check|
+    - 7.8.2.2
+    -
+  * - strtoimax
+    - |check|
+    - 7.8.2.3
+    -
+  * - strtoumax
+    - |check|
+    - 7.8.2.3
+    -
+  * - wcstoimax
+    -
+    - 7.8.2.4
+    -
+  * - wcstoumax
+    -
+    - 7.8.2.4
+    -
diff --git a/libc/docs/headers/locale.rst b/libc/docs/headers/locale.rst
new file mode 100644
index 00000000000000..2d5525bd3f2f9a
--- /dev/null
+++ b/libc/docs/headers/locale.rst
@@ -0,0 +1,63 @@
+.. include:: ../check.rst
+
+========
+locale.h
+========
+
+Macros
+======
+
+.. list-table::
+  :widths: auto
+  :align: center
+  :header-rows: 1
+
+  * - Macro
+    - Implemented
+    - C23 Standard Section
+    - POSIX.1-2024 Standard Section
+  * - LC_ALL
+    - |check|
+    - 7.11
+    -
+  * - LC_COLLATE
+    - |check|
+    - 7.11
+    -
+  * - LC_CTYPE
+    - |check|
+    - 7.11
+    -
+  * - LC_MONETARY
+    - |check|
+    - 7.11
+    -
+  * - LC_NUMERIC
+    - |check|
+    - 7.11
+    -
+  * - LC_TIME
+    - |check|
+    - 7.11
+    -
+
+Functions
+=========
+
+.. list-table::
+  :widths: auto
+  :align: center
+  :header-rows: 1
+
+  * - Function
+    - Implemented
+    - C23 Standard Section
+    - POSIX.1-2024 Standard Section
+  * - localeconv
+    - |check|
+    - 7.11.2.1
+    -
+  * - setlocale
+    - |check|
+    - 7.11.1.1
+    -
diff --git a/libc/docs/math/index.rst b/libc/docs/headers/math/index.rst
similarity index 99%
rename from libc/docs/math/index.rst
rename to libc/docs/headers/math/index.rst
index 4934e93ccb1645..adc0afa080ec2a 100644
--- a/libc/docs/math/index.rst
+++ b/libc/docs/headers/math/index.rst
@@ -1,10 +1,10 @@
 .. _math:
 
-==============
-Math Functions
-==============
+======
+math.h
+======
 
-.. include:: ../check.rst
+.. include:: ../../check.rst
 
 .. raw:: html
 
diff --git a/libc/docs/math/log.rst b/libc/docs/headers/math/log.rst
similarity index 100%
rename from libc/docs/math/log.rst
rename to libc/docs/headers/math/log.rst
diff --git a/libc/docs/math/stdfix.rst b/libc/docs/headers/math/stdfix.rst
similarity index 99%
rename from libc/docs/math/stdfix.rst
rename to libc/docs/headers/math/stdfix.rst
index d8dcb0cfa4c521..58052f000995cd 100644
--- a/libc/docs/math/stdfix.rst
+++ b/libc/docs/headers/math/stdfix.rst
@@ -2,7 +2,7 @@
 StdFix Functions
 ================
 
-.. include:: ../check.rst
+.. include:: ../../check.rst
 
 Standards and Goals
 -------------------
diff --git a/libc/docs/libc_search.rst b/libc/docs/headers/search.rst
similarity index 95%
rename from libc/docs/libc_search.rst
rename to libc/docs/headers/search.rst
index 774622d1e66c3f..51832e9bdc2ed4 100644
--- a/libc/docs/libc_search.rst
+++ b/libc/docs/headers/search.rst
@@ -1,8 +1,8 @@
-=============
-Search Tables
-=============
+========
+search.h
+========
 
-.. include:: check.rst
+.. include:: ../check.rst
 
 ---------------
 Source Location
diff --git a/libc/docs/setjmp.rst b/libc/docs/headers/setjmp.rst
similarity index 95%
rename from libc/docs/setjmp.rst
rename to libc/docs/headers/setjmp.rst
index 3739e73685b4bb..b0091134f1a6b2 100644
--- a/libc/docs/setjmp.rst
+++ b/libc/docs/headers/setjmp.rst
@@ -1,4 +1,4 @@
-.. include:: check.rst
+.. include:: ../check.rst
 
 ========
 setjmp.h
diff --git a/libc/docs/signal.rst b/libc/docs/headers/signal.rst
similarity index 99%
rename from libc/docs/signal.rst
rename to libc/docs/headers/signal.rst
index 172dd4a048ae9a..b59ae093423574 100644
--- a/libc/docs/signal.rst
+++ b/libc/docs/headers/signal.rst
@@ -1,4 +1,4 @@
-.. include:: check.rst
+.. include:: ../check.rst
 
 ========
 signal.h
diff --git a/libc/docs/stdbit.rst b/libc/docs/headers/stdbit.rst
similarity index 99%
rename from libc/docs/stdbit.rst
rename to libc/docs/headers/stdbit.rst
index 3718ff8dc0df26..0484d951e19c6b 100644
--- a/libc/docs/stdbit.rst
+++ b/libc/docs/headers/stdbit.rst
@@ -1,4 +1,4 @@
-.. include:: check.rst
+.. include:: ../check.rst
 
 ========
 stdbit.h
diff --git a/libc/docs/stdio.rst b/libc/docs/headers/stdio.rst
similarity index 96%
rename from libc/docs/stdio.rst
rename to libc/docs/headers/stdio.rst
index d17821562c2556..3cd355529d4005 100644
--- a/libc/docs/stdio.rst
+++ b/libc/docs/headers/stdio.rst
@@ -1,8 +1,8 @@
-===============
-StdIO Functions
-===============
+=======
+stdio.h
+=======
 
-.. include:: check.rst
+.. include:: ../check.rst
 
 ---------------
 Source location
diff --git a/libc/docs/headers/stdlib.rst b/libc/docs/headers/stdlib.rst
new file mode 100644
index 00000000000000..139d9b4a922281
--- /dev/null
+++ b/libc/docs/headers/stdlib.rst
@@ -0,0 +1,255 @@
+.. include:: ../check.rst
+
+========
+stdlib.h
+========
+
+Macros
+======
+
+.. list-table::
+  :widths: auto
+  :align: center
+  :header-rows: 1
+
+  * - Macro
+    - Implemented
+    - C23 Standard Section
+    - POSIX.1-2024 Standard Section
+  * - EXIT_FAILURE
+    - |check|
+    - 7.24
+    -
+  * - EXIT_SUCCESS
+    - |check|
+    - 7.24
+    -
+  * - MB_CUR_MAX
+    - |check|
+    - 7.24
+    -
+  * - RAND_MAX
+    - |check|
+    - 7.24
+    -
+  * - __STDC_VERSION_STDLIB_H__
+    -
+    - 7.24
+    -
+
+Functions
+=========
+
+.. list-table::
+  :widths: auto
+  :align: center
+  :header-rows: 1
+
+  * - Function
+    - Implemented
+    - C23 Standard Section
+    - POSIX.1-2024 Standard Section
+  * - _Exit
+    - |check|
+    - 7.24.4.5
+    -
+  * - abort
+    - |check|
+    - 7.24.4.1
+    -
+  * - abs
+    - |check|
+    - 7.24.6.1
+    -
+  * - aligned_alloc
+    - |check|
+    - 7.24.3.1
+    -
+  * - at_quick_exit
+    - |check|
+    - 7.24.4.3
+    -
+  * - atexit
+    - |check|
+    - 7.24.4.2
+    -
+  * - atof
+    - |check|
+    - 7.24.1.1
+    -
+  * - atoi
+    - |check|
+    - 7.24.1.2
+    -
+  * - atol
+    - |check|
+    - 7.24.1.2
+    -
+  * - atoll
+    - |check|
+    - 7.24.1.2
+    -
+  * - bsearch
+    - |check|
+    - 7.24.5.1
+    -
+  * - calloc
+    - |check|
+    - 7.24.3.2
+    -
+  * - div
+    - |check|
+    - 7.24.6.2
+    -
+  * - exit
+    - |check|
+    - 7.24.4.4
+    -
+  * - free
+    - |check|
+    - 7.24.3.3
+    -
+  * - free_aligned_sized
+    -
+    - 7.24.3.5
+    -
+  * - free_sized
+    -
+    - 7.24.3.4
+    -
+  * - getenv
+    - |check|
+    - 7.24.4.6
+    -
+  * - labs
+    - |check|
+    - 7.24.6.1
+    -
+  * - ldiv
+    - |check|
+    - 7.24.6.2
+    -
+  * - llabs
+    - |check|
+    - 7.24.6.1
+    -
+  * - lldiv
+    - |check|
+    - 7.24.6.2
+    -
+  * - malloc
+    - |check|
+    - 7.24.3.6
+    -
+  * - mblen
+    -
+    - 7.24.7.1
+    -
+  * - mbstowcs
+    -
+    - 7.24.8.1
+    -
+  * - mbtowc
+    -
+    - 7.24.7.2
+    -
+  * - memalignment
+    -
+    - 7.24.9.1
+    -
+  * - qsort
+    - |check|
+    - 7.24.5.2
+    -
+  * - quick_exit
+    - |check|
+    - 7.24.4.7
+    -
+  * - rand
+    - |check|
+    - 7.24.2.1
+    -
+  * - realloc
+    - |check|
+    - 7.24.3.7
+    -
+  * - srand
+    - |check|
+    - 7.24.2.2
+    -
+  * - strfromd
+    - |check|
+    - 7.24.1.3
+    -
+  * - strfromd128
+    -
+    - 7.24.1.4
+    -
+  * - strfromd32
+    -
+    - 7.24.1.4
+    -
+  * - strfromd64
+    -
+    - 7.24.1.4
+    -
+  * - strfromf
+    - |check|
+    - 7.24.1.3
+    -
+  * - strfroml
+    - |check|
+    - 7.24.1.3
+    -
+  * - strtod
+    - |check|
+    - 7.24.1.5
+    -
+  * - strtod128
+    -
+    - 7.24.1.6
+    -
+  * - strtod32
+    -
+    - 7.24.1.6
+    -
+  * - strtod64
+    -
+    - 7.24.1.6
+    -
+  * - strtof
+    - |check|
+    - 7.24.1.5
+    -
+  * - strtol
+    - |check|
+    - 7.24.1.7
+    -
+  * - strtold
+    - |check|
+    - 7.24.1.5
+    -
+  * - strtoll
+    - |check|
+    - 7.24.1.7
+    -
+  * - strtoul
+    - |check|
+    - 7.24.1.7
+    -
+  * - strtoull
+    - |check|
+    - 7.24.1.7
+    -
+  * - system
+    - |check|
+    - 7.24.4.8
+    -
+  * - wcstombs
+    -
+    - 7.24.8.2
+    -
+  * - wctomb
+    -
+    - 7.24.7.3
+    -
diff --git a/libc/docs/headers/string.rst b/libc/docs/headers/string.rst
new file mode 100644
index 00000000000000..55f779c830ea87
--- /dev/null
+++ b/libc/docs/headers/string.rst
@@ -0,0 +1,155 @@
+.. include:: ../check.rst
+
+========
+string.h
+========
+
+Macros
+======
+
+.. list-table::
+  :widths: auto
+  :align: center
+  :header-rows: 1
+
+  * - Macro
+    - Implemented
+    - C23 Standard Section
+    - POSIX.1-2024 Standard Section
+  * - __STDC_VERSION_STRING_H__
+    -
+    - 7.26.1
+    -
+
+Functions
+=========
+
+.. list-table::
+  :widths: auto
+  :align: center
+  :header-rows: 1
+
+  * - Function
+    - Implemented
+    - C23 Standard Section
+    - POSIX.1-2024 Standard Section
+  * - memccpy
+    - |check|
+    - 7.26.2.2
+    -
+  * - memchr
+    - |check|
+    - 7.26.5.2
+    -
+  * - memcmp
+    - |check|
+    - 7.26.4.1
+    -
+  * - memcpy
+    - |check|
+    - 7.26.2.1
+    -
+  * - memmove
+    - |check|
+    - 7.26.2.3
+    -
+  * - mempcpy
+    - |check|
+    - TODO: glibc extension
+    -
+  * - memset
+    - |check|
+    - 7.26.6.1
+    -
+  * - memset_explicit
+    - |check|
+    - 7.26.6.2
+    -
+  * - stpcpy
+    - |check|
+    -
+    - https://pubs.opengroup.org/onlinepubs/9799919799/functions/stpcpy.html
+  * - stpncpy
+    - |check|
+    -
+    - https://pubs.opengroup.org/onlinepubs/9799919799/functions/stpncpy.html
+  * - strcat
+    - |check|
+    - 7.26.3.1
+    -
+  * - strchr
+    - |check|
+    - 7.26.5.3
+    -
+  * - strcmp
+    - |check|
+    - 7.26.4.2
+    -
+  * - strcoll
+    - |check|
+    - 7.26.4.3
+    -
+  * - strcpy
+    - |check|
+    - 7.26.2.4
+    -
+  * - strcspn
+    - |check|
+    - 7.26.5.4
+    -
+  * - strdup
+    - |check|
+    - 7.26.2.6
+    -
+  * - strerror
+    - |check|
+    - 7.26.6.3
+    -
+  * - strlen
+    - |check|
+    - 7.26.6.4
+    -
+  * - strncat
+    - |check|
+    - 7.26.3.2
+    -
+  * - strncmp
+    - |check|
+    - 7.26.4.4
+    -
+  * - strncpy
+    - |check|
+    - 7.26.2.5
+    -
+  * - strndup
+    - |check|
+    - 7.26.2.7
+    -
+  * - strpbrk
+    - |check|
+    - 7.26.5.5
+    -
+  * - strrchr
+    - |check|
+    - 7.26.5.6
+    -
+  * - strspn
+    - |check|
+    - 7.26.5.7
+    -
+  * - strstr
+    - |check|
+    - 7.26.5.8
+    -
+  * - strtok
+    - |check|
+    - 7.26.5.9
+    -
+  * - strtok_r
+    - |check|
+    -
+    - https://pubs.opengroup.org/onlinepubs/9799919799/functions/strtok_r.html
+  * - strxfrm
+    - |check|
+    - 7.26.4.5
+    -
diff --git a/libc/docs/headers/strings.rst b/libc/docs/headers/strings.rst
new file mode 100644
index 00000000000000..689077a655e619
--- /dev/null
+++ b/libc/docs/headers/strings.rst
@@ -0,0 +1,30 @@
+.. include:: ../check.rst
+
+=========
+strings.h
+=========
+
+Functions
+=========
+
+.. list-table::
+  :widths: auto
+  :align: center
+  :header-rows: 1
+
+  * - Function
+    - Implemented
+    - C23 Standard Section
+    - POSIX.1-2024 Standard Section
+  * - bcmp
+    -
+    -
+    - removed in POSIX.1-2008
+  * - bcopy
+    -
+    -
+    - removed in POSIX.1-2008
+  * - bzero
+    -
+    -
+    - removed in POSIX.1-2008
diff --git a/libc/docs/threads.rst b/libc/docs/headers/threads.rst
similarity index 98%
rename from libc/docs/threads.rst
rename to libc/docs/headers/threads.rst
index db2d6630a238c0..39ee049eb1f8f5 100644
--- a/libc/docs/threads.rst
+++ b/libc/docs/headers/threads.rst
@@ -1,4 +1,4 @@
-.. include:: check.rst
+.. include:: ../check.rst
 
 =========
 threads.h
diff --git a/libc/docs/date_and_time.rst b/libc/docs/headers/time.rst
similarity index 99%
rename from libc/docs/date_and_time.rst
rename to libc/docs/headers/time.rst
index b745a3b416f802..de82d80a2bec48 100644
--- a/libc/docs/date_and_time.rst
+++ b/libc/docs/headers/time.rst
@@ -1,8 +1,8 @@
-=======================
-Date and Time Functions
-=======================
+======
+time.h
+======
 
-.. include:: check.rst
+.. include:: ../check.rst
 
 ---------------
 Source location
diff --git a/libc/docs/index.rst b/libc/docs/index.rst
index 6f759aa215b62c..01f36709dfa549 100644
--- a/libc/docs/index.rst
+++ b/libc/docs/index.rst
@@ -64,19 +64,8 @@ stages there is no ABI stability in any form.
    :caption: Status
 
    compiler_support
-   date_and_time
-   math/index.rst
-   strings
-   stdio
-   stdbit
-   fenv
-   libc_search
+   headers/index.rst
    c23
-   ctype
-   complex
-   signal
-   threads
-   setjmp
 
 .. toctree::
    :hidden:
diff --git a/libc/docs/strings.rst b/libc/docs/strings.rst
deleted file mode 100644
index 427644c407ae83..00000000000000
--- a/libc/docs/strings.rst
+++ /dev/null
@@ -1,166 +0,0 @@
-================
-String Functions
-================
-
-.. include:: check.rst
-
----------------
-Source location
----------------
-
--   The main source for string functions is located at:
-    ``libc/src/string``.
-
--   The source for string conversion functions is located at:
-    ``libc/src/stdlib`` and
-    ``libc/src/__support``.
-
--   The tests are located at:
-    ``libc/test/src/string``,
-    ``libc/test/src/stdlib``, and
-    ``libc/test/src/__support``
-    respectively.
-
----------------------
-Implementation Status
----------------------
-
-Primary memory functions
-========================
-
-.. TODO(gchatelet): add details about the memory functions.
-
-
-=============  =========
-Function Name  Available
-=============  =========
-bzero          |check|
-bcmp           |check|
-bcopy          |check|
-memcpy         |check|
-memset         |check|
-memcmp         |check|
-memmove        |check|
-=============  =========
-
-
-Other Raw Memory Functions
-==========================
-
-=============  =========
-Function Name  Available
-=============  =========
-memchr         |check|
-memrchr        |check|
-memccpy        |check|
-mempcpy        |check|
-=============  =========
-
-String Memory Functions
-=======================
-
-=============  =========
-Function Name  Available
-=============  =========
-stpcpy         |check|
-stpncpy        |check|
-strcpy         |check|
-strncpy        |check|
-strcat         |check|
-strncat        |check|
-strdup         |check|
-strndup        |check|
-=============  =========
-
-String Examination Functions
-============================
-
-=============  =========
-Function Name  Available
-=============  =========
-strlen         |check|
-strnlen        |check|
-strcmp         |check|
-strncmp        |check|
-strchr         |check|
-strrchr        |check|
-strspn         |check|
-strcspn        |check|
-strpbrk        |check|
-strstr         |check|
-strtok         |check|
-strtok_r       |check|
-=============  =========
-
-String Conversion Functions
-============================
-
-These functions are not in strings.h, but are still primarily string
-functions, and are therefore tracked along with the rest of the string
-functions.
-
-The String to float functions were implemented using the Eisel-Lemire algorithm
-(read more about the algorithm here: `The Eisel-Lemire ParseNumberF64 Algorithm
-<https://nigeltao.github.io/blog/2020/eisel-lemire.html>`_). This improved
-the performance of string to float and double, and allowed it to complete this
-comprehensive test 15% faster than glibc: `Parse Number FXX Test Data
-<https://github.com/nigeltao/parse-number-fxx-test-data>`_. The test was done
-with LLVM-libc built on 2022-04-14 and Debian GLibc version 2.33-6. The targets
-``libc_str_to_float_comparison_test`` and
-``libc_system_str_to_float_comparison_test`` were built and run on the test data
-10 times each, skipping the first run since it was an outlier.
-
-
-=============  =========
-Function Name  Available
-=============  =========
-atof           |check|
-atoi           |check|
-atol           |check|
-atoll          |check|
-strtol         |check|
-strtoll        |check|
-strtoul        |check|
-strtoull       |check|
-strtof         |check|
-strtod         |check|
-strtold        |check|
-strtoimax      |check|
-strtoumax      |check|
-=============  =========
-
-String Error Functions
-======================
-
-=============  =========
-Function Name  Available
-=============  =========
-strerror       |check|
-strerror_r     |check|
-=============  =========
-
-Localized String Functions
-==========================
-
-These functions require locale.h, and will be finished when locale support is
-implemented in LLVM-libc.
-
-=============  =========
-Function Name  Available
-=============  =========
-strcoll        Partially
-strxfrm        Partially
-=============  =========
-
----------------------------
-\<name\>_s String Functions
----------------------------
-
-Many String functions have an equivalent _s version, which is intended to be
-more secure and safe than the previous standard. These functions add runtime
-error detection and overflow protection. While they can be seen as an
-improvement, adoption remains relatively low among users. In addition, they are
-being considered for removal, see
-`Field Experience With Annex K — Bounds Checking Interfaces
-<http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1967.htm>`_. For these reasons,
-there is no ongoing work to implement them.
diff --git a/libc/utils/docgen/assert.json b/libc/utils/docgen/assert.json
new file mode 100644
index 00000000000000..28ec12028ef675
--- /dev/null
+++ b/libc/utils/docgen/assert.json
@@ -0,0 +1,10 @@
+{
+  "macros": {
+    "__STDC_VERSION_ASSERT_H__": {...
[truncated]

Copy link
Contributor

@michaelrj-google michaelrj-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to wait until the strings.h situation is handled before landing this.

@nickdesaulniers
Copy link
Member Author

SGTM; filed #118875. Cleaning that up can land before this then.

@nickdesaulniers nickdesaulniers marked this pull request as draft December 5, 2024 21:43
nickdesaulniers added a commit to nickdesaulniers/llvm-project that referenced this pull request Dec 5, 2024
…p to strings.h

docgen relies on the convention that we have a file foo.cpp in
libc/src/<header>/. Because the above functions weren't in libc/src/strings/
but rather libc/src/string/, docgen could not find that we had implemented
these.

Rather than add special carve outs to docgen, let's fix up our sources for
these 7 functions to stick with the existing conventions the rest of the
codebase follows.

Link: llvm#118860
Fixes: llvm#118875
@nickdesaulniers
Copy link
Member Author

#118899

nickdesaulniers added a commit that referenced this pull request Dec 10, 2024
…p to strings.h (#118899)

docgen relies on the convention that we have a file foo.cpp in
libc/src/\<header\>/. Because the above functions weren't in libc/src/strings/
but rather libc/src/string/, docgen could not find that we had implemented
these.

Rather than add special carve outs to docgen, let's fix up our sources for
these 7 functions to stick with the existing conventions the rest of the
codebase follows.

Link: #118860
Fixes: #118875
…b.h, and inttypes.h

We should add support to docgen for mentioning glibc extensions (mempcpy) or
extensions from other libcs.

Link: llvm#118875
Link: llvm#118899
@nickdesaulniers nickdesaulniers marked this pull request as ready for review December 10, 2024 17:27
@nickdesaulniers nickdesaulniers marked this pull request as draft December 10, 2024 17:42
@nickdesaulniers nickdesaulniers marked this pull request as ready for review December 10, 2024 17:49
Copy link
Contributor

@michaelrj-google michaelrj-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM now that the strings split has landed

@nickdesaulniers nickdesaulniers merged commit 02e39a1 into llvm:main Dec 10, 2024
13 of 14 checks passed
@nickdesaulniers nickdesaulniers deleted the docs_split_strings branch December 10, 2024 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants