diff --git a/libc/fuzzing/stdio/CMakeLists.txt b/libc/fuzzing/stdio/CMakeLists.txt index 401785a30469..86f095e84737 100644 --- a/libc/fuzzing/stdio/CMakeLists.txt +++ b/libc/fuzzing/stdio/CMakeLists.txt @@ -3,7 +3,7 @@ add_libc_fuzzer( SRCS printf_parser_fuzz.cpp DEPENDS - libc.src.stdio.printf_core.parser + libc.src.__support.printf_core.parser libc.src.errno.errno # needed for the strerror conversion ) diff --git a/libc/fuzzing/stdio/printf_parser_fuzz.cpp b/libc/fuzzing/stdio/printf_parser_fuzz.cpp index e745850bd6c3..71da37d470fa 100644 --- a/libc/fuzzing/stdio/printf_parser_fuzz.cpp +++ b/libc/fuzzing/stdio/printf_parser_fuzz.cpp @@ -11,7 +11,7 @@ //===----------------------------------------------------------------------===// #include "src/__support/arg_list.h" -#include "src/stdio/printf_core/parser.h" +#include "src/__support/printf_core/parser.h" #include #include diff --git a/libc/src/__support/CMakeLists.txt b/libc/src/__support/CMakeLists.txt index f4cb283976bc..12761e6a524b 100644 --- a/libc/src/__support/CMakeLists.txt +++ b/libc/src/__support/CMakeLists.txt @@ -462,6 +462,8 @@ add_subdirectory(threads) add_subdirectory(File) +add_subdirectory(printf_core) + add_subdirectory(HashTable) add_subdirectory(fixed_point) diff --git a/libc/src/stdio/printf_core/CMakeLists.txt b/libc/src/__support/printf_core/CMakeLists.txt similarity index 91% rename from libc/src/stdio/printf_core/CMakeLists.txt rename to libc/src/__support/printf_core/CMakeLists.txt index 4d6f25a2ddd0..a2e47e778a8c 100644 --- a/libc/src/stdio/printf_core/CMakeLists.txt +++ b/libc/src/__support/printf_core/CMakeLists.txt @@ -1,3 +1,8 @@ +if(NOT LLVM_LIBC_FULL_BUILD) + set(use_system_file "COMPILE_OPTIONS") + libc_add_definition(use_system_file "LIBC_COPT_STDIO_USE_SYSTEM_FILE") +endif() + if(LIBC_CONF_PRINTF_DISABLE_FLOAT) libc_add_definition(printf_config_copts "LIBC_COPT_PRINTF_DISABLE_FLOAT") endif() @@ -41,9 +46,9 @@ else() add_subdirectory(generic) endif() -set(target_error_mapper libc.src.stdio.printf_core.${LIBC_TARGET_OS}.error_mapper) +set(target_error_mapper libc.src.__support.printf_core.${LIBC_TARGET_OS}.error_mapper) if(NOT TARGET ${target_error_mapper}) - set(target_error_mapper libc.src.stdio.printf_core.generic.error_mapper) + set(target_error_mapper libc.src.__support.printf_core.generic.error_mapper) endif() if(LIBC_CONF_PRINTF_DISABLE_WIDE) @@ -178,8 +183,8 @@ add_header_library( libc.hdr.func.realloc libc.src.__support.arg_list libc.src.__support.error_or - libc.src.stdio.printf_core.printf_main - libc.src.stdio.printf_core.writer + libc.src.__support.printf_core.printf_main + libc.src.__support.printf_core.writer ) add_header_library( @@ -205,8 +210,8 @@ add_header_library( libc.src.__support.File.file libc.src.__support.error_or libc.src.__support.arg_list - libc.src.stdio.printf_core.printf_main - libc.src.stdio.printf_core.writer + libc.src.__support.printf_core.printf_main + libc.src.__support.printf_core.writer ${use_system_file} ) diff --git a/libc/src/stdio/printf_core/char_converter.h b/libc/src/__support/printf_core/char_converter.h similarity index 87% rename from libc/src/stdio/printf_core/char_converter.h rename to libc/src/__support/printf_core/char_converter.h index e4792c3b23b9..59f3e22f7ce5 100644 --- a/libc/src/stdio/printf_core/char_converter.h +++ b/libc/src/__support/printf_core/char_converter.h @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_SRC_STDIO_PRINTF_CORE_CHAR_CONVERTER_H -#define LLVM_LIBC_SRC_STDIO_PRINTF_CORE_CHAR_CONVERTER_H +#ifndef LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_CHAR_CONVERTER_H +#define LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_CHAR_CONVERTER_H #ifndef LIBC_COPT_PRINTF_DISABLE_WIDE #include "hdr/types/wchar_t.h" @@ -19,9 +19,9 @@ #include "hdr/limits_macros.h" #include "src/__support/macros/config.h" -#include "src/stdio/printf_core/converter_utils.h" -#include "src/stdio/printf_core/core_structs.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/converter_utils.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/writer.h" namespace LIBC_NAMESPACE_DECL { namespace printf_core { @@ -85,4 +85,4 @@ LIBC_INLINE int convert_char(Writer *writer, } // namespace printf_core } // namespace LIBC_NAMESPACE_DECL -#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_CHAR_CONVERTER_H +#endif // LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_CHAR_CONVERTER_H diff --git a/libc/src/stdio/printf_core/converter.h b/libc/src/__support/printf_core/converter.h similarity index 89% rename from libc/src/stdio/printf_core/converter.h rename to libc/src/__support/printf_core/converter.h index e931d6c34db6..67d0ee3d42b6 100644 --- a/libc/src/stdio/printf_core/converter.h +++ b/libc/src/__support/printf_core/converter.h @@ -6,19 +6,19 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_SRC_STDIO_PRINTF_CORE_CONVERTER_H -#define LLVM_LIBC_SRC_STDIO_PRINTF_CORE_CONVERTER_H +#ifndef LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_CONVERTER_H +#define LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_CONVERTER_H #include "src/__support/macros/config.h" -#include "src/stdio/printf_core/core_structs.h" -#include "src/stdio/printf_core/printf_config.h" -#include "src/stdio/printf_core/strerror_converter.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/printf_config.h" +#include "src/__support/printf_core/strerror_converter.h" +#include "src/__support/printf_core/writer.h" // This option allows for replacing all of the conversion functions with custom // replacements. This allows conversions to be replaced at compile time. #ifndef LIBC_COPT_PRINTF_CONV_ATLAS -#include "src/stdio/printf_core/converter_atlas.h" +#include "src/__support/printf_core/converter_atlas.h" #else #include LIBC_COPT_PRINTF_CONV_ATLAS #endif @@ -55,7 +55,7 @@ LIBC_PRINTF_MODULE((template #define HANDLE_WRITE_MODE(MODE) \ template int convert_float( \ Writer * writer, const FormatSection &to_conv); -#include "src/stdio/printf_core/write_modes.def" +#include "src/__support/printf_core/write_modes.def" #undef HANDLE_WRITE_MODE #endif // LIBC_PRINTF_DEFINE_MODULES @@ -137,4 +137,4 @@ int convert(Writer *writer, const FormatSection &to_conv) { } // namespace printf_core } // namespace LIBC_NAMESPACE_DECL -#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_CONVERTER_H +#endif // LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_CONVERTER_H diff --git a/libc/src/stdio/printf_core/converter_atlas.h b/libc/src/__support/printf_core/converter_atlas.h similarity index 62% rename from libc/src/stdio/printf_core/converter_atlas.h rename to libc/src/__support/printf_core/converter_atlas.h index dfb91b30e80f..e60df06cbac0 100644 --- a/libc/src/stdio/printf_core/converter_atlas.h +++ b/libc/src/__support/printf_core/converter_atlas.h @@ -10,46 +10,46 @@ // just replace the #include, additionally it keeps the ifdefs out of the // converter header. -#ifndef LLVM_LIBC_SRC_STDIO_PRINTF_CORE_CONVERTER_ATLAS_H -#define LLVM_LIBC_SRC_STDIO_PRINTF_CORE_CONVERTER_ATLAS_H +#ifndef LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_CONVERTER_ATLAS_H +#define LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_CONVERTER_ATLAS_H // defines convert_string -#include "src/stdio/printf_core/string_converter.h" +#include "src/__support/printf_core/string_converter.h" // defines convert_char -#include "src/stdio/printf_core/char_converter.h" +#include "src/__support/printf_core/char_converter.h" // defines convert_int -#include "src/stdio/printf_core/int_converter.h" +#include "src/__support/printf_core/int_converter.h" #ifndef LIBC_COPT_PRINTF_DISABLE_FLOAT // defines convert_float_decimal // defines convert_float_dec_exp // defines convert_float_dec_auto #ifdef LIBC_COPT_FLOAT_TO_STR_USE_FLOAT320 -#include "src/stdio/printf_core/float_dec_converter_limited.h" +#include "src/__support/printf_core/float_dec_converter_limited.h" #else -#include "src/stdio/printf_core/float_dec_converter.h" +#include "src/__support/printf_core/float_dec_converter.h" #endif // defines convert_float_hex_exp -#include "src/stdio/printf_core/float_hex_converter.h" +#include "src/__support/printf_core/float_hex_converter.h" #endif // LIBC_COPT_PRINTF_DISABLE_FLOAT #ifdef LIBC_INTERNAL_PRINTF_HAS_FIXED_POINT // defines convert_fixed -#include "src/stdio/printf_core/fixed_converter.h" +#include "src/__support/printf_core/fixed_converter.h" #endif // LIBC_INTERNAL_PRINTF_HAS_FIXED_POINT #ifndef LIBC_COPT_PRINTF_DISABLE_WRITE_INT -#include "src/stdio/printf_core/write_int_converter.h" +#include "src/__support/printf_core/write_int_converter.h" #endif // LIBC_COPT_PRINTF_DISABLE_WRITE_INT // defines convert_pointer -#include "src/stdio/printf_core/ptr_converter.h" +#include "src/__support/printf_core/ptr_converter.h" #ifndef LIBC_COPT_PRINTF_DISABLE_STRERROR // defines convert_strerror -#include "src/stdio/printf_core/strerror_converter.h" +#include "src/__support/printf_core/strerror_converter.h" #endif // LIBC_COPT_PRINTF_DISABLE_STRERROR -#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_CONVERTER_ATLAS_H +#endif // LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_CONVERTER_ATLAS_H diff --git a/libc/src/stdio/printf_core/converter_utils.h b/libc/src/__support/printf_core/converter_utils.h similarity index 92% rename from libc/src/stdio/printf_core/converter_utils.h rename to libc/src/__support/printf_core/converter_utils.h index b27defddc354..a21fb70f2f62 100644 --- a/libc/src/stdio/printf_core/converter_utils.h +++ b/libc/src/__support/printf_core/converter_utils.h @@ -6,12 +6,12 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_SRC_STDIO_PRINTF_CORE_CONVERTER_UTILS_H -#define LLVM_LIBC_SRC_STDIO_PRINTF_CORE_CONVERTER_UTILS_H +#ifndef LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_CONVERTER_UTILS_H +#define LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_CONVERTER_UTILS_H #include "src/__support/CPP/limits.h" #include "src/__support/macros/config.h" -#include "src/stdio/printf_core/core_structs.h" +#include "src/__support/printf_core/core_structs.h" #include #include @@ -78,4 +78,4 @@ enum class RoundDirection { Up, Down, Even }; } // namespace printf_core } // namespace LIBC_NAMESPACE_DECL -#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_CONVERTER_UTILS_H +#endif // LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_CONVERTER_UTILS_H diff --git a/libc/src/stdio/printf_core/core_structs.h b/libc/src/__support/printf_core/core_structs.h similarity index 95% rename from libc/src/stdio/printf_core/core_structs.h rename to libc/src/__support/printf_core/core_structs.h index 9b74a0a391f9..3107b9ce46f0 100644 --- a/libc/src/stdio/printf_core/core_structs.h +++ b/libc/src/__support/printf_core/core_structs.h @@ -6,15 +6,15 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_SRC_STDIO_PRINTF_CORE_CORE_STRUCTS_H -#define LLVM_LIBC_SRC_STDIO_PRINTF_CORE_CORE_STRUCTS_H +#ifndef LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_CORE_STRUCTS_H +#define LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_CORE_STRUCTS_H #include "src/__support/macros/config.h" #include "src/__support/CPP/string_view.h" #include "src/__support/CPP/type_traits.h" #include "src/__support/FPUtil/FPBits.h" -#include "src/stdio/printf_core/printf_config.h" +#include "src/__support/printf_core/printf_config.h" #include #include @@ -165,4 +165,4 @@ constexpr int MB_CONVERSION_ERROR = -1009; } // namespace printf_core } // namespace LIBC_NAMESPACE_DECL -#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_CORE_STRUCTS_H +#endif // LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_CORE_STRUCTS_H diff --git a/libc/src/stdio/printf_core/error_mapper.h b/libc/src/__support/printf_core/error_mapper.h similarity index 76% rename from libc/src/stdio/printf_core/error_mapper.h rename to libc/src/__support/printf_core/error_mapper.h index 23030930133a..143ea94ce896 100644 --- a/libc/src/stdio/printf_core/error_mapper.h +++ b/libc/src/__support/printf_core/error_mapper.h @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_SRC_STDIO_PRINTF_CORE_ERROR_MAPPER_H -#define LLVM_LIBC_SRC_STDIO_PRINTF_CORE_ERROR_MAPPER_H +#ifndef LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_ERROR_MAPPER_H +#define LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_ERROR_MAPPER_H #include "src/__support/macros/properties/architectures.h" @@ -18,4 +18,4 @@ #include "generic/error_mapper.h" #endif -#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_ERROR_MAPPER_H +#endif // LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_ERROR_MAPPER_H diff --git a/libc/src/stdio/printf_core/fixed_converter.h b/libc/src/__support/printf_core/fixed_converter.h similarity index 97% rename from libc/src/stdio/printf_core/fixed_converter.h rename to libc/src/__support/printf_core/fixed_converter.h index e8a331496756..76b2d0d63644 100644 --- a/libc/src/stdio/printf_core/fixed_converter.h +++ b/libc/src/__support/printf_core/fixed_converter.h @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_SRC_STDIO_PRINTF_CORE_FIXED_CONVERTER_H -#define LLVM_LIBC_SRC_STDIO_PRINTF_CORE_FIXED_CONVERTER_H +#ifndef LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_FIXED_CONVERTER_H +#define LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_FIXED_CONVERTER_H #include "include/llvm-libc-macros/stdfix-macros.h" #include "src/__support/CPP/string_view.h" @@ -17,9 +17,9 @@ #include "src/__support/integer_to_string.h" #include "src/__support/libc_assert.h" #include "src/__support/macros/config.h" -#include "src/stdio/printf_core/converter_utils.h" -#include "src/stdio/printf_core/core_structs.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/converter_utils.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/writer.h" #include #include @@ -307,4 +307,4 @@ LIBC_INLINE int convert_fixed(Writer *writer, } // namespace printf_core } // namespace LIBC_NAMESPACE_DECL -#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_FIXED_CONVERTER_H +#endif // LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_FIXED_CONVERTER_H diff --git a/libc/src/stdio/printf_core/float_dec_converter.h b/libc/src/__support/printf_core/float_dec_converter.h similarity index 99% rename from libc/src/stdio/printf_core/float_dec_converter.h rename to libc/src/__support/printf_core/float_dec_converter.h index 7d86de369211..b678cd29cdb8 100644 --- a/libc/src/stdio/printf_core/float_dec_converter.h +++ b/libc/src/__support/printf_core/float_dec_converter.h @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_SRC_STDIO_PRINTF_CORE_FLOAT_DEC_CONVERTER_H -#define LLVM_LIBC_SRC_STDIO_PRINTF_CORE_FLOAT_DEC_CONVERTER_H +#ifndef LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_FLOAT_DEC_CONVERTER_H +#define LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_FLOAT_DEC_CONVERTER_H #include "src/__support/CPP/string_view.h" #include "src/__support/FPUtil/FPBits.h" @@ -18,10 +18,10 @@ #include "src/__support/integer_to_string.h" #include "src/__support/libc_assert.h" #include "src/__support/macros/config.h" -#include "src/stdio/printf_core/converter_utils.h" -#include "src/stdio/printf_core/core_structs.h" -#include "src/stdio/printf_core/float_inf_nan_converter.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/converter_utils.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/float_inf_nan_converter.h" +#include "src/__support/printf_core/writer.h" #include #include @@ -1245,4 +1245,4 @@ LIBC_INLINE int convert_float_dec_auto(Writer *writer, } // namespace printf_core } // namespace LIBC_NAMESPACE_DECL -#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_FLOAT_DEC_CONVERTER_H +#endif // LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_FLOAT_DEC_CONVERTER_H diff --git a/libc/src/stdio/printf_core/float_dec_converter_limited.h b/libc/src/__support/printf_core/float_dec_converter_limited.h similarity index 98% rename from libc/src/stdio/printf_core/float_dec_converter_limited.h rename to libc/src/__support/printf_core/float_dec_converter_limited.h index 2693ebd531f9..2e34004ce92c 100644 --- a/libc/src/stdio/printf_core/float_dec_converter_limited.h +++ b/libc/src/__support/printf_core/float_dec_converter_limited.h @@ -38,8 +38,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_SRC_STDIO_PRINTF_CORE_FLOAT_DEC_CONVERTER_LIMITED_H -#define LLVM_LIBC_SRC_STDIO_PRINTF_CORE_FLOAT_DEC_CONVERTER_LIMITED_H +#ifndef LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_FLOAT_DEC_CONVERTER_LIMITED_H +#define LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_FLOAT_DEC_CONVERTER_LIMITED_H #include "src/__support/CPP/algorithm.h" #include "src/__support/CPP/string.h" @@ -50,9 +50,9 @@ #include "src/__support/integer_to_string.h" #include "src/__support/libc_assert.h" #include "src/__support/macros/config.h" -#include "src/stdio/printf_core/core_structs.h" -#include "src/stdio/printf_core/float_inf_nan_converter.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/float_inf_nan_converter.h" +#include "src/__support/printf_core/writer.h" #include "src/string/memory_utils/inline_memcpy.h" namespace LIBC_NAMESPACE_DECL { @@ -711,4 +711,4 @@ LIBC_INLINE int convert_float_dec_auto(Writer *writer, } // namespace printf_core } // namespace LIBC_NAMESPACE_DECL -#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_FLOAT_DEC_CONVERTER_LIMITED_H +#endif // LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_FLOAT_DEC_CONVERTER_LIMITED_H diff --git a/libc/src/stdio/printf_core/float_hex_converter.h b/libc/src/__support/printf_core/float_hex_converter.h similarity index 96% rename from libc/src/stdio/printf_core/float_hex_converter.h rename to libc/src/__support/printf_core/float_hex_converter.h index 6ac3bfac8a76..640db7be2c0f 100644 --- a/libc/src/stdio/printf_core/float_hex_converter.h +++ b/libc/src/__support/printf_core/float_hex_converter.h @@ -6,18 +6,18 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_SRC_STDIO_PRINTF_CORE_FLOAT_HEX_CONVERTER_H -#define LLVM_LIBC_SRC_STDIO_PRINTF_CORE_FLOAT_HEX_CONVERTER_H +#ifndef LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_FLOAT_HEX_CONVERTER_H +#define LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_FLOAT_HEX_CONVERTER_H #include "src/__support/CPP/string_view.h" #include "src/__support/FPUtil/FPBits.h" #include "src/__support/FPUtil/rounding_mode.h" #include "src/__support/ctype_utils.h" #include "src/__support/macros/config.h" -#include "src/stdio/printf_core/converter_utils.h" -#include "src/stdio/printf_core/core_structs.h" -#include "src/stdio/printf_core/float_inf_nan_converter.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/converter_utils.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/float_inf_nan_converter.h" +#include "src/__support/printf_core/writer.h" #include #include @@ -298,4 +298,4 @@ LIBC_INLINE int convert_float_hex_exp(Writer *writer, } // namespace printf_core } // namespace LIBC_NAMESPACE_DECL -#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_FLOAT_HEX_CONVERTER_H +#endif // LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_FLOAT_HEX_CONVERTER_H diff --git a/libc/src/stdio/printf_core/float_impl.cpp b/libc/src/__support/printf_core/float_impl.cpp similarity index 94% rename from libc/src/stdio/printf_core/float_impl.cpp rename to libc/src/__support/printf_core/float_impl.cpp index 92a616b955de..7e8fc6d98332 100644 --- a/libc/src/stdio/printf_core/float_impl.cpp +++ b/libc/src/__support/printf_core/float_impl.cpp @@ -16,7 +16,7 @@ #ifdef LIBC_COPT_PRINTF_MODULAR #define LIBC_PRINTF_DEFINE_MODULES -#include "src/stdio/printf_core/converter.h" +#include "src/__support/printf_core/converter.h" // Bring this file into the link if __printf_float is referenced. extern "C" void __printf_float() {} diff --git a/libc/src/stdio/printf_core/float_inf_nan_converter.h b/libc/src/__support/printf_core/float_inf_nan_converter.h similarity index 90% rename from libc/src/stdio/printf_core/float_inf_nan_converter.h rename to libc/src/__support/printf_core/float_inf_nan_converter.h index 2af2c7feee33..81769ae4b491 100644 --- a/libc/src/stdio/printf_core/float_inf_nan_converter.h +++ b/libc/src/__support/printf_core/float_inf_nan_converter.h @@ -6,15 +6,15 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_SRC_STDIO_PRINTF_CORE_FLOAT_INF_NAN_CONVERTER_H -#define LLVM_LIBC_SRC_STDIO_PRINTF_CORE_FLOAT_INF_NAN_CONVERTER_H +#ifndef LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_FLOAT_INF_NAN_CONVERTER_H +#define LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_FLOAT_INF_NAN_CONVERTER_H #include "src/__support/FPUtil/FPBits.h" #include "src/__support/ctype_utils.h" #include "src/__support/macros/config.h" -#include "src/stdio/printf_core/converter_utils.h" -#include "src/stdio/printf_core/core_structs.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/converter_utils.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/writer.h" #include #include @@ -99,4 +99,4 @@ LIBC_INLINE int convert_inf_nan(Writer *writer, } // namespace printf_core } // namespace LIBC_NAMESPACE_DECL -#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_FLOAT_INF_NAN_CONVERTER_H +#endif // LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_FLOAT_INF_NAN_CONVERTER_H diff --git a/libc/src/stdio/printf_core/linux/CMakeLists.txt b/libc/src/__support/printf_core/generic/CMakeLists.txt similarity index 67% rename from libc/src/stdio/printf_core/linux/CMakeLists.txt rename to libc/src/__support/printf_core/generic/CMakeLists.txt index 2f0143d992e3..a4533c816a68 100644 --- a/libc/src/stdio/printf_core/linux/CMakeLists.txt +++ b/libc/src/__support/printf_core/generic/CMakeLists.txt @@ -3,6 +3,6 @@ add_header_library( HDRS error_mapper.h DEPENDS - libc.src.stdio.printf_core.core_structs + libc.src.__support.printf_core.core_structs libc.hdr.errno_macros ) diff --git a/libc/src/stdio/printf_core/generic/error_mapper.h b/libc/src/__support/printf_core/generic/error_mapper.h similarity index 79% rename from libc/src/stdio/printf_core/generic/error_mapper.h rename to libc/src/__support/printf_core/generic/error_mapper.h index d8cdd2cc2dba..a3f355b531b3 100644 --- a/libc/src/stdio/printf_core/generic/error_mapper.h +++ b/libc/src/__support/printf_core/generic/error_mapper.h @@ -6,12 +6,12 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_SRC_STDIO_PRINTF_CORE_GENERIC_ERROR_MAPPER_H -#define LLVM_LIBC_SRC_STDIO_PRINTF_CORE_GENERIC_ERROR_MAPPER_H +#ifndef LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_GENERIC_ERROR_MAPPER_H +#define LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_GENERIC_ERROR_MAPPER_H #include "hdr/errno_macros.h" -#include "src/stdio/printf_core/core_structs.h" -#include "src/stdio/printf_core/error_mapper.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/error_mapper.h" namespace LIBC_NAMESPACE_DECL { namespace printf_core { @@ -46,4 +46,4 @@ LIBC_INLINE static int internal_error_to_errno(int internal_error) { } // namespace printf_core } // namespace LIBC_NAMESPACE_DECL -#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_GENERIC_ERROR_MAPPER_H +#endif // LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_GENERIC_ERROR_MAPPER_H diff --git a/libc/src/stdio/printf_core/int_converter.h b/libc/src/__support/printf_core/int_converter.h similarity index 95% rename from libc/src/stdio/printf_core/int_converter.h rename to libc/src/__support/printf_core/int_converter.h index 11234c32ce99..c40c742e41c3 100644 --- a/libc/src/stdio/printf_core/int_converter.h +++ b/libc/src/__support/printf_core/int_converter.h @@ -6,17 +6,17 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_SRC_STDIO_PRINTF_CORE_INT_CONVERTER_H -#define LLVM_LIBC_SRC_STDIO_PRINTF_CORE_INT_CONVERTER_H +#ifndef LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_INT_CONVERTER_H +#define LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_INT_CONVERTER_H #include "src/__support/CPP/span.h" #include "src/__support/CPP/string_view.h" #include "src/__support/ctype_utils.h" #include "src/__support/integer_to_string.h" #include "src/__support/macros/config.h" -#include "src/stdio/printf_core/converter_utils.h" -#include "src/stdio/printf_core/core_structs.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/converter_utils.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/writer.h" #include #include @@ -209,4 +209,4 @@ LIBC_INLINE int convert_int(Writer *writer, } // namespace printf_core } // namespace LIBC_NAMESPACE_DECL -#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_INT_CONVERTER_H +#endif // LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_INT_CONVERTER_H diff --git a/libc/src/stdio/printf_core/generic/CMakeLists.txt b/libc/src/__support/printf_core/linux/CMakeLists.txt similarity index 67% rename from libc/src/stdio/printf_core/generic/CMakeLists.txt rename to libc/src/__support/printf_core/linux/CMakeLists.txt index 2f0143d992e3..a4533c816a68 100644 --- a/libc/src/stdio/printf_core/generic/CMakeLists.txt +++ b/libc/src/__support/printf_core/linux/CMakeLists.txt @@ -3,6 +3,6 @@ add_header_library( HDRS error_mapper.h DEPENDS - libc.src.stdio.printf_core.core_structs + libc.src.__support.printf_core.core_structs libc.hdr.errno_macros ) diff --git a/libc/src/stdio/printf_core/linux/error_mapper.h b/libc/src/__support/printf_core/linux/error_mapper.h similarity index 82% rename from libc/src/stdio/printf_core/linux/error_mapper.h rename to libc/src/__support/printf_core/linux/error_mapper.h index 3449f1259346..db8cddcd11f6 100644 --- a/libc/src/stdio/printf_core/linux/error_mapper.h +++ b/libc/src/__support/printf_core/linux/error_mapper.h @@ -6,12 +6,12 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_SRC_STDIO_PRINTF_CORE_LINUX_ERROR_MAPPER_H -#define LLVM_LIBC_SRC_STDIO_PRINTF_CORE_LINUX_ERROR_MAPPER_H +#ifndef LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_LINUX_ERROR_MAPPER_H +#define LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_LINUX_ERROR_MAPPER_H #include "hdr/errno_macros.h" -#include "src/stdio/printf_core/core_structs.h" -#include "src/stdio/printf_core/error_mapper.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/error_mapper.h" namespace LIBC_NAMESPACE_DECL { namespace printf_core { @@ -54,4 +54,4 @@ LIBC_INLINE static int internal_error_to_errno(int internal_error) { } // namespace printf_core } // namespace LIBC_NAMESPACE_DECL -#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_LINUX_ERROR_MAPPER_H +#endif // LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_LINUX_ERROR_MAPPER_H diff --git a/libc/src/stdio/printf_core/parser.h b/libc/src/__support/printf_core/parser.h similarity index 99% rename from libc/src/stdio/printf_core/parser.h rename to libc/src/__support/printf_core/parser.h index 369358882b62..bd7b78ebfabf 100644 --- a/libc/src/stdio/printf_core/parser.h +++ b/libc/src/__support/printf_core/parser.h @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_SRC_STDIO_PRINTF_CORE_PARSER_H -#define LLVM_LIBC_SRC_STDIO_PRINTF_CORE_PARSER_H +#ifndef LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_PARSER_H +#define LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_PARSER_H #include "include/llvm-libc-macros/stdfix-macros.h" #include "src/__support/CPP/algorithm.h" // max @@ -16,9 +16,9 @@ #include "src/__support/CPP/type_traits.h" #include "src/__support/macros/config.h" #include "src/__support/macros/properties/types.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/printf_config.h" #include "src/__support/str_to_integer.h" -#include "src/stdio/printf_core/core_structs.h" -#include "src/stdio/printf_core/printf_config.h" #include @@ -758,4 +758,4 @@ private: } // namespace printf_core } // namespace LIBC_NAMESPACE_DECL -#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_PARSER_H +#endif // LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_PARSER_H diff --git a/libc/src/stdio/printf_core/printf_config.h b/libc/src/__support/printf_core/printf_config.h similarity index 94% rename from libc/src/stdio/printf_core/printf_config.h rename to libc/src/__support/printf_core/printf_config.h index 929b1c5b3931..0cf983f10d09 100644 --- a/libc/src/stdio/printf_core/printf_config.h +++ b/libc/src/__support/printf_core/printf_config.h @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_SRC_STDIO_PRINTF_CORE_PRINTF_CONFIG_H -#define LLVM_LIBC_SRC_STDIO_PRINTF_CORE_PRINTF_CONFIG_H +#ifndef LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_PRINTF_CONFIG_H +#define LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_PRINTF_CONFIG_H // The index array buffer is always initialized when printf is called. In cases // where index mode is necessary but memory is limited, or when index mode @@ -73,4 +73,4 @@ LIBC_PRINTF_MODULE_UNWRAP SIG LIBC_PRINTF_MODULE_DECL; #endif -#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_PRINTF_CONFIG_H +#endif // LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_PRINTF_CONFIG_H diff --git a/libc/src/stdio/printf_core/printf_main.h b/libc/src/__support/printf_core/printf_main.h similarity index 81% rename from libc/src/stdio/printf_core/printf_main.h rename to libc/src/__support/printf_core/printf_main.h index 874c24464ed5..b08e05be2530 100644 --- a/libc/src/stdio/printf_core/printf_main.h +++ b/libc/src/__support/printf_core/printf_main.h @@ -6,16 +6,16 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_SRC_STDIO_PRINTF_CORE_PRINTF_MAIN_H -#define LLVM_LIBC_SRC_STDIO_PRINTF_CORE_PRINTF_MAIN_H +#ifndef LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_PRINTF_MAIN_H +#define LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_PRINTF_MAIN_H #include "src/__support/arg_list.h" #include "src/__support/error_or.h" #include "src/__support/macros/config.h" -#include "src/stdio/printf_core/converter.h" -#include "src/stdio/printf_core/core_structs.h" -#include "src/stdio/printf_core/parser.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/converter.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/parser.h" +#include "src/__support/printf_core/writer.h" #include @@ -55,4 +55,4 @@ ErrorOr printf_main(Writer *writer, } // namespace printf_core } // namespace LIBC_NAMESPACE_DECL -#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_PRINTF_MAIN_H +#endif // LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_PRINTF_MAIN_H diff --git a/libc/src/stdio/printf_core/ptr_converter.h b/libc/src/__support/printf_core/ptr_converter.h similarity index 76% rename from libc/src/stdio/printf_core/ptr_converter.h rename to libc/src/__support/printf_core/ptr_converter.h index c2a74e3043e6..692933a63f38 100644 --- a/libc/src/stdio/printf_core/ptr_converter.h +++ b/libc/src/__support/printf_core/ptr_converter.h @@ -6,14 +6,14 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_SRC_STDIO_PRINTF_CORE_PTR_CONVERTER_H -#define LLVM_LIBC_SRC_STDIO_PRINTF_CORE_PTR_CONVERTER_H +#ifndef LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_PTR_CONVERTER_H +#define LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_PTR_CONVERTER_H #include "src/__support/macros/config.h" -#include "src/stdio/printf_core/core_structs.h" -#include "src/stdio/printf_core/int_converter.h" -#include "src/stdio/printf_core/string_converter.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/int_converter.h" +#include "src/__support/printf_core/string_converter.h" +#include "src/__support/printf_core/writer.h" namespace LIBC_NAMESPACE_DECL { namespace printf_core { @@ -40,4 +40,4 @@ LIBC_INLINE int convert_pointer(Writer *writer, } // namespace printf_core } // namespace LIBC_NAMESPACE_DECL -#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_PTR_CONVERTER_H +#endif // LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_PTR_CONVERTER_H diff --git a/libc/src/stdio/printf_core/strerror_converter.h b/libc/src/__support/printf_core/strerror_converter.h similarity index 87% rename from libc/src/stdio/printf_core/strerror_converter.h rename to libc/src/__support/printf_core/strerror_converter.h index 2cd6df0c01d4..ec02a9a52f99 100644 --- a/libc/src/stdio/printf_core/strerror_converter.h +++ b/libc/src/__support/printf_core/strerror_converter.h @@ -6,15 +6,15 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_SRC_STDIO_PRINTF_CORE_STRERROR_CONVERTER_H -#define LLVM_LIBC_SRC_STDIO_PRINTF_CORE_STRERROR_CONVERTER_H +#ifndef LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_STRERROR_CONVERTER_H +#define LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_STRERROR_CONVERTER_H #include "src/__support/StringUtil/error_to_string.h" #include "src/__support/macros/config.h" -#include "src/stdio/printf_core/core_structs.h" -#include "src/stdio/printf_core/int_converter.h" -#include "src/stdio/printf_core/string_converter.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/int_converter.h" +#include "src/__support/printf_core/string_converter.h" +#include "src/__support/printf_core/writer.h" namespace LIBC_NAMESPACE_DECL { namespace printf_core { @@ -73,4 +73,4 @@ LIBC_INLINE int convert_strerror(Writer *writer, } // namespace printf_core } // namespace LIBC_NAMESPACE_DECL -#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_STRERROR_CONVERTER_H +#endif // LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_STRERROR_CONVERTER_H diff --git a/libc/src/stdio/printf_core/string_converter.h b/libc/src/__support/printf_core/string_converter.h similarity index 92% rename from libc/src/stdio/printf_core/string_converter.h rename to libc/src/__support/printf_core/string_converter.h index 2f521544785c..4cd1d52a2bab 100644 --- a/libc/src/stdio/printf_core/string_converter.h +++ b/libc/src/__support/printf_core/string_converter.h @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_SRC_STDIO_PRINTF_CORE_STRING_CONVERTER_H -#define LLVM_LIBC_SRC_STDIO_PRINTF_CORE_STRING_CONVERTER_H +#ifndef LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_STRING_CONVERTER_H +#define LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_STRING_CONVERTER_H #ifndef LIBC_COPT_PRINTF_DISABLE_WIDE #include "hdr/types/char32_t.h" @@ -17,9 +17,9 @@ #endif // LIBC_COPT_PRINTF_DISABLE_WIDE #include "src/__support/macros/config.h" -#include "src/stdio/printf_core/converter_utils.h" -#include "src/stdio/printf_core/core_structs.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/converter_utils.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/writer.h" #include "src/string/string_utils.h" // string_length #include @@ -142,4 +142,4 @@ LIBC_INLINE int convert_string(Writer *writer, } // namespace printf_core } // namespace LIBC_NAMESPACE_DECL -#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_STRING_CONVERTER_H +#endif // LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_STRING_CONVERTER_H diff --git a/libc/src/stdio/printf_core/vasprintf_internal.h b/libc/src/__support/printf_core/vasprintf_internal.h similarity index 87% rename from libc/src/stdio/printf_core/vasprintf_internal.h rename to libc/src/__support/printf_core/vasprintf_internal.h index fe5428e6118d..969da6ebc46b 100644 --- a/libc/src/stdio/printf_core/vasprintf_internal.h +++ b/libc/src/__support/printf_core/vasprintf_internal.h @@ -6,14 +6,17 @@ // //===----------------------------------------------------------------------===// +#ifndef LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_VASPRINTF_INTERNAL_H +#define LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_VASPRINTF_INTERNAL_H + #include "hdr/func/free.h" #include "hdr/func/malloc.h" #include "hdr/func/realloc.h" #include "src/__support/arg_list.h" #include "src/__support/error_or.h" -#include "src/stdio/printf_core/core_structs.h" -#include "src/stdio/printf_core/printf_main.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/printf_main.h" +#include "src/__support/printf_core/writer.h" namespace LIBC_NAMESPACE_DECL { namespace printf_core { @@ -73,3 +76,5 @@ LIBC_INLINE ErrorOr vasprintf_internal(char **ret, } } // namespace printf_core } // namespace LIBC_NAMESPACE_DECL + +#endif // LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_VASPRINTF_INTERNAL_H diff --git a/libc/src/stdio/printf_core/vfprintf_internal.h b/libc/src/__support/printf_core/vfprintf_internal.h similarity index 91% rename from libc/src/stdio/printf_core/vfprintf_internal.h rename to libc/src/__support/printf_core/vfprintf_internal.h index 321b0693ad33..6a62e966f7ff 100644 --- a/libc/src/stdio/printf_core/vfprintf_internal.h +++ b/libc/src/__support/printf_core/vfprintf_internal.h @@ -6,17 +6,17 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_SRC_STDIO_PRINTF_CORE_VFPRINTF_INTERNAL_H -#define LLVM_LIBC_SRC_STDIO_PRINTF_CORE_VFPRINTF_INTERNAL_H +#ifndef LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_VFPRINTF_INTERNAL_H +#define LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_VFPRINTF_INTERNAL_H #include "src/__support/File/file.h" #include "src/__support/arg_list.h" #include "src/__support/error_or.h" #include "src/__support/macros/attributes.h" // For LIBC_INLINE #include "src/__support/macros/config.h" -#include "src/stdio/printf_core/core_structs.h" -#include "src/stdio/printf_core/printf_main.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/printf_main.h" +#include "src/__support/printf_core/writer.h" #include "hdr/types/FILE.h" @@ -105,4 +105,4 @@ LIBC_INLINE ErrorOr vfprintf_internal(::FILE *__restrict stream, } // namespace printf_core } // namespace LIBC_NAMESPACE_DECL -#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_VFPRINTF_INTERNAL_H +#endif // LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_VFPRINTF_INTERNAL_H diff --git a/libc/src/stdio/printf_core/write_int_converter.h b/libc/src/__support/printf_core/write_int_converter.h similarity index 88% rename from libc/src/stdio/printf_core/write_int_converter.h rename to libc/src/__support/printf_core/write_int_converter.h index 2844a56dc992..0d6c79015164 100644 --- a/libc/src/stdio/printf_core/write_int_converter.h +++ b/libc/src/__support/printf_core/write_int_converter.h @@ -6,12 +6,12 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_SRC_STDIO_PRINTF_CORE_WRITE_INT_CONVERTER_H -#define LLVM_LIBC_SRC_STDIO_PRINTF_CORE_WRITE_INT_CONVERTER_H +#ifndef LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_WRITE_INT_CONVERTER_H +#define LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_WRITE_INT_CONVERTER_H #include "src/__support/macros/config.h" -#include "src/stdio/printf_core/core_structs.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/writer.h" #include #include @@ -75,4 +75,4 @@ LIBC_INLINE int convert_write_int(Writer *writer, } // namespace printf_core } // namespace LIBC_NAMESPACE_DECL -#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_WRITE_INT_CONVERTER_H +#endif // LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_WRITE_INT_CONVERTER_H diff --git a/libc/src/stdio/printf_core/write_modes.def b/libc/src/__support/printf_core/write_modes.def similarity index 100% rename from libc/src/stdio/printf_core/write_modes.def rename to libc/src/__support/printf_core/write_modes.def diff --git a/libc/src/stdio/printf_core/writer.h b/libc/src/__support/printf_core/writer.h similarity index 97% rename from libc/src/stdio/printf_core/writer.h rename to libc/src/__support/printf_core/writer.h index b82792e4d5e0..e7d3fe530d7b 100644 --- a/libc/src/stdio/printf_core/writer.h +++ b/libc/src/__support/printf_core/writer.h @@ -6,13 +6,13 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_SRC_STDIO_PRINTF_CORE_WRITER_H -#define LLVM_LIBC_SRC_STDIO_PRINTF_CORE_WRITER_H +#ifndef LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_WRITER_H +#define LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_WRITER_H #include "src/__support/CPP/string_view.h" #include "src/__support/macros/config.h" #include "src/__support/macros/optimization.h" -#include "src/stdio/printf_core/core_structs.h" +#include "src/__support/printf_core/core_structs.h" #include "src/string/memory_utils/inline_memcpy.h" #include "src/string/memory_utils/inline_memset.h" @@ -23,7 +23,7 @@ namespace printf_core { #define HANDLE_WRITE_MODE(MODE) MODE, enum class WriteMode { -#include "src/stdio/printf_core/write_modes.def" +#include "src/__support/printf_core/write_modes.def" }; #undef HANDLE_WRITE_MODE @@ -254,4 +254,4 @@ Writer(WriteBuffer) } // namespace printf_core } // namespace LIBC_NAMESPACE_DECL -#endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_WRITER_H +#endif // LLVM_LIBC_SRC___SUPPORT_PRINTF_CORE_WRITER_H diff --git a/libc/src/err/CMakeLists.txt b/libc/src/err/CMakeLists.txt index a2c2c43f4fc3..8f72d2178ea7 100644 --- a/libc/src/err/CMakeLists.txt +++ b/libc/src/err/CMakeLists.txt @@ -14,8 +14,8 @@ add_object_library( libc.src.__support.libc_errno libc.src.__support.OSUtil.osutil libc.src.__support.StringUtil.error_to_string - libc.src.stdio.printf_core.printf_main - libc.src.stdio.printf_core.writer + libc.src.__support.printf_core.printf_main + libc.src.__support.printf_core.writer libc.src.__support.CPP.string_view libc.src.__support.macros.config ) diff --git a/libc/src/err/report.cpp b/libc/src/err/report.cpp index bd4274fce77e..1dd69dce3a5f 100644 --- a/libc/src/err/report.cpp +++ b/libc/src/err/report.cpp @@ -20,8 +20,8 @@ #include "src/__support/arg_list.h" #include "src/__support/libc_errno.h" #include "src/__support/macros/config.h" -#include "src/stdio/printf_core/printf_main.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/printf_main.h" +#include "src/__support/printf_core/writer.h" #ifdef __linux__ extern "C" char *program_invocation_short_name; diff --git a/libc/src/stdio/CMakeLists.txt b/libc/src/stdio/CMakeLists.txt index feee8d60d1c6..0e3fe55462e0 100644 --- a/libc/src/stdio/CMakeLists.txt +++ b/libc/src/stdio/CMakeLists.txt @@ -129,10 +129,10 @@ add_entrypoint_object( HDRS sprintf.h DEPENDS - libc.src.stdio.printf_core.printf_main - libc.src.stdio.printf_core.writer - libc.src.stdio.printf_core.core_structs - libc.src.stdio.printf_core.error_mapper + libc.src.__support.printf_core.printf_main + libc.src.__support.printf_core.writer + libc.src.__support.printf_core.core_structs + libc.src.__support.printf_core.error_mapper libc.src.__support.libc_errno libc.src.__support.CPP.limits ) @@ -148,10 +148,10 @@ add_entrypoint_object( HDRS snprintf.h DEPENDS - libc.src.stdio.printf_core.printf_main - libc.src.stdio.printf_core.writer - libc.src.stdio.printf_core.core_structs - libc.src.stdio.printf_core.error_mapper + libc.src.__support.printf_core.printf_main + libc.src.__support.printf_core.writer + libc.src.__support.printf_core.core_structs + libc.src.__support.printf_core.error_mapper libc.src.__support.libc_errno libc.src.__support.CPP.limits ) @@ -167,9 +167,9 @@ add_entrypoint_object( HDRS asprintf.h DEPENDS - libc.src.stdio.printf_core.vasprintf_internal - libc.src.stdio.printf_core.core_structs - libc.src.stdio.printf_core.error_mapper + libc.src.__support.printf_core.vasprintf_internal + libc.src.__support.printf_core.core_structs + libc.src.__support.printf_core.error_mapper libc.src.__support.libc_errno libc.src.__support.CPP.limits ) @@ -186,10 +186,10 @@ add_entrypoint_object( HDRS vsprintf.h DEPENDS - libc.src.stdio.printf_core.printf_main - libc.src.stdio.printf_core.writer - libc.src.stdio.printf_core.core_structs - libc.src.stdio.printf_core.error_mapper + libc.src.__support.printf_core.printf_main + libc.src.__support.printf_core.writer + libc.src.__support.printf_core.core_structs + libc.src.__support.printf_core.error_mapper libc.src.__support.libc_errno libc.src.__support.CPP.limits ) @@ -206,10 +206,10 @@ add_entrypoint_object( HDRS vsnprintf.h DEPENDS - libc.src.stdio.printf_core.printf_main - libc.src.stdio.printf_core.writer - libc.src.stdio.printf_core.core_structs - libc.src.stdio.printf_core.error_mapper + libc.src.__support.printf_core.printf_main + libc.src.__support.printf_core.writer + libc.src.__support.printf_core.core_structs + libc.src.__support.printf_core.error_mapper libc.src.__support.libc_errno libc.src.__support.CPP.limits ) @@ -226,14 +226,13 @@ add_entrypoint_object( HDRS vasprintf.h DEPENDS - libc.src.stdio.printf_core.vasprintf_internal - libc.src.stdio.printf_core.core_structs - libc.src.stdio.printf_core.error_mapper + libc.src.__support.printf_core.vasprintf_internal + libc.src.__support.printf_core.core_structs + libc.src.__support.printf_core.error_mapper libc.src.__support.libc_errno libc.src.__support.CPP.limits ) -add_subdirectory(printf_core) add_subdirectory(scanf_core) add_entrypoint_object( diff --git a/libc/src/stdio/asprintf.cpp b/libc/src/stdio/asprintf.cpp index f80d2a5eb759..433e30005620 100644 --- a/libc/src/stdio/asprintf.cpp +++ b/libc/src/stdio/asprintf.cpp @@ -11,9 +11,9 @@ #include "src/__support/arg_list.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" -#include "src/stdio/printf_core/vasprintf_internal.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/error_mapper.h" +#include "src/__support/printf_core/vasprintf_internal.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/stdio/asprintf_modular.cpp b/libc/src/stdio/asprintf_modular.cpp index 74b62cc0c250..b1f4b86e712b 100644 --- a/libc/src/stdio/asprintf_modular.cpp +++ b/libc/src/stdio/asprintf_modular.cpp @@ -10,10 +10,10 @@ #include "src/__support/arg_list.h" #include "src/__support/libc_errno.h" #include "src/__support/macros/config.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/error_mapper.h" +#include "src/__support/printf_core/vasprintf_internal.h" #include "src/stdio/asprintf.h" -#include "src/stdio/printf_core/core_structs.h" -#include "src/stdio/printf_core/error_mapper.h" -#include "src/stdio/printf_core/vasprintf_internal.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/stdio/baremetal/CMakeLists.txt b/libc/src/stdio/baremetal/CMakeLists.txt index 526400380941..d26cdbb0f9d5 100644 --- a/libc/src/stdio/baremetal/CMakeLists.txt +++ b/libc/src/stdio/baremetal/CMakeLists.txt @@ -22,10 +22,10 @@ add_header_library( libc.src.__support.CPP.string_view libc.src.__support.libc_errno libc.src.__support.OSUtil.osutil - libc.src.stdio.printf_core.printf_main - libc.src.stdio.printf_core.writer - libc.src.stdio.printf_core.error_mapper - libc.src.stdio.printf_core.core_structs + libc.src.__support.printf_core.printf_main + libc.src.__support.printf_core.writer + libc.src.__support.printf_core.error_mapper + libc.src.__support.printf_core.core_structs ) add_header_library( diff --git a/libc/src/stdio/baremetal/vfprintf_internal.h b/libc/src/stdio/baremetal/vfprintf_internal.h index c4cd8b8ad8a8..c86c40a7cca0 100644 --- a/libc/src/stdio/baremetal/vfprintf_internal.h +++ b/libc/src/stdio/baremetal/vfprintf_internal.h @@ -17,10 +17,10 @@ #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" -#include "src/stdio/printf_core/printf_main.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/error_mapper.h" +#include "src/__support/printf_core/printf_main.h" +#include "src/__support/printf_core/writer.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/stdio/generic/CMakeLists.txt b/libc/src/stdio/generic/CMakeLists.txt index a9c5ae698c3b..6b3b611ad731 100644 --- a/libc/src/stdio/generic/CMakeLists.txt +++ b/libc/src/stdio/generic/CMakeLists.txt @@ -412,9 +412,9 @@ list(APPEND fprintf_deps libc.src.__support.arg_list libc.src.__support.CPP.limits libc.src.__support.libc_errno - libc.src.stdio.printf_core.vfprintf_internal - libc.src.stdio.printf_core.core_structs - libc.src.stdio.printf_core.error_mapper + libc.src.__support.printf_core.vfprintf_internal + libc.src.__support.printf_core.core_structs + libc.src.__support.printf_core.error_mapper ) if(LLVM_LIBC_FULL_BUILD) diff --git a/libc/src/stdio/generic/fprintf.cpp b/libc/src/stdio/generic/fprintf.cpp index b2033901557a..11eeeb7dd4ad 100644 --- a/libc/src/stdio/generic/fprintf.cpp +++ b/libc/src/stdio/generic/fprintf.cpp @@ -12,9 +12,9 @@ #include "src/__support/File/file.h" #include "src/__support/arg_list.h" #include "src/__support/macros/config.h" -#include "src/stdio/printf_core/core_structs.h" -#include "src/stdio/printf_core/error_mapper.h" -#include "src/stdio/printf_core/vfprintf_internal.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/error_mapper.h" +#include "src/__support/printf_core/vfprintf_internal.h" #include "hdr/types/FILE.h" #include diff --git a/libc/src/stdio/generic/printf.cpp b/libc/src/stdio/generic/printf.cpp index d02007dbd147..5cb8820f8c84 100644 --- a/libc/src/stdio/generic/printf.cpp +++ b/libc/src/stdio/generic/printf.cpp @@ -12,9 +12,9 @@ #include "src/__support/File/file.h" #include "src/__support/arg_list.h" #include "src/__support/macros/config.h" -#include "src/stdio/printf_core/core_structs.h" -#include "src/stdio/printf_core/error_mapper.h" -#include "src/stdio/printf_core/vfprintf_internal.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/error_mapper.h" +#include "src/__support/printf_core/vfprintf_internal.h" #include "src/stdio/stdout.h" #include "hdr/types/FILE.h" diff --git a/libc/src/stdio/generic/vfprintf.cpp b/libc/src/stdio/generic/vfprintf.cpp index a26f082ed934..fe70296a4b3a 100644 --- a/libc/src/stdio/generic/vfprintf.cpp +++ b/libc/src/stdio/generic/vfprintf.cpp @@ -12,9 +12,9 @@ #include "src/__support/File/file.h" #include "src/__support/arg_list.h" #include "src/__support/macros/config.h" -#include "src/stdio/printf_core/core_structs.h" -#include "src/stdio/printf_core/error_mapper.h" -#include "src/stdio/printf_core/vfprintf_internal.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/error_mapper.h" +#include "src/__support/printf_core/vfprintf_internal.h" #include "hdr/types/FILE.h" #include diff --git a/libc/src/stdio/generic/vprintf.cpp b/libc/src/stdio/generic/vprintf.cpp index 2bd3b40a821c..ee9e0d3059a2 100644 --- a/libc/src/stdio/generic/vprintf.cpp +++ b/libc/src/stdio/generic/vprintf.cpp @@ -12,9 +12,9 @@ #include "src/__support/File/file.h" #include "src/__support/arg_list.h" #include "src/__support/macros/config.h" -#include "src/stdio/printf_core/core_structs.h" -#include "src/stdio/printf_core/error_mapper.h" -#include "src/stdio/printf_core/vfprintf_internal.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/error_mapper.h" +#include "src/__support/printf_core/vfprintf_internal.h" #include "src/stdio/stdout.h" #include "hdr/types/FILE.h" diff --git a/libc/src/stdio/snprintf.cpp b/libc/src/stdio/snprintf.cpp index d8fb1b1ad357..ec1364ca6efc 100644 --- a/libc/src/stdio/snprintf.cpp +++ b/libc/src/stdio/snprintf.cpp @@ -12,10 +12,10 @@ #include "src/__support/arg_list.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" -#include "src/stdio/printf_core/printf_main.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/error_mapper.h" +#include "src/__support/printf_core/printf_main.h" +#include "src/__support/printf_core/writer.h" #include #include diff --git a/libc/src/stdio/snprintf_modular.cpp b/libc/src/stdio/snprintf_modular.cpp index 2e7683d56de7..86afdb9c5828 100644 --- a/libc/src/stdio/snprintf_modular.cpp +++ b/libc/src/stdio/snprintf_modular.cpp @@ -12,10 +12,10 @@ #include "src/__support/arg_list.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" -#include "src/stdio/printf_core/printf_main.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/error_mapper.h" +#include "src/__support/printf_core/printf_main.h" +#include "src/__support/printf_core/writer.h" #include #include diff --git a/libc/src/stdio/sprintf.cpp b/libc/src/stdio/sprintf.cpp index bbb3f64ea7b1..702ea5d43c69 100644 --- a/libc/src/stdio/sprintf.cpp +++ b/libc/src/stdio/sprintf.cpp @@ -12,10 +12,10 @@ #include "src/__support/arg_list.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" -#include "src/stdio/printf_core/printf_main.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/error_mapper.h" +#include "src/__support/printf_core/printf_main.h" +#include "src/__support/printf_core/writer.h" #include diff --git a/libc/src/stdio/sprintf_modular.cpp b/libc/src/stdio/sprintf_modular.cpp index cfed3fe4a4f4..9003e2440d53 100644 --- a/libc/src/stdio/sprintf_modular.cpp +++ b/libc/src/stdio/sprintf_modular.cpp @@ -12,10 +12,10 @@ #include "src/__support/arg_list.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" -#include "src/stdio/printf_core/printf_main.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/error_mapper.h" +#include "src/__support/printf_core/printf_main.h" +#include "src/__support/printf_core/writer.h" #include diff --git a/libc/src/stdio/vasprintf.cpp b/libc/src/stdio/vasprintf.cpp index 64d959c6edca..444b5b1efffd 100644 --- a/libc/src/stdio/vasprintf.cpp +++ b/libc/src/stdio/vasprintf.cpp @@ -10,9 +10,9 @@ #include "src/__support/CPP/limits.h" #include "src/__support/arg_list.h" #include "src/__support/libc_errno.h" -#include "src/stdio/printf_core/core_structs.h" -#include "src/stdio/printf_core/error_mapper.h" -#include "src/stdio/printf_core/vasprintf_internal.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/error_mapper.h" +#include "src/__support/printf_core/vasprintf_internal.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/stdio/vasprintf_modular.cpp b/libc/src/stdio/vasprintf_modular.cpp index 98620bb8a440..87dda8e82813 100644 --- a/libc/src/stdio/vasprintf_modular.cpp +++ b/libc/src/stdio/vasprintf_modular.cpp @@ -9,9 +9,9 @@ #include "src/__support/CPP/limits.h" #include "src/__support/arg_list.h" #include "src/__support/libc_errno.h" -#include "src/stdio/printf_core/core_structs.h" -#include "src/stdio/printf_core/error_mapper.h" -#include "src/stdio/printf_core/vasprintf_internal.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/error_mapper.h" +#include "src/__support/printf_core/vasprintf_internal.h" #include "src/stdio/vasprintf.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/stdio/vsnprintf.cpp b/libc/src/stdio/vsnprintf.cpp index bea980d6b20e..b25daed931fc 100644 --- a/libc/src/stdio/vsnprintf.cpp +++ b/libc/src/stdio/vsnprintf.cpp @@ -12,10 +12,10 @@ #include "src/__support/arg_list.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" -#include "src/stdio/printf_core/printf_main.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/error_mapper.h" +#include "src/__support/printf_core/printf_main.h" +#include "src/__support/printf_core/writer.h" #include #include diff --git a/libc/src/stdio/vsnprintf_modular.cpp b/libc/src/stdio/vsnprintf_modular.cpp index 722531160128..96f020839c3c 100644 --- a/libc/src/stdio/vsnprintf_modular.cpp +++ b/libc/src/stdio/vsnprintf_modular.cpp @@ -12,10 +12,10 @@ #include "src/__support/arg_list.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" -#include "src/stdio/printf_core/printf_main.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/error_mapper.h" +#include "src/__support/printf_core/printf_main.h" +#include "src/__support/printf_core/writer.h" #include #include diff --git a/libc/src/stdio/vsprintf.cpp b/libc/src/stdio/vsprintf.cpp index 3dae05fbbaad..f1af2f6143ad 100644 --- a/libc/src/stdio/vsprintf.cpp +++ b/libc/src/stdio/vsprintf.cpp @@ -12,10 +12,10 @@ #include "src/__support/arg_list.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" -#include "src/stdio/printf_core/printf_main.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/error_mapper.h" +#include "src/__support/printf_core/printf_main.h" +#include "src/__support/printf_core/writer.h" #include diff --git a/libc/src/stdio/vsprintf_modular.cpp b/libc/src/stdio/vsprintf_modular.cpp index 844d1e3cdd55..34deab1bfe41 100644 --- a/libc/src/stdio/vsprintf_modular.cpp +++ b/libc/src/stdio/vsprintf_modular.cpp @@ -12,10 +12,10 @@ #include "src/__support/arg_list.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" -#include "src/stdio/printf_core/printf_main.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/error_mapper.h" +#include "src/__support/printf_core/printf_main.h" +#include "src/__support/printf_core/writer.h" #include diff --git a/libc/src/stdlib/CMakeLists.txt b/libc/src/stdlib/CMakeLists.txt index 27a9934d0bd3..7df0a2b0c465 100644 --- a/libc/src/stdlib/CMakeLists.txt +++ b/libc/src/stdlib/CMakeLists.txt @@ -116,7 +116,7 @@ add_entrypoint_object( DEPENDS .str_from_util libc.src.__support.CPP.limits - libc.src.stdio.printf_core.error_mapper + libc.src.__support.printf_core.error_mapper ) add_entrypoint_object( @@ -128,7 +128,7 @@ add_entrypoint_object( DEPENDS .str_from_util libc.src.__support.CPP.limits - libc.src.stdio.printf_core.error_mapper + libc.src.__support.printf_core.error_mapper ) add_entrypoint_object( @@ -140,7 +140,7 @@ add_entrypoint_object( DEPENDS .str_from_util libc.src.__support.CPP.limits - libc.src.stdio.printf_core.error_mapper + libc.src.__support.printf_core.error_mapper ) add_header_library( @@ -148,9 +148,9 @@ add_header_library( HDRS str_from_util.h DEPENDS - libc.src.stdio.printf_core.converter - libc.src.stdio.printf_core.core_structs - libc.src.stdio.printf_core.writer + libc.src.__support.printf_core.converter + libc.src.__support.printf_core.core_structs + libc.src.__support.printf_core.writer libc.src.__support.str_to_integer libc.src.__support.CPP.type_traits ) diff --git a/libc/src/stdlib/str_from_util.h b/libc/src/stdlib/str_from_util.h index 61e6ba24b381..8cd147580f71 100644 --- a/libc/src/stdlib/str_from_util.h +++ b/libc/src/stdlib/str_from_util.h @@ -19,10 +19,10 @@ #include "src/__support/CPP/type_traits.h" #include "src/__support/macros/config.h" +#include "src/__support/printf_core/converter_atlas.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/writer.h" #include "src/__support/str_to_integer.h" -#include "src/stdio/printf_core/converter_atlas.h" -#include "src/stdio/printf_core/core_structs.h" -#include "src/stdio/printf_core/writer.h" #include diff --git a/libc/src/stdlib/strfromd.cpp b/libc/src/stdlib/strfromd.cpp index 5409a57c722d..dbf46b7c0534 100644 --- a/libc/src/stdlib/strfromd.cpp +++ b/libc/src/stdlib/strfromd.cpp @@ -9,8 +9,8 @@ #include "src/stdlib/strfromd.h" #include "src/__support/CPP/limits.h" #include "src/__support/macros/config.h" -#include "src/stdio/printf_core/core_structs.h" -#include "src/stdio/printf_core/error_mapper.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/error_mapper.h" #include "src/stdlib/str_from_util.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/stdlib/strfromf.cpp b/libc/src/stdlib/strfromf.cpp index e68e50210dd4..d1ea47d55a25 100644 --- a/libc/src/stdlib/strfromf.cpp +++ b/libc/src/stdlib/strfromf.cpp @@ -9,8 +9,8 @@ #include "src/stdlib/strfromf.h" #include "src/__support/CPP/limits.h" #include "src/__support/macros/config.h" -#include "src/stdio/printf_core/core_structs.h" -#include "src/stdio/printf_core/error_mapper.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/error_mapper.h" #include "src/stdlib/str_from_util.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/stdlib/strfroml.cpp b/libc/src/stdlib/strfroml.cpp index 8dbd8d7fc4f2..c23c12fc91c2 100644 --- a/libc/src/stdlib/strfroml.cpp +++ b/libc/src/stdlib/strfroml.cpp @@ -9,8 +9,8 @@ #include "src/stdlib/strfroml.h" #include "src/__support/CPP/limits.h" #include "src/__support/macros/config.h" -#include "src/stdio/printf_core/core_structs.h" -#include "src/stdio/printf_core/error_mapper.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/error_mapper.h" #include "src/stdlib/str_from_util.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/time/CMakeLists.txt b/libc/src/time/CMakeLists.txt index 76178542c6c9..f6b1c370f6d8 100644 --- a/libc/src/time/CMakeLists.txt +++ b/libc/src/time/CMakeLists.txt @@ -194,9 +194,9 @@ add_entrypoint_object( DEPENDS libc.hdr.types.size_t libc.hdr.types.struct_tm - libc.src.stdio.printf_core.writer libc.src.time.strftime_core.strftime_main libc.src.__support.macros.null_check + libc.src.__support.printf_core.writer ) add_entrypoint_object( @@ -209,9 +209,9 @@ add_entrypoint_object( libc.hdr.types.locale_t libc.hdr.types.size_t libc.hdr.types.struct_tm - libc.src.stdio.printf_core.writer libc.src.time.strftime_core.strftime_main libc.src.__support.macros.null_check + libc.src.__support.printf_core.writer ) add_entrypoint_object( diff --git a/libc/src/time/strftime.cpp b/libc/src/time/strftime.cpp index 71e1e99080e5..5522a2c1d2e4 100644 --- a/libc/src/time/strftime.cpp +++ b/libc/src/time/strftime.cpp @@ -12,7 +12,7 @@ #include "src/__support/common.h" #include "src/__support/macros/config.h" #include "src/__support/macros/null_check.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/writer.h" #include "src/time/strftime_core/strftime_main.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/time/strftime_core/CMakeLists.txt b/libc/src/time/strftime_core/CMakeLists.txt index 31eb41aa1647..6996638128da 100644 --- a/libc/src/time/strftime_core/CMakeLists.txt +++ b/libc/src/time/strftime_core/CMakeLists.txt @@ -30,7 +30,7 @@ add_header_library( .core_structs libc.src.time.time_utils libc.src.time.time_constants - libc.src.stdio.printf_core.writer + libc.src.__support.printf_core.writer libc.src.__support.CPP.string_view libc.src.__support.integer_to_string libc.src.__support.error_or @@ -45,6 +45,6 @@ add_header_library( .parser .converter libc.src.__support.error_or - libc.src.stdio.printf_core.writer + libc.src.__support.printf_core.writer libc.hdr.types.struct_tm ) diff --git a/libc/src/time/strftime_core/composite_converter.h b/libc/src/time/strftime_core/composite_converter.h index 9d343f3aef61..ec279615806e 100644 --- a/libc/src/time/strftime_core/composite_converter.h +++ b/libc/src/time/strftime_core/composite_converter.h @@ -12,7 +12,7 @@ #include "hdr/types/struct_tm.h" #include "src/__support/CPP/string_view.h" #include "src/__support/macros/config.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/writer.h" #include "src/time/strftime_core/core_structs.h" #include "src/time/strftime_core/num_converter.h" #include "src/time/strftime_core/str_converter.h" diff --git a/libc/src/time/strftime_core/converter.h b/libc/src/time/strftime_core/converter.h index 94e4366b4cb2..b6203ae8b72d 100644 --- a/libc/src/time/strftime_core/converter.h +++ b/libc/src/time/strftime_core/converter.h @@ -16,7 +16,7 @@ #include "hdr/types/struct_tm.h" #include "src/__support/macros/config.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/writer.h" #include "src/time/strftime_core/composite_converter.h" #include "src/time/strftime_core/core_structs.h" #include "src/time/strftime_core/num_converter.h" diff --git a/libc/src/time/strftime_core/num_converter.h b/libc/src/time/strftime_core/num_converter.h index c44e2058b665..6bcc166fecf9 100644 --- a/libc/src/time/strftime_core/num_converter.h +++ b/libc/src/time/strftime_core/num_converter.h @@ -14,7 +14,7 @@ #include "src/__support/error_or.h" #include "src/__support/integer_to_string.h" #include "src/__support/macros/config.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/writer.h" #include "src/time/strftime_core/core_structs.h" #include "src/time/time_constants.h" #include "src/time/time_utils.h" diff --git a/libc/src/time/strftime_core/str_converter.h b/libc/src/time/strftime_core/str_converter.h index 3273dcf9a6b8..4a636679c4a1 100644 --- a/libc/src/time/strftime_core/str_converter.h +++ b/libc/src/time/strftime_core/str_converter.h @@ -17,7 +17,7 @@ #include "hdr/types/struct_tm.h" #include "src/__support/CPP/string_view.h" #include "src/__support/macros/config.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/writer.h" #include "src/time/strftime_core/core_structs.h" #include "src/time/time_constants.h" #include "src/time/time_utils.h" diff --git a/libc/src/time/strftime_core/strftime_main.h b/libc/src/time/strftime_core/strftime_main.h index 855a44107914..4f958fb5bb29 100644 --- a/libc/src/time/strftime_core/strftime_main.h +++ b/libc/src/time/strftime_core/strftime_main.h @@ -12,7 +12,7 @@ #include "hdr/types/struct_tm.h" #include "src/__support/error_or.h" #include "src/__support/macros/config.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/writer.h" #include "src/time/strftime_core/converter.h" #include "src/time/strftime_core/core_structs.h" #include "src/time/strftime_core/parser.h" diff --git a/libc/src/time/strftime_l.cpp b/libc/src/time/strftime_l.cpp index 8a8950fee91c..faf3883c476b 100644 --- a/libc/src/time/strftime_l.cpp +++ b/libc/src/time/strftime_l.cpp @@ -13,7 +13,7 @@ #include "src/__support/common.h" #include "src/__support/macros/config.h" #include "src/__support/macros/null_check.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/writer.h" #include "src/time/strftime_core/strftime_main.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/test/UnitTest/CMakeLists.txt b/libc/test/UnitTest/CMakeLists.txt index 4a47597ae3a4..09e7655683fd 100644 --- a/libc/test/UnitTest/CMakeLists.txt +++ b/libc/test/UnitTest/CMakeLists.txt @@ -183,8 +183,8 @@ add_unittest_framework_library( LibcTest libc.hdr.stdint_proxy libc.src.__support.FPUtil.fp_bits - libc.src.stdio.printf_core.core_structs - libc.src.stdio.printf_core.printf_config + libc.src.__support.printf_core.core_structs + libc.src.__support.printf_core.printf_config libc.test.UnitTest.string_utils ) diff --git a/libc/test/UnitTest/PrintfMatcher.cpp b/libc/test/UnitTest/PrintfMatcher.cpp index 886737f0dcb0..4fa8864b8744 100644 --- a/libc/test/UnitTest/PrintfMatcher.cpp +++ b/libc/test/UnitTest/PrintfMatcher.cpp @@ -11,8 +11,8 @@ #include "hdr/stdint_proxy.h" #include "src/__support/FPUtil/FPBits.h" #include "src/__support/macros/config.h" -#include "src/stdio/printf_core/core_structs.h" -#include "src/stdio/printf_core/printf_config.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/printf_config.h" #include "test/UnitTest/StringUtils.h" #include "test/UnitTest/Test.h" diff --git a/libc/test/UnitTest/PrintfMatcher.h b/libc/test/UnitTest/PrintfMatcher.h index 4f79832ab59f..bb38aa43c36b 100644 --- a/libc/test/UnitTest/PrintfMatcher.h +++ b/libc/test/UnitTest/PrintfMatcher.h @@ -10,7 +10,7 @@ #define LLVM_LIBC_UTILS_UNITTEST_PRINTF_MATCHER_H #include "src/__support/macros/config.h" -#include "src/stdio/printf_core/core_structs.h" +#include "src/__support/printf_core/core_structs.h" #include "test/UnitTest/Test.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/test/shared/CMakeLists.txt b/libc/test/shared/CMakeLists.txt index 71b8bcd8d4ff..9208dbcc5ade 100644 --- a/libc/test/shared/CMakeLists.txt +++ b/libc/test/shared/CMakeLists.txt @@ -863,9 +863,9 @@ add_libc_test( SRCS shared_rpc_test.cpp DEPENDS - libc.src.stdio.printf_core.converter - libc.src.stdio.printf_core.parser - libc.src.stdio.printf_core.writer + libc.src.__support.printf_core.converter + libc.src.__support.printf_core.parser + libc.src.__support.printf_core.writer libc.src.__support.arg_list ) endif() diff --git a/libc/test/src/__support/CMakeLists.txt b/libc/test/src/__support/CMakeLists.txt index 823352926632..4e6784691d5e 100644 --- a/libc/test/src/__support/CMakeLists.txt +++ b/libc/test/src/__support/CMakeLists.txt @@ -305,6 +305,7 @@ add_libc_test( add_subdirectory(CPP) add_subdirectory(File) +add_subdirectory(printf_core) add_subdirectory(RPC) add_subdirectory(OSUtil) add_subdirectory(FPUtil) diff --git a/libc/test/src/stdio/printf_core/CMakeLists.txt b/libc/test/src/__support/printf_core/CMakeLists.txt similarity index 56% rename from libc/test/src/stdio/printf_core/CMakeLists.txt rename to libc/test/src/__support/printf_core/CMakeLists.txt index ff7ebbc4f5fd..b4db46566636 100644 --- a/libc/test/src/stdio/printf_core/CMakeLists.txt +++ b/libc/test/src/__support/printf_core/CMakeLists.txt @@ -1,14 +1,14 @@ add_libc_unittest( parser_test SUITE - libc_stdio_unittests + libc-support-tests SRCS parser_test.cpp LINK_LIBRARIES LibcPrintfHelpers DEPENDS - libc.src.stdio.printf_core.parser - libc.src.stdio.printf_core.core_structs + libc.src.__support.printf_core.parser + libc.src.__support.printf_core.core_structs libc.src.__support.CPP.string_view libc.src.__support.arg_list ) @@ -16,11 +16,11 @@ add_libc_unittest( add_libc_unittest( writer_test SUITE - libc_stdio_unittests + libc-support-tests SRCS writer_test.cpp DEPENDS - libc.src.stdio.printf_core.writer + libc.src.__support.printf_core.writer libc.src.string.memory_utils.inline_memcpy libc.src.__support.CPP.string_view ) @@ -28,11 +28,11 @@ add_libc_unittest( add_libc_unittest( converter_test SUITE - libc_stdio_unittests + libc-support-tests SRCS converter_test.cpp DEPENDS - libc.src.stdio.printf_core.converter - libc.src.stdio.printf_core.writer - libc.src.stdio.printf_core.core_structs + libc.src.__support.printf_core.converter + libc.src.__support.printf_core.writer + libc.src.__support.printf_core.core_structs ) diff --git a/libc/test/src/stdio/printf_core/converter_test.cpp b/libc/test/src/__support/printf_core/converter_test.cpp similarity index 98% rename from libc/test/src/stdio/printf_core/converter_test.cpp rename to libc/test/src/__support/printf_core/converter_test.cpp index 68e2fdac89d4..36037ab2ed4b 100644 --- a/libc/test/src/stdio/printf_core/converter_test.cpp +++ b/libc/test/src/__support/printf_core/converter_test.cpp @@ -6,9 +6,9 @@ // //===----------------------------------------------------------------------===// -#include "src/stdio/printf_core/converter.h" -#include "src/stdio/printf_core/core_structs.h" -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/converter.h" +#include "src/__support/printf_core/core_structs.h" +#include "src/__support/printf_core/writer.h" #include "test/UnitTest/Test.h" diff --git a/libc/test/src/stdio/printf_core/parser_test.cpp b/libc/test/src/__support/printf_core/parser_test.cpp similarity index 99% rename from libc/test/src/stdio/printf_core/parser_test.cpp rename to libc/test/src/__support/printf_core/parser_test.cpp index a73e3af990dd..591bf2de8712 100644 --- a/libc/test/src/stdio/printf_core/parser_test.cpp +++ b/libc/test/src/__support/printf_core/parser_test.cpp @@ -9,7 +9,7 @@ #include "src/__support/CPP/bit.h" #include "src/__support/CPP/string_view.h" #include "src/__support/arg_list.h" -#include "src/stdio/printf_core/parser.h" +#include "src/__support/printf_core/parser.h" #include diff --git a/libc/test/src/stdio/printf_core/writer_test.cpp b/libc/test/src/__support/printf_core/writer_test.cpp similarity index 99% rename from libc/test/src/stdio/printf_core/writer_test.cpp rename to libc/test/src/__support/printf_core/writer_test.cpp index e0128505b276..b1873d729bb3 100644 --- a/libc/test/src/stdio/printf_core/writer_test.cpp +++ b/libc/test/src/__support/printf_core/writer_test.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/stdio/printf_core/writer.h" +#include "src/__support/printf_core/writer.h" #include "src/__support/CPP/string_view.h" #include "src/string/memory_utils/inline_memcpy.h" diff --git a/libc/test/src/stdio/CMakeLists.txt b/libc/test/src/stdio/CMakeLists.txt index 465e3c869807..e0e5656f24db 100644 --- a/libc/test/src/stdio/CMakeLists.txt +++ b/libc/test/src/stdio/CMakeLists.txt @@ -173,9 +173,9 @@ add_fp_unittest( SRCS sprintf_test.cpp DEPENDS - libc.src.stdio.printf_core.printf_config libc.src.stdio.sprintf libc.src.__support.FPUtil.fp_bits + libc.src.__support.printf_core.printf_config libc.include.inttypes ${wchar_deps} COMPILE_OPTIONS @@ -609,6 +609,5 @@ if(LIBC_TARGET_OS_IS_GPU) return() endif() -add_subdirectory(printf_core) add_subdirectory(scanf_core) add_subdirectory(testdata) diff --git a/libc/test/src/stdio/sprintf_test.cpp b/libc/test/src/stdio/sprintf_test.cpp index 3c0e9c74d0c0..a36692033911 100644 --- a/libc/test/src/stdio/sprintf_test.cpp +++ b/libc/test/src/stdio/sprintf_test.cpp @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include "src/__support/macros/config.h" -#include "src/stdio/printf_core/printf_config.h" +#include "src/__support/printf_core/printf_config.h" #include "src/stdio/sprintf.h" #ifndef LIBC_COPT_PRINTF_DISABLE_WIDE diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel index 6020f511d0d3..bee6f7aa5766 100644 --- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel @@ -2064,6 +2064,180 @@ libc_support_library( ], ) +libc_support_library( + name = "__support_printf_core_printf_config", + hdrs = ["src/__support/printf_core/printf_config.h"], + deps = [ + ], +) + +libc_support_library( + name = "__support_printf_core_printf_core_structs", + hdrs = ["src/__support/printf_core/core_structs.h"], + deps = [ + ":__support_cpp_string_view", + ":__support_cpp_type_traits", + ":__support_fputil_fp_bits", + ":__support_macros_config", + ":__support_printf_core_printf_config", + ], +) + +libc_support_library( + name = "__support_printf_core_printf_parser", + hdrs = ["src/__support/printf_core/parser.h"], + deps = [ + ":__support_arg_list", + ":__support_common", + ":__support_cpp_algorithm", + ":__support_cpp_bit", + ":__support_cpp_limits", + ":__support_cpp_optional", + ":__support_cpp_string_view", + ":__support_cpp_type_traits", + ":__support_ctype_utils", + ":__support_fixed_point", + ":__support_fputil_fp_bits", + ":__support_libc_errno", + ":__support_macros_config", + ":__support_macros_properties_types", + ":__support_printf_core_printf_config", + ":__support_printf_core_printf_core_structs", + ":__support_str_to_integer", + ":errno", + ":llvm_libc_macros_stdfix_macros", + ":types_wint_t", + ], +) + +libc_support_library( + name = "__support_printf_core_printf_writer", + hdrs = ["src/__support/printf_core/writer.h"], + textual_hdrs = ["src/__support/printf_core/write_modes.def"], + deps = [ + ":__support_cpp_string_view", + ":__support_macros_config", + ":__support_macros_optimization", + ":__support_printf_core_printf_core_structs", + ":string_memory_utils", + ], +) + +libc_support_library( + name = "__support_printf_core_printf_converter", + hdrs = [ + "src/__support/printf_core/char_converter.h", + "src/__support/printf_core/converter.h", + "src/__support/printf_core/converter_atlas.h", + "src/__support/printf_core/converter_utils.h", + "src/__support/printf_core/float_dec_converter.h", + "src/__support/printf_core/float_hex_converter.h", + "src/__support/printf_core/float_inf_nan_converter.h", + "src/__support/printf_core/int_converter.h", + "src/__support/printf_core/ptr_converter.h", + "src/__support/printf_core/strerror_converter.h", + "src/__support/printf_core/string_converter.h", + "src/__support/printf_core/write_int_converter.h", + ], + deps = [ + ":__support_big_int", + ":__support_common", + ":__support_cpp_limits", + ":__support_cpp_span", + ":__support_cpp_string_view", + ":__support_ctype_utils", + ":__support_float_to_string", + ":__support_fputil_fenv_impl", + ":__support_fputil_fp_bits", + ":__support_fputil_rounding_mode", + ":__support_integer_to_string", + ":__support_libc_assert", + ":__support_macros_config", + ":__support_printf_core_printf_config", + ":__support_printf_core_printf_core_structs", + ":__support_printf_core_printf_writer", + ":__support_stringutil", + ":__support_uint128", + ":__support_wchar_mbstate", + ":__support_wchar_string_converter", + ":__support_wchar_wcrtomb", + ":hdr_limits_macros", + ":hdr_wchar_macros", + ":string_utils", + ":types_char32_t", + ":types_char8_t", + ":types_wchar_t", + ":types_wint_t", + ], +) + +libc_support_library( + name = "__support_printf_core_printf_error_mapper", + hdrs = [ + "src/__support/printf_core/error_mapper.h", + ] + select({ + "@platforms//os:linux": [ + "src/__support/printf_core/linux/error_mapper.h", + ], + "//conditions:default": ["src/__support/printf_core/generic/error_mapper.h"], + }), + deps = [ + ":__support_cpp_type_traits", + ":__support_error_or", + ":__support_macros_properties_architectures", + ":__support_printf_core_printf_core_structs", + ":hdr_errno_macros", + ], +) + +libc_support_library( + name = "__support_printf_core_printf_main", + hdrs = ["src/__support/printf_core/printf_main.h"], + deps = [ + ":__support_arg_list", + ":__support_error_or", + ":__support_macros_config", + ":__support_printf_core_printf_converter", + ":__support_printf_core_printf_core_structs", + ":__support_printf_core_printf_error_mapper", + ":__support_printf_core_printf_parser", + ":__support_printf_core_printf_writer", + ], +) + +libc_support_library( + name = "__support_printf_core_vfprintf_internal", + hdrs = ["src/__support/printf_core/vfprintf_internal.h"], + deps = [ + ":__support_arg_list", + ":__support_error_or", + ":__support_file_file", + ":__support_macros_attributes", + ":__support_macros_config", + ":__support_printf_core_printf_core_structs", + ":__support_printf_core_printf_main", + ":__support_printf_core_printf_writer", + ":types_FILE", + ], +) + +libc_support_library( + name = "__support_printf_core_vasprintf_internal", + hdrs = ["src/__support/printf_core/vasprintf_internal.h"], + deps = [ + ":__support_arg_list", + ":__support_error_or", + ":__support_macros_attributes", + ":__support_printf_core_printf_core_structs", + ":__support_printf_core_printf_main", + ":__support_printf_core_printf_writer", + ":func_free", + ":func_malloc", + ":func_realloc", + ":types_FILE", + ], +) + libc_support_library( name = "__support_math_extras", hdrs = ["src/__support/math_extras.h"], @@ -13908,10 +14082,10 @@ libc_support_library( ":__support_common", ":__support_cpp_type_traits", ":__support_macros_config", + ":__support_printf_core_printf_converter", + ":__support_printf_core_printf_core_structs", + ":__support_printf_core_printf_writer", ":__support_str_to_integer", - ":printf_converter", - ":printf_core_structs", - ":printf_writer", ], ) @@ -13923,8 +14097,8 @@ libc_function( ":__support_common", ":__support_cpp_limits", ":__support_macros_config", - ":printf_core_structs", - ":printf_error_mapper", + ":__support_printf_core_printf_core_structs", + ":__support_printf_core_printf_error_mapper", ":str_from_util", ], ) @@ -13937,8 +14111,8 @@ libc_function( ":__support_common", ":__support_cpp_limits", ":__support_macros_config", - ":printf_core_structs", - ":printf_error_mapper", + ":__support_printf_core_printf_core_structs", + ":__support_printf_core_printf_error_mapper", ":str_from_util", ], ) @@ -13951,8 +14125,8 @@ libc_function( ":__support_common", ":__support_cpp_limits", ":__support_macros_config", - ":printf_core_structs", - ":printf_error_mapper", + ":__support_printf_core_printf_core_structs", + ":__support_printf_core_printf_error_mapper", ":str_from_util", ], ) @@ -15298,180 +15472,6 @@ libc_support_library( ], ) -libc_support_library( - name = "printf_config", - hdrs = ["src/stdio/printf_core/printf_config.h"], - deps = [ - ], -) - -libc_support_library( - name = "printf_core_structs", - hdrs = ["src/stdio/printf_core/core_structs.h"], - deps = [ - ":__support_cpp_string_view", - ":__support_cpp_type_traits", - ":__support_fputil_fp_bits", - ":__support_macros_config", - ":printf_config", - ], -) - -libc_support_library( - name = "printf_parser", - hdrs = ["src/stdio/printf_core/parser.h"], - deps = [ - ":__support_arg_list", - ":__support_common", - ":__support_cpp_algorithm", - ":__support_cpp_bit", - ":__support_cpp_limits", - ":__support_cpp_optional", - ":__support_cpp_string_view", - ":__support_cpp_type_traits", - ":__support_ctype_utils", - ":__support_fixed_point", - ":__support_fputil_fp_bits", - ":__support_libc_errno", - ":__support_macros_config", - ":__support_macros_properties_types", - ":__support_str_to_integer", - ":errno", - ":llvm_libc_macros_stdfix_macros", - ":printf_config", - ":printf_core_structs", - ":types_wint_t", - ], -) - -libc_support_library( - name = "printf_writer", - hdrs = ["src/stdio/printf_core/writer.h"], - textual_hdrs = ["src/stdio/printf_core/write_modes.def"], - deps = [ - ":__support_cpp_string_view", - ":__support_macros_config", - ":__support_macros_optimization", - ":printf_core_structs", - ":string_memory_utils", - ], -) - -libc_support_library( - name = "printf_converter", - hdrs = [ - "src/stdio/printf_core/char_converter.h", - "src/stdio/printf_core/converter.h", - "src/stdio/printf_core/converter_atlas.h", - "src/stdio/printf_core/converter_utils.h", - "src/stdio/printf_core/float_dec_converter.h", - "src/stdio/printf_core/float_hex_converter.h", - "src/stdio/printf_core/float_inf_nan_converter.h", - "src/stdio/printf_core/int_converter.h", - "src/stdio/printf_core/ptr_converter.h", - "src/stdio/printf_core/strerror_converter.h", - "src/stdio/printf_core/string_converter.h", - "src/stdio/printf_core/write_int_converter.h", - ], - deps = [ - ":__support_big_int", - ":__support_common", - ":__support_cpp_limits", - ":__support_cpp_span", - ":__support_cpp_string_view", - ":__support_ctype_utils", - ":__support_float_to_string", - ":__support_fputil_fenv_impl", - ":__support_fputil_fp_bits", - ":__support_fputil_rounding_mode", - ":__support_integer_to_string", - ":__support_libc_assert", - ":__support_macros_config", - ":__support_stringutil", - ":__support_uint128", - ":__support_wchar_mbstate", - ":__support_wchar_string_converter", - ":__support_wchar_wcrtomb", - ":hdr_limits_macros", - ":hdr_wchar_macros", - ":printf_config", - ":printf_core_structs", - ":printf_writer", - ":string_utils", - ":types_char32_t", - ":types_char8_t", - ":types_wchar_t", - ":types_wint_t", - ], -) - -libc_support_library( - name = "printf_error_mapper", - hdrs = [ - "src/stdio/printf_core/error_mapper.h", - ] + select({ - "@platforms//os:linux": [ - "src/stdio/printf_core/linux/error_mapper.h", - ], - "//conditions:default": ["src/stdio/printf_core/generic/error_mapper.h"], - }), - deps = [ - ":__support_cpp_type_traits", - ":__support_error_or", - ":__support_macros_properties_architectures", - ":hdr_errno_macros", - ":printf_core_structs", - ], -) - -libc_support_library( - name = "printf_main", - hdrs = ["src/stdio/printf_core/printf_main.h"], - deps = [ - ":__support_arg_list", - ":__support_error_or", - ":__support_macros_config", - ":printf_converter", - ":printf_core_structs", - ":printf_error_mapper", - ":printf_parser", - ":printf_writer", - ], -) - -libc_support_library( - name = "vfprintf_internal", - hdrs = ["src/stdio/printf_core/vfprintf_internal.h"], - deps = [ - ":__support_arg_list", - ":__support_error_or", - ":__support_file_file", - ":__support_macros_attributes", - ":__support_macros_config", - ":printf_core_structs", - ":printf_main", - ":printf_writer", - ":types_FILE", - ], -) - -libc_support_library( - name = "vasprintf_internal", - hdrs = ["src/stdio/printf_core/vasprintf_internal.h"], - deps = [ - ":__support_arg_list", - ":__support_error_or", - ":__support_macros_attributes", - ":func_free", - ":func_malloc", - ":func_realloc", - ":printf_core_structs", - ":printf_main", - ":printf_writer", - ":types_FILE", - ], -) - libc_function( name = "asprintf", srcs = ["src/stdio/asprintf.cpp"], @@ -15481,9 +15481,9 @@ libc_function( ":__support_cpp_limits", ":__support_libc_errno", ":__support_macros_config", - ":printf_core_structs", - ":printf_error_mapper", - ":vasprintf_internal", + ":__support_printf_core_printf_core_structs", + ":__support_printf_core_printf_error_mapper", + ":__support_printf_core_vasprintf_internal", ], ) @@ -15496,12 +15496,12 @@ libc_function( ":__support_cpp_limits", ":__support_libc_errno", ":__support_macros_config", + ":__support_printf_core_printf_config", + ":__support_printf_core_printf_core_structs", + ":__support_printf_core_printf_error_mapper", + ":__support_printf_core_printf_main", + ":__support_printf_core_printf_writer", ":errno", - ":printf_config", - ":printf_core_structs", - ":printf_error_mapper", - ":printf_main", - ":printf_writer", ], ) @@ -15514,11 +15514,11 @@ libc_function( ":__support_cpp_limits", ":__support_libc_errno", ":__support_macros_config", + ":__support_printf_core_printf_core_structs", + ":__support_printf_core_printf_error_mapper", + ":__support_printf_core_printf_main", + ":__support_printf_core_printf_writer", ":errno", - ":printf_core_structs", - ":printf_error_mapper", - ":printf_main", - ":printf_writer", ], ) @@ -15531,12 +15531,12 @@ libc_function( ":__support_cpp_limits", ":__support_file_file", ":__support_macros_config", + ":__support_printf_core_printf_core_structs", + ":__support_printf_core_printf_error_mapper", + ":__support_printf_core_vfprintf_internal", ":errno", - ":printf_core_structs", - ":printf_error_mapper", ":stdout", ":types_FILE", - ":vfprintf_internal", ], ) @@ -15549,11 +15549,11 @@ libc_function( ":__support_cpp_limits", ":__support_file_file", ":__support_macros_config", + ":__support_printf_core_printf_core_structs", + ":__support_printf_core_printf_error_mapper", + ":__support_printf_core_vfprintf_internal", ":errno", - ":printf_core_structs", - ":printf_error_mapper", ":types_FILE", - ":vfprintf_internal", ], ) @@ -15566,9 +15566,9 @@ libc_function( ":__support_cpp_limits", ":__support_libc_errno", ":__support_macros_config", - ":printf_core_structs", - ":printf_error_mapper", - ":vasprintf_internal", + ":__support_printf_core_printf_core_structs", + ":__support_printf_core_printf_error_mapper", + ":__support_printf_core_vasprintf_internal", ], ) @@ -15581,11 +15581,11 @@ libc_function( ":__support_cpp_limits", ":__support_libc_errno", ":__support_macros_config", + ":__support_printf_core_printf_core_structs", + ":__support_printf_core_printf_error_mapper", + ":__support_printf_core_printf_main", + ":__support_printf_core_printf_writer", ":errno", - ":printf_core_structs", - ":printf_error_mapper", - ":printf_main", - ":printf_writer", ], ) @@ -15598,11 +15598,11 @@ libc_function( ":__support_cpp_limits", ":__support_libc_errno", ":__support_macros_config", + ":__support_printf_core_printf_core_structs", + ":__support_printf_core_printf_error_mapper", + ":__support_printf_core_printf_main", + ":__support_printf_core_printf_writer", ":errno", - ":printf_core_structs", - ":printf_error_mapper", - ":printf_main", - ":printf_writer", ], ) @@ -15615,12 +15615,12 @@ libc_function( ":__support_cpp_limits", ":__support_file_file", ":__support_macros_config", + ":__support_printf_core_printf_core_structs", + ":__support_printf_core_printf_error_mapper", + ":__support_printf_core_vfprintf_internal", ":errno", - ":printf_core_structs", - ":printf_error_mapper", ":stdout", ":types_FILE", - ":vfprintf_internal", ], ) @@ -15633,11 +15633,11 @@ libc_function( ":__support_cpp_limits", ":__support_file_file", ":__support_macros_config", + ":__support_printf_core_printf_core_structs", + ":__support_printf_core_printf_error_mapper", + ":__support_printf_core_vfprintf_internal", ":errno", - ":printf_core_structs", - ":printf_error_mapper", ":types_FILE", - ":vfprintf_internal", ], ) diff --git a/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel index 9eacb9304335..ebe367e3d8b6 100644 --- a/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel @@ -152,9 +152,9 @@ libc_test_library( ":string_utils", "//libc:__support_fputil_fp_bits", "//libc:__support_macros_config", + "//libc:__support_printf_core_printf_config", + "//libc:__support_printf_core_printf_core_structs", "//libc:hdr_stdint_proxy", - "//libc:printf_config", - "//libc:printf_core_structs", ], ) diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/__support/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/__support/BUILD.bazel index 0698f45ceabc..d912c2f9e1d1 100644 --- a/utils/bazel/llvm-project-overlay/libc/test/src/__support/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/libc/test/src/__support/BUILD.bazel @@ -121,3 +121,40 @@ libc_test( "//libc:__support_macros_properties_types", ], ) + +libc_test( + name = "printf_parser_test", + srcs = ["printf_core/parser_test.cpp"], + deps = [ + "//libc:__support_arg_list", + "//libc:__support_cpp_bit", + "//libc:__support_cpp_string_view", + "//libc:__support_printf_core_printf_core_structs", + "//libc:__support_printf_core_printf_parser", + "//libc/test/UnitTest:printf_matcher", + ], +) + +libc_test( + name = "printf_writer_test", + srcs = ["printf_core/writer_test.cpp"], + deps = [ + "//libc:__support_arg_list", + "//libc:__support_cpp_string_view", + "//libc:__support_printf_core_printf_core_structs", + "//libc:__support_printf_core_printf_writer", + "//libc:string_memory_utils", + ], +) + +libc_test( + name = "printf_converter_test", + srcs = ["printf_core/converter_test.cpp"], + deps = [ + "//libc:__support_arg_list", + "//libc:__support_cpp_string_view", + "//libc:__support_printf_core_printf_converter", + "//libc:__support_printf_core_printf_core_structs", + "//libc:__support_printf_core_printf_writer", + ], +) diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel index f9d3c4288b1f..216e51dea58f 100644 --- a/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel @@ -10,43 +10,6 @@ package(default_visibility = ["//visibility:public"]) licenses(["notice"]) -libc_test( - name = "printf_parser_test", - srcs = ["printf_core/parser_test.cpp"], - deps = [ - "//libc:__support_arg_list", - "//libc:__support_cpp_bit", - "//libc:__support_cpp_string_view", - "//libc:printf_core_structs", - "//libc:printf_parser", - "//libc/test/UnitTest:printf_matcher", - ], -) - -libc_test( - name = "printf_writer_test", - srcs = ["printf_core/writer_test.cpp"], - deps = [ - "//libc:__support_arg_list", - "//libc:__support_cpp_string_view", - "//libc:printf_core_structs", - "//libc:printf_writer", - "//libc:string_memory_utils", - ], -) - -libc_test( - name = "printf_converter_test", - srcs = ["printf_core/converter_test.cpp"], - deps = [ - "//libc:__support_arg_list", - "//libc:__support_cpp_string_view", - "//libc:printf_converter", - "//libc:printf_core_structs", - "//libc:printf_writer", - ], -) - libc_test( name = "asprintf_test", srcs = ["asprintf_test.cpp"], @@ -62,8 +25,8 @@ libc_test( srcs = ["sprintf_test.cpp"], deps = [ "//libc:__support_fputil_fp_bits", + "//libc:__support_printf_core_printf_config", "//libc:hdr_wchar_macros", - "//libc:printf_config", "//libc:sprintf", "//libc:types_wint_t", "//libc/test/UnitTest:fp_test_helpers",