Skip to content

Conversation

@frobtech
Copy link
Contributor

The hdrgen output is C, not C++.

The hdrgen output is C, not C++.
@frobtech frobtech marked this pull request as ready for review January 16, 2025 22:03
@llvmbot llvmbot added the libc label Jan 16, 2025
@llvmbot
Copy link
Member

llvmbot commented Jan 16, 2025

@llvm/pr-subscribers-libc

Author: Roland McGrath (frobtech)

Changes

The hdrgen output is C, not C++.


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

2 Files Affected:

  • (modified) libc/utils/hdrgen/function.py (+1-1)
  • (modified) libc/utils/hdrgen/tests/expected_output/test_header.h (+2-2)
diff --git a/libc/utils/hdrgen/function.py b/libc/utils/hdrgen/function.py
index d97df7f8a50ec5..8ae47e574785fa 100644
--- a/libc/utils/hdrgen/function.py
+++ b/libc/utils/hdrgen/function.py
@@ -22,7 +22,7 @@ def __init__(
 
     def __str__(self):
         attributes_str = " ".join(self.attributes)
-        arguments_str = ", ".join(self.arguments)
+        arguments_str = ", ".join(self.arguments) if self.arguments else "void"
         if attributes_str == "":
             result = f"{self.return_type} {self.name}({arguments_str})"
         else:
diff --git a/libc/utils/hdrgen/tests/expected_output/test_header.h b/libc/utils/hdrgen/tests/expected_output/test_header.h
index a777976134b045..d730078fba0649 100644
--- a/libc/utils/hdrgen/tests/expected_output/test_header.h
+++ b/libc/utils/hdrgen/tests/expected_output/test_header.h
@@ -28,10 +28,10 @@ enum {
 
 __BEGIN_C_DECLS
 
-CONST_FUNC_A void func_a() __NOEXCEPT;
+CONST_FUNC_A void func_a(void) __NOEXCEPT;
 
 #ifdef LIBC_TYPES_HAS_FLOAT128
-float128 func_b() __NOEXCEPT;
+float128 func_b(void) __NOEXCEPT;
 #endif // LIBC_TYPES_HAS_FLOAT128
 
 #ifdef LIBC_TYPES_HAS_FLOAT16

@frobtech frobtech requested review from lntue and petrhosek January 16, 2025 23:14
@frobtech frobtech merged commit 906cbbb into llvm:main Jan 17, 2025
9 of 10 checks passed
@frobtech frobtech deleted the p/libc-hdrgen-noargs branch January 17, 2025 03:20
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