Skip to content

Commit 906cbbb

Browse files
authored
[libc] Fix hdrgen output for no-argument functions (llvm#123245)
The hdrgen output is C, not C++.
1 parent 1fa02b9 commit 906cbbb

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

libc/utils/hdrgen/function.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def __init__(
2222

2323
def __str__(self):
2424
attributes_str = " ".join(self.attributes)
25-
arguments_str = ", ".join(self.arguments)
25+
arguments_str = ", ".join(self.arguments) if self.arguments else "void"
2626
if attributes_str == "":
2727
result = f"{self.return_type} {self.name}({arguments_str})"
2828
else:

libc/utils/hdrgen/tests/expected_output/test_header.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ enum {
2828

2929
__BEGIN_C_DECLS
3030

31-
CONST_FUNC_A void func_a() __NOEXCEPT;
31+
CONST_FUNC_A void func_a(void) __NOEXCEPT;
3232

3333
#ifdef LIBC_TYPES_HAS_FLOAT128
34-
float128 func_b() __NOEXCEPT;
34+
float128 func_b(void) __NOEXCEPT;
3535
#endif // LIBC_TYPES_HAS_FLOAT128
3636

3737
#ifdef LIBC_TYPES_HAS_FLOAT16

0 commit comments

Comments
 (0)