[libc-commits] [libc] [libc] newheadergen: adding h_def_file arg to test (PR #99397)

via libc-commits libc-commits at lists.llvm.org
Wed Jul 17 15:32:28 PDT 2024


https://github.com/aaryanshukla updated https://github.com/llvm/llvm-project/pull/99397

>From 30a5f918af32da05ee31a38ac8512db746def0ac Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Wed, 17 Jul 2024 22:15:49 +0000
Subject: [PATCH 1/2] [libc] newheadergen: adding h_def_file arg to test

- spacing with _NOEXCEPT
---
 libc/newhdrgen/tests/output/test_small.h | 8 ++++----
 libc/newhdrgen/tests/test_integration.py | 1 +
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/libc/newhdrgen/tests/output/test_small.h b/libc/newhdrgen/tests/output/test_small.h
index a777976134b04..a1ed28e391ffd 100644
--- a/libc/newhdrgen/tests/output/test_small.h
+++ b/libc/newhdrgen/tests/output/test_small.h
@@ -28,20 +28,20 @@ enum {
 
 __BEGIN_C_DECLS
 
-CONST_FUNC_A void func_a() __NOEXCEPT;
+CONST_FUNC_A void func_a()__NOEXCEPT;
 
 #ifdef LIBC_TYPES_HAS_FLOAT128
 float128 func_b() __NOEXCEPT;
 #endif // LIBC_TYPES_HAS_FLOAT128
 
 #ifdef LIBC_TYPES_HAS_FLOAT16
-_Float16 func_c(int, float) __NOEXCEPT;
+_Float16 func_c(int, float)__NOEXCEPT;
 
-_Float16 func_d(int, float) __NOEXCEPT;
+_Float16 func_d(int, float)__NOEXCEPT;
 #endif // LIBC_TYPES_HAS_FLOAT16
 
 #ifdef LIBC_TYPES_HAS_FLOAT16_AND_FLOAT128
-_Float16 func_e(float128) __NOEXCEPT;
+_Float16 func_e(float128)__NOEXCEPT;
 #endif // LIBC_TYPES_HAS_FLOAT16_AND_FLOAT128
 
 extern obj object_1;
diff --git a/libc/newhdrgen/tests/test_integration.py b/libc/newhdrgen/tests/test_integration.py
index f12d18bc04a49..628a37b11c309 100644
--- a/libc/newhdrgen/tests/test_integration.py
+++ b/libc/newhdrgen/tests/test_integration.py
@@ -25,6 +25,7 @@ def run_script(self, yaml_file, h_def_file, output_dir):
                 "python3",
                 str(self.source_dir / "libc/newhdrgen/yaml_to_classes.py"),
                 str(yaml_file),
+                "--h_def_file",
                 str(h_def_file),
                 "--output_dir",
                 str(output_dir),

>From 4b78044b6d36d389199104258142b21340a30eb6 Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Wed, 17 Jul 2024 22:29:40 +0000
Subject: [PATCH 2/2] spacing for __NOEXCEPT

---
 libc/newhdrgen/class_implementation/classes/function.py | 2 +-
 libc/newhdrgen/header.py                                | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libc/newhdrgen/class_implementation/classes/function.py b/libc/newhdrgen/class_implementation/classes/function.py
index ccfd93547c1d8..845ef1aebf54b 100644
--- a/libc/newhdrgen/class_implementation/classes/function.py
+++ b/libc/newhdrgen/class_implementation/classes/function.py
@@ -26,7 +26,7 @@ def __str__(self):
         attributes_str = " ".join(self.attributes)
         arguments_str = ", ".join(self.arguments)
         if attributes_str == "":
-            result = f"{self.return_type} {self.name}({arguments_str});"
+            result = f"{self.return_type} {self.name}({arguments_str})"
         else:
             result = f"{attributes_str} {self.return_type} {self.name}({arguments_str})"
         return result
diff --git a/libc/newhdrgen/header.py b/libc/newhdrgen/header.py
index 69de81eebb719..141e3c9b2736b 100644
--- a/libc/newhdrgen/header.py
+++ b/libc/newhdrgen/header.py
@@ -60,16 +60,16 @@ def __str__(self):
         current_guard = None
         for function in self.functions:
             if function.guard == None:
-                content.append(str(function) + "__NOEXCEPT")
+                content.append(str(function) + " __NOEXCEPT;")
                 content.append("")
             else:
                 if current_guard == None:
                     current_guard = function.guard
                     content.append(f"#ifdef {current_guard}")
-                    content.append(str(function) + "__NOEXCEPT")
+                    content.append(str(function) + " __NOEXCEPT;")
                     content.append("")
                 elif current_guard == function.guard:
-                    content.append(str(function) + "__NOEXCEPT")
+                    content.append(str(function) + " __NOEXCEPT;")
                     content.append("")
                 else:
                     content.pop()
@@ -77,7 +77,7 @@ def __str__(self):
                     content.append("")
                     current_guard = function.guard
                     content.append(f"#ifdef {current_guard}")
-                    content.append(str(function) + "__NOEXCEPT")
+                    content.append(str(function) + " __NOEXCEPT;")
                     content.append("")
         if current_guard != None:
             content.pop()



More information about the libc-commits mailing list