Skip to content

[libc] clean up duplicated includes in generated headers #124524

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

Merged
merged 3 commits into from
Jan 28, 2025

Conversation

alexprabhat99
Copy link
Contributor

@alexprabhat99 alexprabhat99 commented Jan 27, 2025

Fixes: #124149

@llvmbot llvmbot added the libc label Jan 27, 2025
@llvmbot
Copy link
Member

llvmbot commented Jan 27, 2025

@llvm/pr-subscribers-libc

Author: Alex Prabhat Bara (alexprabhat99)

Changes

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

9 Files Affected:

  • (modified) libc/include/locale.h.def (-2)
  • (modified) libc/include/locale.yaml (+3)
  • (modified) libc/include/math.h.def (-1)
  • (modified) libc/include/setjmp.h.def (-1)
  • (modified) libc/include/stdlib.h.def (-1)
  • (modified) libc/include/stdlib.yaml (+1)
  • (modified) libc/include/string.h.def (-1)
  • (modified) libc/include/string.yaml (+1)
  • (modified) libc/include/wchar.h.def (-2)
diff --git a/libc/include/locale.h.def b/libc/include/locale.h.def
index 516c6e6275e681..930373eade4d5d 100644
--- a/libc/include/locale.h.def
+++ b/libc/include/locale.h.def
@@ -12,8 +12,6 @@
 #include "__llvm-libc-common.h"
 
 #include "llvm-libc-macros/locale-macros.h"
-#include "llvm-libc-types/locale_t.h"
-#include "llvm-libc-types/struct_lconv.h"
 
 %%public_api()
 
diff --git a/libc/include/locale.yaml b/libc/include/locale.yaml
index 9ff53c16398a59..6c71b70e59f0b6 100644
--- a/libc/include/locale.yaml
+++ b/libc/include/locale.yaml
@@ -1,5 +1,8 @@
 header: locale.h
 header_template: locale.h.def
+types:
+  - type_name: locale_t
+  - type_name: struct_lconv
 functions:
   - name: localeconv
     standards:
diff --git a/libc/include/math.h.def b/libc/include/math.h.def
index 9822d8bd7ba173..9cfc2f7ea084e4 100644
--- a/libc/include/math.h.def
+++ b/libc/include/math.h.def
@@ -12,7 +12,6 @@
 #include "__llvm-libc-common.h"
 #include "llvm-libc-macros/float16-macros.h"
 #include "llvm-libc-macros/math-macros.h"
-#include "llvm-libc-types/float128.h"
 
 
 %%public_api()
diff --git a/libc/include/setjmp.h.def b/libc/include/setjmp.h.def
index cb083b8cd023e0..670bc1ac0fe245 100644
--- a/libc/include/setjmp.h.def
+++ b/libc/include/setjmp.h.def
@@ -10,7 +10,6 @@
 #define LLVM_LIBC_SETJMP_H
 
 #include "__llvm-libc-common.h"
-#include "llvm-libc-types/jmp_buf.h"
 
 %%public_api()
 
diff --git a/libc/include/stdlib.h.def b/libc/include/stdlib.h.def
index 01b0e1a2395a29..d523f7a53024aa 100644
--- a/libc/include/stdlib.h.def
+++ b/libc/include/stdlib.h.def
@@ -10,7 +10,6 @@
 #define LLVM_LIBC_STDLIB_H
 
 #include "__llvm-libc-common.h"
-#include "llvm-libc-types/locale_t.h"
 #include "llvm-libc-macros/stdlib-macros.h"
 
 %%public_api()
diff --git a/libc/include/stdlib.yaml b/libc/include/stdlib.yaml
index 4b68f272613b10..78a5d2f939c0e1 100644
--- a/libc/include/stdlib.yaml
+++ b/libc/include/stdlib.yaml
@@ -12,6 +12,7 @@ types:
   - type_name: lldiv_t
   - type_name: ldiv_t
   - type_name: div_t
+  - type_name: locale_t
 enums: []
 objects: []
 functions:
diff --git a/libc/include/string.h.def b/libc/include/string.h.def
index e180f0d2561d3a..1bd2687db2beac 100644
--- a/libc/include/string.h.def
+++ b/libc/include/string.h.def
@@ -11,7 +11,6 @@
 
 #include "__llvm-libc-common.h"
 
-#include "llvm-libc-types/locale_t.h"
 #include "llvm-libc-macros/null-macro.h"
 
 %%public_api()
diff --git a/libc/include/string.yaml b/libc/include/string.yaml
index deded309abc2cb..68077b8aa9dc01 100644
--- a/libc/include/string.yaml
+++ b/libc/include/string.yaml
@@ -3,6 +3,7 @@ header_template: string.h.def
 macros: []
 types:
   - type_name: size_t
+  - type_name: locale_t
 enums: []
 objects: []
 functions:
diff --git a/libc/include/wchar.h.def b/libc/include/wchar.h.def
index d0de1a6762a392..4c25de700d6063 100644
--- a/libc/include/wchar.h.def
+++ b/libc/include/wchar.h.def
@@ -11,8 +11,6 @@
 
 #include "__llvm-libc-common.h"
 #include "llvm-libc-macros/wchar-macros.h"
-#include "llvm-libc-types/wint_t.h"
-#include "llvm-libc-types/mbstate_t.h"
 
 %%public_api()
 

@alexprabhat99
Copy link
Contributor Author

Hi @nickdesaulniers
Could you please review this PR?
Thank you.

Copy link
Member

@nickdesaulniers nickdesaulniers left a comment

Choose a reason for hiding this comment

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

Thanks for the patch! This looks like almost all of them; I think you can clean up the inclusion of struct_timeval.h in libc/sys/time.h.def in this PR, too. libc/sys/time.yaml should be updated to include struct_timeval type_name.

@alexprabhat99
Copy link
Contributor Author

Hi @nickdesaulniers
Could you please review this PR?
Thank you!

Copy link
Member

@nickdesaulniers nickdesaulniers left a comment

Choose a reason for hiding this comment

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

Thanks for the patch! Need us to merge this for you?

@alexprabhat99
Copy link
Contributor Author

Thanks for the patch! Need us to merge this for you?

Yes, please.
Thank you!

@nickdesaulniers nickdesaulniers merged commit a255da0 into llvm:main Jan 28, 2025
14 checks passed
@alexprabhat99 alexprabhat99 deleted the cleanup-duplicated-includes branch January 31, 2025 05:25
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.

[libc] clean up duplicated includes in generated headers
3 participants