[libc-commits] [libc] [libc][docs] stub out assert, errno, and locale (PR #118852)
Nick Desaulniers via libc-commits
libc-commits at lists.llvm.org
Thu Dec 5 14:17:21 PST 2024
https://github.com/nickdesaulniers updated https://github.com/llvm/llvm-project/pull/118852
>From 8f483b3098c42ea62d50075662178268ba8fd9a3 Mon Sep 17 00:00:00 2001
From: Nick Desaulniers <ndesaulniers at google.com>
Date: Thu, 5 Dec 2024 10:11:28 -0800
Subject: [PATCH] [libc][docs] stub out assert, errno, and locale
These were the remaining c89 library headers (besides string.h and stdlib.h; I
will split strings.rst in a follow up commit).
The macro support detection in docgen doesn't quite work for some of these
headers. Add the stubs for these headers for now, and fix up docgen later.
See the "NIST publication":
Link: https://www.open-std.org/jtc1/sc22/wg14/www/projects.html
---
libc/docs/headers/assert.rst | 27 +++++++++++++++
libc/docs/headers/errno.rst | 35 +++++++++++++++++++
libc/docs/headers/index.rst | 3 ++
libc/docs/headers/locale.rst | 63 +++++++++++++++++++++++++++++++++++
libc/utils/docgen/assert.json | 10 ++++++
libc/utils/docgen/errno.json | 16 +++++++++
libc/utils/docgen/locale.json | 30 +++++++++++++++++
7 files changed, 184 insertions(+)
create mode 100644 libc/docs/headers/assert.rst
create mode 100644 libc/docs/headers/errno.rst
create mode 100644 libc/docs/headers/locale.rst
create mode 100644 libc/utils/docgen/assert.json
create mode 100644 libc/utils/docgen/errno.json
create mode 100644 libc/utils/docgen/locale.json
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/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/headers/index.rst b/libc/docs/headers/index.rst
index 2a7bf59e0b56db..7a9186a7c66e86 100644
--- a/libc/docs/headers/index.rst
+++ b/libc/docs/headers/index.rst
@@ -4,9 +4,12 @@ Implementation Status
.. toctree::
:maxdepth: 1
+ assert
complex
ctype
+ errno
fenv
+ locale
math/index.rst
search
setjmp
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/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__": {
+ "c-definition": "7.2.1"
+ },
+ "assert": {
+ "c-definition": "7.2.1"
+ }
+ }
+}
diff --git a/libc/utils/docgen/errno.json b/libc/utils/docgen/errno.json
new file mode 100644
index 00000000000000..aface8e42b495f
--- /dev/null
+++ b/libc/utils/docgen/errno.json
@@ -0,0 +1,16 @@
+{
+ "macros": {
+ "EDOM": {
+ "c-definition": "7.5"
+ },
+ "EILSEQ": {
+ "c-definition": "7.5"
+ },
+ "ERANGE": {
+ "c-definition": "7.5"
+ },
+ "errno": {
+ "c-definition": "7.5"
+ }
+ }
+}
diff --git a/libc/utils/docgen/locale.json b/libc/utils/docgen/locale.json
new file mode 100644
index 00000000000000..89329f9aae5b0f
--- /dev/null
+++ b/libc/utils/docgen/locale.json
@@ -0,0 +1,30 @@
+{
+ "macros": {
+ "LC_ALL": {
+ "c-definition": "7.11"
+ },
+ "LC_COLLATE": {
+ "c-definition": "7.11"
+ },
+ "LC_CTYPE": {
+ "c-definition": "7.11"
+ },
+ "LC_MONETARY": {
+ "c-definition": "7.11"
+ },
+ "LC_NUMERIC": {
+ "c-definition": "7.11"
+ },
+ "LC_TIME": {
+ "c-definition": "7.11"
+ }
+ },
+ "functions": {
+ "setlocale": {
+ "c-definition": "7.11.1.1"
+ },
+ "localeconv": {
+ "c-definition": "7.11.2.1"
+ }
+ }
+}
More information about the libc-commits
mailing list