Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libc] newheadergen: quick fixes to tests #98561

Merged
merged 1 commit into from
Jul 11, 2024

Conversation

aaryanshukla
Copy link
Contributor

  • if there is an object made there is a space after
  • fixed tests.yaml -- spacing between characters issue

- if there is an object made there is a space after
- fixed tests.yaml -- spacing between characters issue
@llvmbot llvmbot added the libc label Jul 11, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Jul 11, 2024

@llvm/pr-subscribers-libc

Author: None (aaryanshukla)

Changes
  • if there is an object made there is a space after
  • fixed tests.yaml -- spacing between characters issue

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

3 Files Affected:

  • (modified) libc/newhdrgen/header.py (+4-1)
  • (modified) libc/newhdrgen/tests/expected_output/test_header.h (+2-2)
  • (modified) libc/newhdrgen/tests/input/test_small.yaml (+4-2)
diff --git a/libc/newhdrgen/header.py b/libc/newhdrgen/header.py
index d9e9c68dfc5f4..ca960b639ab10 100644
--- a/libc/newhdrgen/header.py
+++ b/libc/newhdrgen/header.py
@@ -62,6 +62,9 @@ def __str__(self):
             content.append("")
         for object in self.objects:
             content.append(str(object))
-        content.append("__END_C_DECLS")
+        if self.objects:
+            content.append("\n__END_C_DECLS")
+        else:
+            content.append("__END_C_DECLS")
 
         return "\n".join(content)
diff --git a/libc/newhdrgen/tests/expected_output/test_header.h b/libc/newhdrgen/tests/expected_output/test_header.h
index d6ae0d0e282e7..02ca8ecf196ed 100644
--- a/libc/newhdrgen/tests/expected_output/test_header.h
+++ b/libc/newhdrgen/tests/expected_output/test_header.h
@@ -27,11 +27,11 @@ enum {
 __BEGIN_C_DECLS
 
 #ifdef FUNC_A_16
-void func_a()CONST_FUNC_A;
+CONST_FUNC_A void func_a() __NOEXCEPT;
 #endif // FUNC_A_16
 
 #ifdef FUNC_B_16
-int func_b(int, float)CONST_FUNC_B;
+CONST_FUNC_B int func_b(int, float) __NOEXCEPT;
 #endif // FUNC_B_16
 
 extern obj object_1;
diff --git a/libc/newhdrgen/tests/input/test_small.yaml b/libc/newhdrgen/tests/input/test_small.yaml
index 0bc292db72396..7d657d9ecad5f 100644
--- a/libc/newhdrgen/tests/input/test_small.yaml
+++ b/libc/newhdrgen/tests/input/test_small.yaml
@@ -24,7 +24,8 @@ functions:
     standards: 
       - stdc
     guard: FUNC_A_16
-    attributes: CONST_FUNC_A
+    attributes: 
+      - CONST_FUNC_A
   - name: func_b
     return_type: int
     arguments:
@@ -33,4 +34,5 @@ functions:
     standards: 
       - stdc
     guard: FUNC_B_16
-    attributes: CONST_FUNC_B
+    attributes: 
+      - CONST_FUNC_B

Copy link
Contributor

@RoseZhang03 RoseZhang03 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@aaryanshukla aaryanshukla merged commit ac304d5 into llvm:main Jul 11, 2024
6 of 7 checks passed
aaryanshukla added a commit to aaryanshukla/llvm-project that referenced this pull request Jul 14, 2024
- if there is an object made there is a space after
- fixed tests.yaml -- spacing between characters issue
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.

4 participants