[libc-commits] [libc] [libc] Modular printf option (float only) (PR #147426)
via libc-commits
libc-commits at lists.llvm.org
Mon Jul 7 16:50:42 PDT 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 HEAD~1 HEAD --extensions cpp,h -- libc/src/stdio/generic/printf_modular.cpp libc/src/stdio/printf_core/float_impl.cpp libc/src/stdio/printf.h libc/src/stdio/printf_core/float_dec_converter.h libc/src/stdio/printf_core/float_dec_converter_limited.h libc/src/stdio/printf_core/float_hex_converter.h libc/src/stdio/printf_core/parser.h libc/src/stdio/printf_core/printf_config.h libc/src/stdio/printf_core/printf_main.h libc/src/stdio/printf_core/vfprintf_internal.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libc/src/stdio/printf_core/float_dec_converter_limited.h b/libc/src/stdio/printf_core/float_dec_converter_limited.h
index 9804a3896..997131cc6 100644
--- a/libc/src/stdio/printf_core/float_dec_converter_limited.h
+++ b/libc/src/stdio/printf_core/float_dec_converter_limited.h
@@ -676,14 +676,15 @@ LIBC_INLINE int convert_float_dec_auto_typed(Writer<write_mode> *writer,
}
template <WriteMode write_mode>
-LIBC_PRINTF_MODULAR_DECL int convert_float_decimal(Writer<write_mode> *writer,
- const FormatSection &to_conv);
+LIBC_PRINTF_MODULAR_DECL int
+convert_float_decimal(Writer<write_mode> *writer, const FormatSection &to_conv);
template <WriteMode write_mode>
-LIBC_PRINTF_MODULAR_DECL int convert_float_dec_exp(Writer<write_mode> *writer,
- const FormatSection &to_conv);
+LIBC_PRINTF_MODULAR_DECL int
+convert_float_dec_exp(Writer<write_mode> *writer, const FormatSection &to_conv);
template <WriteMode write_mode>
-LIBC_PRINTF_MODULAR_DECL int convert_float_dec_auto(Writer<write_mode> *writer,
- const FormatSection &to_conv);
+LIBC_PRINTF_MODULAR_DECL int
+convert_float_dec_auto(Writer<write_mode> *writer,
+ const FormatSection &to_conv);
#ifdef LIBC_PRINTF_DEFINE_MODULAR
template <WriteMode write_mode>
diff --git a/libc/src/stdio/printf_core/float_hex_converter.h b/libc/src/stdio/printf_core/float_hex_converter.h
index fa7240668..5509d24d3 100644
--- a/libc/src/stdio/printf_core/float_hex_converter.h
+++ b/libc/src/stdio/printf_core/float_hex_converter.h
@@ -26,8 +26,8 @@ namespace LIBC_NAMESPACE_DECL {
namespace printf_core {
template <WriteMode write_mode>
-LIBC_PRINTF_MODULAR_DECL int convert_float_hex_exp(Writer<write_mode> *writer,
- const FormatSection &to_conv);
+LIBC_PRINTF_MODULAR_DECL int
+convert_float_hex_exp(Writer<write_mode> *writer, const FormatSection &to_conv);
#ifdef LIBC_PRINTF_DEFINE_MODULAR
template <WriteMode write_mode>
diff --git a/libc/src/stdio/printf_core/parser.h b/libc/src/stdio/printf_core/parser.h
index 5a1eea36b..1960f9a5c 100644
--- a/libc/src/stdio/printf_core/parser.h
+++ b/libc/src/stdio/printf_core/parser.h
@@ -296,8 +296,8 @@ public:
}
LIBC_PRINTF_MODULAR_DECL void write_float_arg_val(FormatSection §ion,
- LengthModifier lm,
- size_t conv_index);
+ LengthModifier lm,
+ size_t conv_index);
LIBC_PRINTF_MODULAR_DECL TypeDesc float_type_desc(LengthModifier lm);
LIBC_PRINTF_MODULAR_DECL bool advance_arg_if_float(TypeDesc cur_type_desc);
diff --git a/libc/src/stdio/printf_core/printf_main.h b/libc/src/stdio/printf_core/printf_main.h
index c77922bb4..bc9bd60dc 100644
--- a/libc/src/stdio/printf_core/printf_main.h
+++ b/libc/src/stdio/printf_core/printf_main.h
@@ -45,7 +45,7 @@ template <WriteMode write_mode>
int printf_main(Writer<write_mode> *writer, const char *__restrict str,
internal::ArgList &args) {
#ifdef LIBC_COPT_PRINTF_MODULAR
- __asm__ __volatile__ (".reloc ., BFD_RELOC_NONE, __printf_float");
+ __asm__ __volatile__(".reloc ., BFD_RELOC_NONE, __printf_float");
#endif
return printf_main_modular(writer, str, args);
}
diff --git a/libc/src/stdio/printf_core/vfprintf_internal.h b/libc/src/stdio/printf_core/vfprintf_internal.h
index c9d6fce45..e2808c04a 100644
--- a/libc/src/stdio/printf_core/vfprintf_internal.h
+++ b/libc/src/stdio/printf_core/vfprintf_internal.h
@@ -68,8 +68,8 @@ LIBC_INLINE int file_write_hook(cpp::string_view new_str, void *fp) {
}
LIBC_INLINE int vfprintf_internal_modular(::FILE *__restrict stream,
- const char *__restrict format,
- internal::ArgList &args) {
+ const char *__restrict format,
+ internal::ArgList &args) {
constexpr size_t BUFF_SIZE = 1024;
char buffer[BUFF_SIZE];
printf_core::WriteBuffer<Mode<WriteMode::FLUSH_TO_STREAM>::value> wb(
``````````
</details>
https://github.com/llvm/llvm-project/pull/147426
More information about the libc-commits
mailing list