Skip to content

[WIP] Enough to get libc to build clang on aarch64 #97231

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

Draft
wants to merge 44 commits into
base: main
Choose a base branch
from

Conversation

izaakschroeder
Copy link
Contributor

Companion to #97191

@izaakschroeder izaakschroeder changed the title Enough to get libc to build clang [WIP] Enough to get libc to build clang Jun 30, 2024
@izaakschroeder izaakschroeder mentioned this pull request Jun 30, 2024
39 tasks
@izaakschroeder izaakschroeder changed the title [WIP] Enough to get libc to build clang [WIP] Enough to get libc to build clang on aarch64 Jun 30, 2024
Copy link

github-actions bot commented Jul 1, 2024

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff 038bc1c18c786e14cc306401b00144265f8860f5 ad17b28dbb90a72226fed9f359595be796a79820 -- libc/include/llvm-libc-macros/dlfcn-macros.h libc/include/llvm-libc-macros/elf-macros.h libc/include/llvm-libc-macros/locale-macros.h libc/include/llvm-libc-types/Dl_info.h libc/include/llvm-libc-types/__dl_iterate_phdr_callback_t.h libc/include/llvm-libc-types/locale_t.h libc/include/llvm-libc-types/struct_dl_phdr_info.h libc/include/llvm-libc-types/struct_lconv.h libc/src/ctype/isdigit_l.cpp libc/src/ctype/isdigit_l.h libc/src/ctype/islower_l.cpp libc/src/ctype/islower_l.h libc/src/ctype/isupper_l.cpp libc/src/ctype/isupper_l.h libc/src/ctype/isxdigit_l.cpp libc/src/ctype/isxdigit_l.h libc/src/ctype/tolower_l.cpp libc/src/ctype/tolower_l.h libc/src/ctype/toupper_l.cpp libc/src/ctype/toupper_l.h libc/src/dlfcn/dladdr.cpp libc/src/dlfcn/dladdr.h libc/src/dlfcn/dlclose.cpp libc/src/dlfcn/dlclose.h libc/src/dlfcn/dlerror.cpp libc/src/dlfcn/dlerror.h libc/src/dlfcn/dlopen.cpp libc/src/dlfcn/dlopen.h libc/src/dlfcn/dlsym.cpp libc/src/dlfcn/dlsym.h libc/src/link/dl_iterate_phdr.cpp libc/src/link/dl_iterate_phdr.h libc/src/locale/duplocale.cpp libc/src/locale/duplocale.h libc/src/locale/freelocale.cpp libc/src/locale/freelocale.h libc/src/locale/localeconv.cpp libc/src/locale/localeconv.h libc/src/locale/newlocale.cpp libc/src/locale/newlocale.h libc/src/locale/setlocale.cpp libc/src/locale/setlocale.h libc/src/locale/uselocale.cpp libc/src/locale/uselocale.h libc/src/stdio/vasprintf.cpp libc/src/stdio/vasprintf.h libc/src/stdio/vsscanf.cpp libc/src/stdio/vsscanf.h libc/src/stdlib/strtod_l.cpp libc/src/stdlib/strtod_l.h libc/src/stdlib/strtof_l.cpp libc/src/stdlib/strtof_l.h libc/src/stdlib/strtold_l.cpp libc/src/stdlib/strtold_l.h libc/src/stdlib/strtoll_l.cpp libc/src/stdlib/strtoll_l.h libc/src/stdlib/strtoull_l.cpp libc/src/stdlib/strtoull_l.h libc/src/string/strcoll_l.cpp libc/src/string/strcoll_l.h libc/src/string/strxfrm_l.cpp libc/src/string/strxfrm_l.h libc/src/sys/ioctl/ioctl.h libc/src/sys/ioctl/linux/ioctl.cpp libc/src/sys/resource/getrusage.h libc/src/sys/resource/linux/getrusage.cpp libc/src/sys/time/linux/utimes.cpp libc/src/sys/time/utimes.h libc/src/time/strftime.cpp libc/src/time/strftime.h libc/src/time/strftime_l.cpp libc/src/time/strftime_l.h libc/include/llvm-libc-macros/link-macros.h libc/include/llvm-libc-macros/linux/sys-resource-macros.h libc/include/llvm-libc-macros/stdlib-macros.h libc/src/stdlib/exit_handler.h libcxx/include/__config libcxx/include/locale libcxx/src/locale.cpp libunwind/src/UnwindCursor.hpp
View the diff from clang-format here.
diff --git a/libc/include/llvm-libc-macros/linux/sys-resource-macros.h b/libc/include/llvm-libc-macros/linux/sys-resource-macros.h
index 5af6e658e0..36abe47350 100644
--- a/libc/include/llvm-libc-macros/linux/sys-resource-macros.h
+++ b/libc/include/llvm-libc-macros/linux/sys-resource-macros.h
@@ -28,8 +28,8 @@
 
 #define RLIM_INFINITY (~0UL)
 
-#define RUSAGE_SELF     0
+#define RUSAGE_SELF 0
 #define RUSAGE_CHILDREN (~0UL)
-#define RUSAGE_THREAD   1
+#define RUSAGE_THREAD 1
 
 #endif // LLVM_LIBC_MACROS_LINUX_SYS_RESOURCE_MACROS_H
diff --git a/libc/include/llvm-libc-macros/locale-macros.h b/libc/include/llvm-libc-macros/locale-macros.h
index 3c9098cb97..afc3fdbfdb 100644
--- a/libc/include/llvm-libc-macros/locale-macros.h
+++ b/libc/include/llvm-libc-macros/locale-macros.h
@@ -27,6 +27,4 @@
 #define LC_NUMERIC_MASK 0
 #define LC_TIME_MASK 0
 
-
-
 #endif // LLVM_LIBC_MACROS_LOCALE_MACROS_H
diff --git a/libc/include/llvm-libc-types/Dl_info.h b/libc/include/llvm-libc-types/Dl_info.h
index bee32015c4..613976a54b 100644
--- a/libc/include/llvm-libc-types/Dl_info.h
+++ b/libc/include/llvm-libc-types/Dl_info.h
@@ -10,10 +10,10 @@
 #define LLVM_LIBC_TYPES_DL_INFO_H
 
 typedef struct {
-	const char *dli_fname;
-	void *dli_fbase;
-	const char *dli_sname;
-	void *dli_saddr;
+  const char *dli_fname;
+  void *dli_fbase;
+  const char *dli_sname;
+  void *dli_saddr;
 } Dl_info;
 
 #endif // LLVM_LIBC_TYPES_DL_INFO_H
diff --git a/libc/include/llvm-libc-types/locale_t.h b/libc/include/llvm-libc-types/locale_t.h
index 3201458853..35b0f9756e 100644
--- a/libc/include/llvm-libc-types/locale_t.h
+++ b/libc/include/llvm-libc-types/locale_t.h
@@ -13,6 +13,6 @@
 // HACK(@izaakschroeder): Placeholder.
 // NOTE: According to `libcxx` the `locale_t` type has to be at least
 // coercible to a `bool`.
-typedef void* locale_t;
+typedef void *locale_t;
 
 #endif // LLVM_LIBC_TYPES_LOCALE_T_H
diff --git a/libc/include/llvm-libc-types/struct_dl_phdr_info.h b/libc/include/llvm-libc-types/struct_dl_phdr_info.h
index 8bbd7811bb..66512b368e 100644
--- a/libc/include/llvm-libc-types/struct_dl_phdr_info.h
+++ b/libc/include/llvm-libc-types/struct_dl_phdr_info.h
@@ -9,8 +9,8 @@
 #ifndef LLVM_LIBC_TYPES_STRUCT_DL_PHDR_INFO_H
 #define LLVM_LIBC_TYPES_STRUCT_DL_PHDR_INFO_H
 
-#include "llvm-libc-types/size_t.h"
 #include "llvm-libc-macros/link-macros.h"
+#include "llvm-libc-types/size_t.h"
 
 struct dl_phdr_info {
   ElfW(Addr) dlpi_addr;
diff --git a/libc/include/llvm-libc-types/struct_lconv.h b/libc/include/llvm-libc-types/struct_lconv.h
index a5067a2d37..27dd7048ec 100644
--- a/libc/include/llvm-libc-types/struct_lconv.h
+++ b/libc/include/llvm-libc-types/struct_lconv.h
@@ -11,29 +11,29 @@
 
 struct lconv {
   char *currency_symbol;
-	char *decimal_point;
+  char *decimal_point;
   char *grouping;
   char *int_curr_symbol;
   char *mon_decimal_point;
   char *mon_grouping;
-	char *mon_thousands_sep;
+  char *mon_thousands_sep;
   char *negative_sign;
   char *positive_sign;
-	char *thousands_sep;
+  char *thousands_sep;
   char frac_digits;
   char int_frac_digits;
   char int_p_cs_precedes;
-	char int_p_sep_by_space;
-	char int_n_cs_precedes;
-	char int_n_sep_by_space;
+  char int_p_sep_by_space;
+  char int_n_cs_precedes;
+  char int_n_sep_by_space;
   char int_n_sign_posn;
-	char int_p_sign_posn;
+  char int_p_sign_posn;
   char n_cs_precedes;
-	char n_sep_by_space;
+  char n_sep_by_space;
   char n_sign_posn;
-	char p_cs_precedes;
-	char p_sep_by_space;
-	char p_sign_posn;	
+  char p_cs_precedes;
+  char p_sep_by_space;
+  char p_sign_posn;
 };
 
 #endif // LLVM_LIBC_TYPES_STRUCT_LCONV_H
diff --git a/libc/src/ctype/isdigit_l.cpp b/libc/src/ctype/isdigit_l.cpp
index 24efd56358..5ae615177e 100644
--- a/libc/src/ctype/isdigit_l.cpp
+++ b/libc/src/ctype/isdigit_l.cpp
@@ -7,13 +7,11 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/ctype/isdigit_l.h"
-#include "src/ctype/isdigit.h"
 #include "src/__support/common.h"
+#include "src/ctype/isdigit.h"
 
 namespace LIBC_NAMESPACE {
 
-LLVM_LIBC_FUNCTION(int, isdigit_l, (int c, locale_t)) {
-  return isdigit(c);
-}
+LLVM_LIBC_FUNCTION(int, isdigit_l, (int c, locale_t)) { return isdigit(c); }
 
 } // namespace LIBC_NAMESPACE
diff --git a/libc/src/ctype/islower_l.cpp b/libc/src/ctype/islower_l.cpp
index 45977dc637..2e4cfcb756 100644
--- a/libc/src/ctype/islower_l.cpp
+++ b/libc/src/ctype/islower_l.cpp
@@ -15,8 +15,6 @@ namespace LIBC_NAMESPACE {
 
 // TODO: Currently restricted to default locale.
 // These should be extended using locale information.
-LLVM_LIBC_FUNCTION(int, islower_l, (int c, locale_t)) {
-  return islower(c);
-}
+LLVM_LIBC_FUNCTION(int, islower_l, (int c, locale_t)) { return islower(c); }
 
 } // namespace LIBC_NAMESPACE
diff --git a/libc/src/ctype/isupper_l.cpp b/libc/src/ctype/isupper_l.cpp
index e3b1250b94..38a8a90717 100644
--- a/libc/src/ctype/isupper_l.cpp
+++ b/libc/src/ctype/isupper_l.cpp
@@ -15,8 +15,6 @@ namespace LIBC_NAMESPACE {
 
 // TODO: Currently restricted to default locale.
 // These should be extended using locale information.
-LLVM_LIBC_FUNCTION(int, isupper_l, (int c, locale_t)) {
-  return isupper(c);
-}
+LLVM_LIBC_FUNCTION(int, isupper_l, (int c, locale_t)) { return isupper(c); }
 
 } // namespace LIBC_NAMESPACE
diff --git a/libc/src/ctype/isxdigit_l.cpp b/libc/src/ctype/isxdigit_l.cpp
index cdb6c05438..8e1333331e 100644
--- a/libc/src/ctype/isxdigit_l.cpp
+++ b/libc/src/ctype/isxdigit_l.cpp
@@ -7,8 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/ctype/isxdigit_l.h"
-#include "src/ctype/isxdigit.h"
 #include "src/__support/ctype_utils.h"
+#include "src/ctype/isxdigit.h"
 
 #include "src/__support/common.h"
 
@@ -16,8 +16,6 @@ namespace LIBC_NAMESPACE {
 
 // TODO: Currently restricted to default locale.
 // These should be extended using locale information.
-LLVM_LIBC_FUNCTION(int, isxdigit_l, (int c, locale_t)) {
-  return isxdigit(c);
-}
+LLVM_LIBC_FUNCTION(int, isxdigit_l, (int c, locale_t)) { return isxdigit(c); }
 
 } // namespace LIBC_NAMESPACE
diff --git a/libc/src/ctype/toupper_l.cpp b/libc/src/ctype/toupper_l.cpp
index 5806f22d69..59ab613ffa 100644
--- a/libc/src/ctype/toupper_l.cpp
+++ b/libc/src/ctype/toupper_l.cpp
@@ -7,8 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/ctype/toupper_l.h"
-#include "src/ctype/toupper.h"
 #include "src/__support/ctype_utils.h"
+#include "src/ctype/toupper.h"
 
 #include "src/__support/common.h"
 
@@ -16,8 +16,6 @@ namespace LIBC_NAMESPACE {
 
 // TODO: Currently restricted to default locale.
 // These should be extended using locale information.
-LLVM_LIBC_FUNCTION(int, toupper_l, (int c, locale_t)) {
-  return toupper(c);
-}
+LLVM_LIBC_FUNCTION(int, toupper_l, (int c, locale_t)) { return toupper(c); }
 
 } // namespace LIBC_NAMESPACE
diff --git a/libc/src/dlfcn/dladdr.h b/libc/src/dlfcn/dladdr.h
index be9a7fec7a..b86f3fdea0 100644
--- a/libc/src/dlfcn/dladdr.h
+++ b/libc/src/dlfcn/dladdr.h
@@ -13,7 +13,7 @@ namespace LIBC_NAMESPACE {
 
 #include "include/llvm-libc-types/Dl_info.h"
 
-int dladdr(const void *,Dl_info *);
+int dladdr(const void *, Dl_info *);
 
 } // namespace LIBC_NAMESPACE
 
diff --git a/libc/src/locale/duplocale.cpp b/libc/src/locale/duplocale.cpp
index ab6441a01f..3c0a0f6688 100644
--- a/libc/src/locale/duplocale.cpp
+++ b/libc/src/locale/duplocale.cpp
@@ -11,8 +11,6 @@
 
 namespace LIBC_NAMESPACE {
 
-LLVM_LIBC_FUNCTION(locale_t, duplocale, (locale_t locale)) {
-  return locale;
-}
+LLVM_LIBC_FUNCTION(locale_t, duplocale, (locale_t locale)) { return locale; }
 
 } // namespace LIBC_NAMESPACE
diff --git a/libc/src/locale/localeconv.cpp b/libc/src/locale/localeconv.cpp
index c36ef8f1ef..fd9a081198 100644
--- a/libc/src/locale/localeconv.cpp
+++ b/libc/src/locale/localeconv.cpp
@@ -6,37 +6,37 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include <limits.h>
 #include "localeconv.h"
 #include "src/__support/common.h"
+#include <limits.h>
 
 namespace LIBC_NAMESPACE {
 
 static const struct lconv posix_lconv = {
-  .currency_symbol = const_cast<char*>(""),
-	.decimal_point = const_cast<char*>("."),
-  .grouping = const_cast<char*>(""),
-  .int_curr_symbol = const_cast<char*>(""),
-  .mon_decimal_point = const_cast<char*>(""),
-  .mon_grouping = const_cast<char*>(""),
-	.mon_thousands_sep = const_cast<char*>(""),
-  .negative_sign = const_cast<char*>(""),
-  .positive_sign = const_cast<char*>(""),
-	.thousands_sep = const_cast<char*>(""),
-  .frac_digits = CHAR_MAX,
-  .int_frac_digits = CHAR_MAX,
-  .int_p_cs_precedes = CHAR_MAX,
-	.int_p_sep_by_space = CHAR_MAX,
-	.int_n_cs_precedes = CHAR_MAX,
-	.int_n_sep_by_space = CHAR_MAX,
-  .int_n_sign_posn = CHAR_MAX,
-	.int_p_sign_posn = CHAR_MAX,
-  .n_cs_precedes = CHAR_MAX,
-	.n_sep_by_space = CHAR_MAX,
-  .n_sign_posn = CHAR_MAX,
-	.p_cs_precedes = CHAR_MAX,
-	.p_sep_by_space = CHAR_MAX,
-	.p_sign_posn = CHAR_MAX,
+    .currency_symbol = const_cast<char *>(""),
+    .decimal_point = const_cast<char *>("."),
+    .grouping = const_cast<char *>(""),
+    .int_curr_symbol = const_cast<char *>(""),
+    .mon_decimal_point = const_cast<char *>(""),
+    .mon_grouping = const_cast<char *>(""),
+    .mon_thousands_sep = const_cast<char *>(""),
+    .negative_sign = const_cast<char *>(""),
+    .positive_sign = const_cast<char *>(""),
+    .thousands_sep = const_cast<char *>(""),
+    .frac_digits = CHAR_MAX,
+    .int_frac_digits = CHAR_MAX,
+    .int_p_cs_precedes = CHAR_MAX,
+    .int_p_sep_by_space = CHAR_MAX,
+    .int_n_cs_precedes = CHAR_MAX,
+    .int_n_sep_by_space = CHAR_MAX,
+    .int_n_sign_posn = CHAR_MAX,
+    .int_p_sign_posn = CHAR_MAX,
+    .n_cs_precedes = CHAR_MAX,
+    .n_sep_by_space = CHAR_MAX,
+    .n_sign_posn = CHAR_MAX,
+    .p_cs_precedes = CHAR_MAX,
+    .p_sep_by_space = CHAR_MAX,
+    .p_sign_posn = CHAR_MAX,
 };
 
 LLVM_LIBC_FUNCTION(struct lconv *, localeconv, ()) {
diff --git a/libc/src/locale/setlocale.cpp b/libc/src/locale/setlocale.cpp
index bc8797b5e9..9a5aba4127 100644
--- a/libc/src/locale/setlocale.cpp
+++ b/libc/src/locale/setlocale.cpp
@@ -12,7 +12,7 @@
 namespace LIBC_NAMESPACE {
 
 LLVM_LIBC_FUNCTION(char *, setlocale, (int, const char *)) {
-  return const_cast<char*>("unsupported");
+  return const_cast<char *>("unsupported");
 }
 
 } // namespace LIBC_NAMESPACE
diff --git a/libc/src/locale/uselocale.cpp b/libc/src/locale/uselocale.cpp
index 6266e24f49..b614313ac7 100644
--- a/libc/src/locale/uselocale.cpp
+++ b/libc/src/locale/uselocale.cpp
@@ -11,8 +11,6 @@
 
 namespace LIBC_NAMESPACE {
 
-LLVM_LIBC_FUNCTION(locale_t, uselocale, (locale_t locale)) {
-  return locale;
-}
+LLVM_LIBC_FUNCTION(locale_t, uselocale, (locale_t locale)) { return locale; }
 
 } // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdio/vasprintf.cpp b/libc/src/stdio/vasprintf.cpp
index d625d98e83..712a3f72ab 100644
--- a/libc/src/stdio/vasprintf.cpp
+++ b/libc/src/stdio/vasprintf.cpp
@@ -16,8 +16,7 @@
 namespace LIBC_NAMESPACE {
 
 LLVM_LIBC_FUNCTION(int, vasprintf,
-                   (char **__restrict, const char *,
-                    va_list vlist)) {
+                   (char **__restrict, const char *, va_list vlist)) {
   internal::ArgList args(vlist); // This holder class allows for easier copying
                                  // and pointer semantics, as well as handling
                                  // destruction automatically.
diff --git a/libc/src/stdio/vasprintf.h b/libc/src/stdio/vasprintf.h
index f9b1d85ef8..c11675461e 100644
--- a/libc/src/stdio/vasprintf.h
+++ b/libc/src/stdio/vasprintf.h
@@ -14,8 +14,7 @@
 
 namespace LIBC_NAMESPACE {
 
-int vasprintf(char **__restrict s, const char * format,
-             va_list vlist);
+int vasprintf(char **__restrict s, const char *format, va_list vlist);
 
 } // namespace LIBC_NAMESPACE
 
diff --git a/libc/src/stdio/vsscanf.cpp b/libc/src/stdio/vsscanf.cpp
index b5c9173387..ff603a7c0d 100644
--- a/libc/src/stdio/vsscanf.cpp
+++ b/libc/src/stdio/vsscanf.cpp
@@ -14,14 +14,11 @@
 
 namespace LIBC_NAMESPACE {
 
-LLVM_LIBC_FUNCTION(int, vsscanf,
-                   (const char *, const char *,
-                    va_list vlist)) {
+LLVM_LIBC_FUNCTION(int, vsscanf, (const char *, const char *, va_list vlist)) {
   internal::ArgList args(vlist); // This holder class allows for easier copying
                                  // and pointer semantics, as well as handling
                                  // destruction automatically.
 
-  
   return -1;
 }
 
diff --git a/libc/src/stdio/vsscanf.h b/libc/src/stdio/vsscanf.h
index 5f32f7ed35..992c44d3d9 100644
--- a/libc/src/stdio/vsscanf.h
+++ b/libc/src/stdio/vsscanf.h
@@ -13,8 +13,7 @@
 
 namespace LIBC_NAMESPACE {
 
-int vsscanf(const char * s, const char * format,
-             va_list vlist);
+int vsscanf(const char *s, const char *format, va_list vlist);
 
 } // namespace LIBC_NAMESPACE
 
diff --git a/libc/src/stdlib/strtod_l.cpp b/libc/src/stdlib/strtod_l.cpp
index 44670b0c18..898a925d5f 100644
--- a/libc/src/stdlib/strtod_l.cpp
+++ b/libc/src/stdlib/strtod_l.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of strtod_l -----------------------------------------===//
+//===-- Implementation of strtod_l
+//-----------------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -7,14 +8,14 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/stdlib/strtod_l.h"
-#include "src/stdlib/strtod.h"
 #include "src/__support/common.h"
-
+#include "src/stdlib/strtod.h"
 
 namespace LIBC_NAMESPACE {
 
 LLVM_LIBC_FUNCTION(double, strtod_l,
-                   (const char *__restrict str, char **__restrict str_end, locale_t)) {
+                   (const char *__restrict str, char **__restrict str_end,
+                    locale_t)) {
   return strtod(str, str_end);
 }
 
diff --git a/libc/src/stdlib/strtod_l.h b/libc/src/stdlib/strtod_l.h
index 49da430d17..6e130f332e 100644
--- a/libc/src/stdlib/strtod_l.h
+++ b/libc/src/stdlib/strtod_l.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for strtod_l -----------------------*- C++ -*-===//
+//===-- Implementation header for strtod_l -----------------------*- C++
+//-*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -13,7 +14,8 @@
 
 namespace LIBC_NAMESPACE {
 
-double strtod_l(const char *__restrict str, char **__restrict str_end, locale_t locale);
+double strtod_l(const char *__restrict str, char **__restrict str_end,
+                locale_t locale);
 
 } // namespace LIBC_NAMESPACE
 
diff --git a/libc/src/stdlib/strtof_l.cpp b/libc/src/stdlib/strtof_l.cpp
index f8e480fc10..c5d25e60be 100644
--- a/libc/src/stdlib/strtof_l.cpp
+++ b/libc/src/stdlib/strtof_l.cpp
@@ -1,4 +1,5 @@
-//===-- Implementation of strtof_l -----------------------------------------===//
+//===-- Implementation of strtof_l
+//-----------------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -7,13 +8,14 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/stdlib/strtof_l.h"
-#include "src/stdlib/strtof.h"
 #include "src/__support/common.h"
+#include "src/stdlib/strtof.h"
 
 namespace LIBC_NAMESPACE {
 
 LLVM_LIBC_FUNCTION(float, strtof_l,
-                   (const char *__restrict str, char **__restrict str_end, locale_t)) {
+                   (const char *__restrict str, char **__restrict str_end,
+                    locale_t)) {
   return strtof(str, str_end);
 }
 
diff --git a/libc/src/stdlib/strtof_l.h b/libc/src/stdlib/strtof_l.h
index 290b7825d1..40552ba2d8 100644
--- a/libc/src/stdlib/strtof_l.h
+++ b/libc/src/stdlib/strtof_l.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for strtof_l -----------------------*- C++ -*-===//
+//===-- Implementation header for strtof_l -----------------------*- C++
+//-*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -13,7 +14,8 @@
 
 namespace LIBC_NAMESPACE {
 
-float strtof_l(const char *__restrict str, char **__restrict str_end, locale_t locale);
+float strtof_l(const char *__restrict str, char **__restrict str_end,
+               locale_t locale);
 
 } // namespace LIBC_NAMESPACE
 
diff --git a/libc/src/stdlib/strtold_l.cpp b/libc/src/stdlib/strtold_l.cpp
index 0756d81ea4..245356ce08 100644
--- a/libc/src/stdlib/strtold_l.cpp
+++ b/libc/src/stdlib/strtold_l.cpp
@@ -7,13 +7,14 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/stdlib/strtold_l.h"
-#include "src/stdlib/strtold.h"
 #include "src/__support/common.h"
+#include "src/stdlib/strtold.h"
 
 namespace LIBC_NAMESPACE {
 
 LLVM_LIBC_FUNCTION(long double, strtold_l,
-                   (const char *__restrict str, char **__restrict str_end, locale_t)) {
+                   (const char *__restrict str, char **__restrict str_end,
+                    locale_t)) {
 
   return strtold(str, str_end);
 }
diff --git a/libc/src/stdlib/strtold_l.h b/libc/src/stdlib/strtold_l.h
index e66e68c9dc..d156f46d50 100644
--- a/libc/src/stdlib/strtold_l.h
+++ b/libc/src/stdlib/strtold_l.h
@@ -13,7 +13,8 @@
 
 namespace LIBC_NAMESPACE {
 
-long double strtold_l(const char *__restrict str, char **__restrict str_end, locale_t locale);
+long double strtold_l(const char *__restrict str, char **__restrict str_end,
+                      locale_t locale);
 
 } // namespace LIBC_NAMESPACE
 
diff --git a/libc/src/stdlib/strtoll_l.cpp b/libc/src/stdlib/strtoll_l.cpp
index d48d1b1c13..e3a6c89a2a 100644
--- a/libc/src/stdlib/strtoll_l.cpp
+++ b/libc/src/stdlib/strtoll_l.cpp
@@ -7,15 +7,15 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/stdlib/strtoll_l.h"
-#include "src/stdlib/strtoll.h"
 #include "src/__support/common.h"
+#include "src/stdlib/strtoll.h"
 
 namespace LIBC_NAMESPACE {
 
 LLVM_LIBC_FUNCTION(long long, strtoll_l,
                    (const char *__restrict str, char **__restrict str_end,
                     int base, locale_t)) {
- 
+
   return strtoll(str, str_end, base);
 }
 
diff --git a/libc/src/stdlib/strtoll_l.h b/libc/src/stdlib/strtoll_l.h
index b0e1122e64..96cab62897 100644
--- a/libc/src/stdlib/strtoll_l.h
+++ b/libc/src/stdlib/strtoll_l.h
@@ -14,7 +14,7 @@
 namespace LIBC_NAMESPACE {
 
 long long strtoll_l(const char *__restrict str, char **__restrict str_end,
-                  int base, locale_t);
+                    int base, locale_t);
 
 } // namespace LIBC_NAMESPACE
 
diff --git a/libc/src/stdlib/strtoull_l.cpp b/libc/src/stdlib/strtoull_l.cpp
index 4a246826a4..72f8fd011d 100644
--- a/libc/src/stdlib/strtoull_l.cpp
+++ b/libc/src/stdlib/strtoull_l.cpp
@@ -7,8 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/stdlib/strtoull_l.h"
-#include "src/stdlib/strtoull.h"
 #include "src/__support/common.h"
+#include "src/stdlib/strtoull.h"
 
 namespace LIBC_NAMESPACE {
 
diff --git a/libc/src/stdlib/strtoull_l.h b/libc/src/stdlib/strtoull_l.h
index a7c1ae197f..6c24ecd3ab 100644
--- a/libc/src/stdlib/strtoull_l.h
+++ b/libc/src/stdlib/strtoull_l.h
@@ -14,7 +14,8 @@
 namespace LIBC_NAMESPACE {
 
 unsigned long long strtoull_l(const char *__restrict str,
-                            char **__restrict str_end, int base, locale_t locale);
+                              char **__restrict str_end, int base,
+                              locale_t locale);
 
 } // namespace LIBC_NAMESPACE
 
diff --git a/libc/src/string/strcoll_l.cpp b/libc/src/string/strcoll_l.cpp
index 5392b3553b..8bfef08d91 100644
--- a/libc/src/string/strcoll_l.cpp
+++ b/libc/src/string/strcoll_l.cpp
@@ -14,7 +14,8 @@
 namespace LIBC_NAMESPACE {
 
 // TODO: Add support for locales.
-LLVM_LIBC_FUNCTION(int, strcoll_l, (const char *left, const char *right, locale_t)) {
+LLVM_LIBC_FUNCTION(int, strcoll_l,
+                   (const char *left, const char *right, locale_t)) {
   return strcoll(left, right);
 }
 
diff --git a/libc/src/string/strxfrm_l.cpp b/libc/src/string/strxfrm_l.cpp
index 28f20985c2..8e929185a6 100644
--- a/libc/src/string/strxfrm_l.cpp
+++ b/libc/src/string/strxfrm_l.cpp
@@ -15,8 +15,8 @@ namespace LIBC_NAMESPACE {
 
 // TODO: Add support for locales.
 LLVM_LIBC_FUNCTION(size_t, strxfrm_l,
-                   (char *__restrict dest, const char *__restrict src,
-                    size_t n, locale_t)) {
+                   (char *__restrict dest, const char *__restrict src, size_t n,
+                    locale_t)) {
   return strxfrm(dest, src, n);
 }
 
diff --git a/libc/src/string/strxfrm_l.h b/libc/src/string/strxfrm_l.h
index ae958a16f3..d56a6ff073 100644
--- a/libc/src/string/strxfrm_l.h
+++ b/libc/src/string/strxfrm_l.h
@@ -1,4 +1,5 @@
-//===-- Implementation header for strxfrm_l -----------------------*- C++ -*-===//
+//===-- Implementation header for strxfrm_l -----------------------*- C++
+//-*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -9,12 +10,13 @@
 #ifndef LLVM_LIBC_SRC_STRING_STRXFRM_L_H
 #define LLVM_LIBC_SRC_STRING_STRXFRM_L_H
 
-#include <stddef.h> // For size_t
 #include "include/llvm-libc-types/locale_t.h"
+#include <stddef.h> // For size_t
 
 namespace LIBC_NAMESPACE {
 
-size_t strxfrm_l(char *__restrict dest, const char *__restrict src, size_t n, locale_t locale);
+size_t strxfrm_l(char *__restrict dest, const char *__restrict src, size_t n,
+                 locale_t locale);
 
 } // namespace LIBC_NAMESPACE
 
diff --git a/libc/src/sys/resource/linux/getrusage.cpp b/libc/src/sys/resource/linux/getrusage.cpp
index af6961e7bc..2cfaa00ed5 100644
--- a/libc/src/sys/resource/linux/getrusage.cpp
+++ b/libc/src/sys/resource/linux/getrusage.cpp
@@ -19,8 +19,7 @@
 namespace LIBC_NAMESPACE {
 
 LLVM_LIBC_FUNCTION(int, getrusage, (int who, struct rusage *usage)) {
-  int ret =
-      LIBC_NAMESPACE::syscall_impl<int>(SYS_getrusage, who, usage);
+  int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_getrusage, who, usage);
   if (ret < 0) {
     libc_errno = -ret;
     return -1;
diff --git a/libc/src/time/strftime.cpp b/libc/src/time/strftime.cpp
index 8eee127ff7..058701252f 100644
--- a/libc/src/time/strftime.cpp
+++ b/libc/src/time/strftime.cpp
@@ -11,10 +11,9 @@
 
 namespace LIBC_NAMESPACE {
 
-
-LLVM_LIBC_FUNCTION(size_t, strftime, (char*__restrict, size_t,
-                       const char *__restrict,
-                       const struct tm *__restrict)) {
+LLVM_LIBC_FUNCTION(size_t, strftime,
+                   (char *__restrict, size_t, const char *__restrict,
+                    const struct tm *__restrict)) {
   return 0;
 }
 
diff --git a/libc/src/time/strftime.h b/libc/src/time/strftime.h
index 93890175b6..2901f9f536 100644
--- a/libc/src/time/strftime.h
+++ b/libc/src/time/strftime.h
@@ -9,14 +9,13 @@
 #ifndef LLVM_LIBC_SRC_TIME_STRFTIME_H
 #define LLVM_LIBC_SRC_TIME_STRFTIME_H
 
-#include <time.h>
 #include "include/llvm-libc-types/size_t.h"
+#include <time.h>
 
 namespace LIBC_NAMESPACE {
 
-size_t strftime(char*__restrict s, size_t max,
-                       const char *__restrict format,
-                       const struct tm *__restrict tm);
+size_t strftime(char *__restrict s, size_t max, const char *__restrict format,
+                const struct tm *__restrict tm);
 
 } // namespace LIBC_NAMESPACE
 
diff --git a/libc/src/time/strftime_l.cpp b/libc/src/time/strftime_l.cpp
index a3972031c1..8035b4ae5b 100644
--- a/libc/src/time/strftime_l.cpp
+++ b/libc/src/time/strftime_l.cpp
@@ -7,15 +7,15 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/time/strftime_l.h"
-#include "src/time/strftime.h"
 #include "src/__support/common.h"
+#include "src/time/strftime.h"
 
 namespace LIBC_NAMESPACE {
 
-
-LLVM_LIBC_FUNCTION(size_t, strftime_l, (char*__restrict arg1, size_t arg2,
-                       const char *__restrict arg3,
-                       const struct tm *__restrict arg4, locale_t)) {
+LLVM_LIBC_FUNCTION(size_t, strftime_l,
+                   (char *__restrict arg1, size_t arg2,
+                    const char *__restrict arg3,
+                    const struct tm *__restrict arg4, locale_t)) {
   return LIBC_NAMESPACE::strftime(arg1, arg2, arg3, arg4);
 }
 
diff --git a/libc/src/time/strftime_l.h b/libc/src/time/strftime_l.h
index 9d4786665b..60c7e482c9 100644
--- a/libc/src/time/strftime_l.h
+++ b/libc/src/time/strftime_l.h
@@ -9,16 +9,14 @@
 #ifndef LLVM_LIBC_SRC_TIME_STRFTIME_L_H
 #define LLVM_LIBC_SRC_TIME_STRFTIME_L_H
 
-#include <time.h>
 #include "include/llvm-libc-types/locale_t.h"
 #include "include/llvm-libc-types/size_t.h"
+#include <time.h>
 
 namespace LIBC_NAMESPACE {
 
-size_t strftime_l(char*__restrict s, size_t max,
-                       const char *__restrict format,
-                       const struct tm *__restrict tm,
-                       locale_t locale);
+size_t strftime_l(char *__restrict s, size_t max, const char *__restrict format,
+                  const struct tm *__restrict tm, locale_t locale);
 
 } // namespace LIBC_NAMESPACE
 
diff --git a/libcxx/src/locale.cpp b/libcxx/src/locale.cpp
index d114640ab7..fddb81bf5b 100644
--- a/libcxx/src/locale.cpp
+++ b/libcxx/src/locale.cpp
@@ -34,7 +34,8 @@
 #  define _CTYPE_DISABLE_MACROS
 #endif
 
-#if !defined(_LIBCPP_MSVCRT) && !defined(__MINGW32__) && !defined(__BIONIC__) && !defined(__NuttX__)  && !defined(__LLVM_LIBC__)
+#if !defined(_LIBCPP_MSVCRT) && !defined(__MINGW32__) && !defined(__BIONIC__) && !defined(__NuttX__) &&                \
+    !defined(__LLVM_LIBC__)
 #  include <langinfo.h>
 #endif
 

@izaakschroeder izaakschroeder force-pushed the libc-bootstrap branch 5 times, most recently from 8edcc9c to 6568d56 Compare July 2, 2024 00:12
@izaakschroeder izaakschroeder force-pushed the libc-bootstrap branch 12 times, most recently from 6caee46 to e9b650d Compare July 2, 2024 04:15
@izaakschroeder izaakschroeder force-pushed the libc-bootstrap branch 3 times, most recently from eb2f237 to 8617e86 Compare July 2, 2024 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant