Skip to content

Conversation

nickdesaulniers
Copy link
Member

  • [libc][docgen] Use Macro for macro table name
  • fix setjmp json, otherwise can't regen
  • regen all docs

Otherwise we render the table under the Macros section with a column header
that says Function when it should say Macro.
@llvmbot
Copy link
Member

llvmbot commented Dec 4, 2024

@llvm/pr-subscribers-libc

Author: Nick Desaulniers (nickdesaulniers)

Changes
  • [libc][docgen] Use Macro for macro table name
  • fix setjmp json, otherwise can't regen
  • regen all docs

Full diff: https://github.com/llvm/llvm-project/pull/118709.diff

7 Files Affected:

  • (modified) libc/docs/fenv.rst (+1-1)
  • (modified) libc/docs/setjmp.rst (+30-3)
  • (modified) libc/docs/signal.rst (+1-1)
  • (modified) libc/docs/stdbit.rst (+1-1)
  • (modified) libc/docs/threads.rst (+1-1)
  • (modified) libc/utils/docgen/docgen.py (+4-4)
  • (modified) libc/utils/docgen/setjmp.json (+5-5)
diff --git a/libc/docs/fenv.rst b/libc/docs/fenv.rst
index e7a5a3fb2c815e..2492e22d2fd78d 100644
--- a/libc/docs/fenv.rst
+++ b/libc/docs/fenv.rst
@@ -12,7 +12,7 @@ Macros
   :align: center
   :header-rows: 1
 
-  * - Function
+  * - Macro
     - Implemented
     - C23 Standard Section
     - POSIX.1-2017 Standard Section
diff --git a/libc/docs/setjmp.rst b/libc/docs/setjmp.rst
index d9188dfe1d5e47..dd7e0aca3b9cda 100644
--- a/libc/docs/setjmp.rst
+++ b/libc/docs/setjmp.rst
@@ -1,7 +1,28 @@
 .. include:: check.rst
 
-setjmp.h Functions
-==================
+========
+setjmp.h
+========
+
+Macros
+======
+
+.. list-table::
+  :widths: auto
+  :align: center
+  :header-rows: 1
+
+  * - Macro
+    - Implemented
+    - C23 Standard Section
+    - POSIX.1-2017 Standard Section
+  * - __STDC_VERSION_SETJMP_H__
+    -
+    - 7.13.2
+    -
+
+Functions
+=========
 
 .. list-table::
   :widths: auto
@@ -10,7 +31,13 @@ setjmp.h Functions
 
   * - Function
     - Implemented
-    - Standard
+    - C23 Standard Section
+    - POSIX.1-2017 Standard Section
   * - longjmp
     - |check|
     - 7.13.2.1
+    -
+  * - setjmp
+    - |check|
+    - 7.13.1.1
+    -
diff --git a/libc/docs/signal.rst b/libc/docs/signal.rst
index d1a7cb60956022..e12f67b0c61c0b 100644
--- a/libc/docs/signal.rst
+++ b/libc/docs/signal.rst
@@ -12,7 +12,7 @@ Macros
   :align: center
   :header-rows: 1
 
-  * - Function
+  * - Macro
     - Implemented
     - C23 Standard Section
     - POSIX.1-2017 Standard Section
diff --git a/libc/docs/stdbit.rst b/libc/docs/stdbit.rst
index 71f9bbfd1d000e..e6b82bb77a14aa 100644
--- a/libc/docs/stdbit.rst
+++ b/libc/docs/stdbit.rst
@@ -12,7 +12,7 @@ Macros
   :align: center
   :header-rows: 1
 
-  * - Function
+  * - Macro
     - Implemented
     - C23 Standard Section
     - POSIX.1-2017 Standard Section
diff --git a/libc/docs/threads.rst b/libc/docs/threads.rst
index 63cd6c40e14551..db0edacf7b4680 100644
--- a/libc/docs/threads.rst
+++ b/libc/docs/threads.rst
@@ -12,7 +12,7 @@ Macros
   :align: center
   :header-rows: 1
 
-  * - Function
+  * - Macro
     - Implemented
     - C23 Standard Section
     - POSIX.1-2017 Standard Section
diff --git a/libc/utils/docgen/docgen.py b/libc/utils/docgen/docgen.py
index 25e22d4d587785..af5d00a5cbf8c7 100755
--- a/libc/utils/docgen/docgen.py
+++ b/libc/utils/docgen/docgen.py
@@ -92,7 +92,7 @@ def load_api(header: Header) -> Dict:
     return json.loads(api)
 
 
-def print_tbl_dir():
+def print_tbl_dir(name):
     print(
         f"""
 .. list-table::
@@ -100,7 +100,7 @@ def print_tbl_dir():
   :align: center
   :header-rows: 1
 
-  * - Function
+  * - {name}
     - Implemented
     - C23 Standard Section
     - POSIX.1-2017 Standard Section"""
@@ -112,7 +112,7 @@ def print_functions_rst(header: Header, functions: Dict):
     print(tbl_hdr)
     print("=" * len(tbl_hdr))
 
-    print_tbl_dir()
+    print_tbl_dir("Function")
 
     for name in sorted(functions.keys()):
         print(f"  * - {name}")
@@ -138,7 +138,7 @@ def print_macros_rst(header: Header, macros: Dict):
     print(tbl_hdr)
     print("=" * len(tbl_hdr))
 
-    print_tbl_dir()
+    print_tbl_dir("Macro")
 
     for name in sorted(macros.keys()):
         print(f"  * - {name}")
diff --git a/libc/utils/docgen/setjmp.json b/libc/utils/docgen/setjmp.json
index 38d4af568926a2..0b9a4e65da4f6a 100644
--- a/libc/utils/docgen/setjmp.json
+++ b/libc/utils/docgen/setjmp.json
@@ -1,15 +1,15 @@
 {
   "macros": {
     "__STDC_VERSION_SETJMP_H__": {
-      "defined": "7.13.2"
-    },
-    "setjmp": {
-      "defined": "7.13.1.1"
+      "c-definition": "7.13.2"
     }
   },
   "functions": {
+    "setjmp": {
+      "c-definition": "7.13.1.1"
+    },
     "longjmp": {
-      "defined": "7.13.2.1"
+      "c-definition": "7.13.2.1"
     }
   }
 }

@nickdesaulniers
Copy link
Member Author

I'm probably going to merge the functionality of docgen into hdrgen, but for now, there's some smaller cleanups I'd like to do first.

@nickdesaulniers nickdesaulniers merged commit 659834d into llvm:main Dec 4, 2024
8 of 9 checks passed
@nickdesaulniers nickdesaulniers deleted the docgen_refresh branch December 4, 2024 23:43
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