[libc-commits] [libc] b37bdad - [libc] newheadergen: adding h_def_file arg to test (#99397)
via libc-commits
libc-commits at lists.llvm.org
Thu Jul 18 10:56:29 PDT 2024
Author: aaryanshukla
Date: 2024-07-18T10:56:26-07:00
New Revision: b37bdadbe784339e455915368a4893d3bd4a1193
URL: https://github.com/llvm/llvm-project/commit/b37bdadbe784339e455915368a4893d3bd4a1193
DIFF: https://github.com/llvm/llvm-project/commit/b37bdadbe784339e455915368a4893d3bd4a1193.diff
LOG: [libc] newheadergen: adding h_def_file arg to test (#99397)
- spacing with _NOEXCEPT
Added:
Modified:
libc/newhdrgen/class_implementation/classes/function.py
libc/newhdrgen/header.py
libc/newhdrgen/tests/test_integration.py
Removed:
libc/newhdrgen/tests/output/test_small.h
################################################################################
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()
diff --git a/libc/newhdrgen/tests/output/test_small.h b/libc/newhdrgen/tests/output/test_small.h
deleted file mode 100644
index a777976134b04..0000000000000
--- a/libc/newhdrgen/tests/output/test_small.h
+++ /dev/null
@@ -1,52 +0,0 @@
-//===-- C standard library header test_small-------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_LIBC_TEST_SMALL_H
-#define LLVM_LIBC_TEST_SMALL_H
-
-#include "__llvm-libc-common.h"
-#include "llvm-libc-macros/float16-macros.h"
-#include "llvm-libc-macros/test_small-macros.h"
-#include "llvm-libc-types/float128.h"
-
-#define MACRO_A 1
-
-#define MACRO_B 2
-
-#include <llvm-libc-types/type_a.h>
-#include <llvm-libc-types/type_b.h>
-
-enum {
- enum_a = value_1,
- enum_b = value_2,
-};
-
-__BEGIN_C_DECLS
-
-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_d(int, float) __NOEXCEPT;
-#endif // LIBC_TYPES_HAS_FLOAT16
-
-#ifdef LIBC_TYPES_HAS_FLOAT16_AND_FLOAT128
-_Float16 func_e(float128) __NOEXCEPT;
-#endif // LIBC_TYPES_HAS_FLOAT16_AND_FLOAT128
-
-extern obj object_1;
-extern obj object_2;
-
-__END_C_DECLS
-
-#endif // LLVM_LIBC_TEST_SMALL_H
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),
More information about the libc-commits
mailing list