[clang] [libc] [libc] Support opaque FILE* on baremetal (PR #168931)

via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 20 10:49:22 PST 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- libc/src/stdio/baremetal/feof.cpp libc/src/stdio/baremetal/ferror.cpp libc/src/stdio/baremetal/fgetc.cpp libc/src/stdio/baremetal/fgets.cpp libc/src/stdio/baremetal/fprintf.cpp libc/src/stdio/baremetal/fputc.cpp libc/src/stdio/baremetal/fputc_internal.h libc/src/stdio/baremetal/fputs.cpp libc/src/stdio/baremetal/fputs_internal.h libc/src/stdio/baremetal/fwrite_internal.h libc/src/stdio/baremetal/vfprintf.cpp libc/src/stdio/baremetal/vfprintf_internal.h libc/src/__support/OSUtil/baremetal/io.cpp libc/src/__support/OSUtil/baremetal/io.h libc/src/stdio/baremetal/printf.cpp libc/src/stdio/baremetal/putchar.cpp libc/src/stdio/baremetal/puts.cpp libc/src/stdio/baremetal/vprintf.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libc/src/stdio/baremetal/feof.cpp b/libc/src/stdio/baremetal/feof.cpp
index 3c241edeb..42862f244 100644
--- a/libc/src/stdio/baremetal/feof.cpp
+++ b/libc/src/stdio/baremetal/feof.cpp
@@ -21,4 +21,3 @@ LLVM_LIBC_FUNCTION(int, feof, (::FILE * stream)) {
 }
 
 } // namespace LIBC_NAMESPACE_DECL
-
diff --git a/libc/src/stdio/baremetal/fwrite_internal.h b/libc/src/stdio/baremetal/fwrite_internal.h
index f4a07c382..3e03482a0 100644
--- a/libc/src/stdio/baremetal/fwrite_internal.h
+++ b/libc/src/stdio/baremetal/fwrite_internal.h
@@ -16,9 +16,10 @@
 
 namespace LIBC_NAMESPACE_DECL {
 
-LIBC_INLINE size_t fwrite_internal(const void *buffer, size_t size, size_t nmemb,
-                                   ::FILE *stream) {
-  __llvm_libc_stdio_write(stream, reinterpret_cast<const char *>(buffer), size * nmemb);
+LIBC_INLINE size_t fwrite_internal(const void *buffer, size_t size,
+                                   size_t nmemb, ::FILE *stream) {
+  __llvm_libc_stdio_write(stream, reinterpret_cast<const char *>(buffer),
+                          size * nmemb);
   return nmemb;
 }
 
diff --git a/libc/src/stdio/baremetal/putchar.cpp b/libc/src/stdio/baremetal/putchar.cpp
index a50bb8c86..d7c60a989 100644
--- a/libc/src/stdio/baremetal/putchar.cpp
+++ b/libc/src/stdio/baremetal/putchar.cpp
@@ -14,8 +14,6 @@
 
 namespace LIBC_NAMESPACE_DECL {
 
-LLVM_LIBC_FUNCTION(int, putchar, (int c)) {
-  return fputc_internal(c, stdout);
-}
+LLVM_LIBC_FUNCTION(int, putchar, (int c)) { return fputc_internal(c, stdout); }
 
 } // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/stdio/baremetal/vfprintf_internal.h b/libc/src/stdio/baremetal/vfprintf_internal.h
index 5fe346ade..c9504a24a 100644
--- a/libc/src/stdio/baremetal/vfprintf_internal.h
+++ b/libc/src/stdio/baremetal/vfprintf_internal.h
@@ -10,12 +10,12 @@
 #define LLVM_LIBC_SRC_STDIO_BAREMETAL_VFPRINTF_INTERNAL_H
 
 #include "hdr/types/FILE.h"
-#include "src/__support/arg_list.h"
 #include "src/__support/CPP/limits.h"
 #include "src/__support/CPP/string_view.h"
 #include "src/__support/OSUtil/io.h"
-#include "src/__support/libc_errno.h"
+#include "src/__support/arg_list.h"
 #include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
 #include "src/__support/macros/config.h"
 #include "src/stdio/printf_core/core_structs.h"
 #include "src/stdio/printf_core/error_mapper.h"

``````````

</details>


https://github.com/llvm/llvm-project/pull/168931


More information about the cfe-commits mailing list