Expand Up
@@ -20,6 +20,12 @@ package(
licenses (["notice" ])
PRINTF_COPTS = [
"LIBC_COPT_PRINTF_USE_SYSTEM_FILE" ,
"LIBC_COPT_PRINTF_DISABLE_INDEX_MODE" ,
"LIBC_COPT_PRINTF_DISABLE_WRITE_INT" ,
]
# A flag to pick which `mpfr` to use for math tests.
# Usage: `--@llvm-project//libc:mpfr=<disable|external|system>`.
# Flag documentation: https://bazel.build/extending/config
Expand Down
Expand Up
@@ -153,6 +159,14 @@ libc_support_library(
],
)
libc_support_library (
name = "__support_cpp_expected" ,
hdrs = ["src/__support/CPP/expected.h" ],
deps = [
":libc_root" ,
],
)
libc_support_library (
name = "__support_cpp_functional" ,
hdrs = ["src/__support/CPP/functional.h" ],
Expand All
@@ -170,6 +184,16 @@ libc_support_library(
deps = [":libc_root" ],
)
libc_support_library (
name = "__support_cpp_new" ,
srcs = ["src/__support/CPP/new.cpp" ],
hdrs = ["src/__support/CPP/new.h" ],
deps = [
":__support_common" ,
":libc_root" ,
],
)
libc_support_library (
name = "__support_cpp_optional" ,
hdrs = ["src/__support/CPP/optional.h" ],
Expand Down
Expand Up
@@ -244,6 +268,25 @@ libc_support_library(
],
)
libc_support_library (
name = "__support_c_string" ,
hdrs = ["src/__support/c_string.h" ],
deps = [
":__support_cpp_string" ,
":libc_root" ,
],
)
libc_support_library (
name = "__support_error_or" ,
hdrs = ["src/__support/error_or.h" ],
deps = [
":__support_common" ,
":__support_cpp_expected" ,
":libc_root" ,
],
)
libc_support_library (
name = "__support_float_to_string" ,
hdrs = [
Expand Down
Expand Up
@@ -398,6 +441,20 @@ libc_support_library(
],
)
libc_support_library (
name = "__support_file_file" ,
srcs = ["src/__support/File/file.cpp" ],
hdrs = ["src/__support/File/file.h" ],
deps = [
":__support_cpp_new" ,
":__support_cpp_span" ,
":__support_error_or" ,
":__support_threads_mutex" ,
":errno" ,
":libc_root" ,
],
)
libc_support_library (
name = "__support_named_pair" ,
hdrs = ["src/__support/named_pair.h" ],
Expand Down
Expand Up
@@ -701,6 +758,23 @@ libc_support_library(
],
)
libc_support_library (
name = "__support_threads_mutex" ,
hdrs = [
"src/__support/threads/mutex.h" ,
"src/__support/threads/mutex_common.h" ,
],
textual_hdrs = [
"src/__support/threads/linux/mutex.h" ,
"src/__support/threads/linux/futex_word.h" ,
],
deps = [
":__support_cpp_atomic" ,
":__support_osutil_syscall" ,
":libc_root" ,
],
)
############################### errno targets ################################
libc_function (
Expand Down
Expand Up
@@ -2080,6 +2154,7 @@ libc_function(
libc_support_library (
name = "printf_core_structs" ,
hdrs = ["src/stdio/printf_core/core_structs.h" ],
defines = PRINTF_COPTS ,
deps = [
":__support_cpp_string_view" ,
":__support_fputil_fp_bits" ,
Expand All
@@ -2090,6 +2165,7 @@ libc_support_library(
libc_support_library (
name = "printf_config" ,
hdrs = ["src/stdio/printf_core/printf_config.h" ],
defines = PRINTF_COPTS ,
deps = [
":libc_root" ,
],
Expand All
@@ -2099,6 +2175,7 @@ libc_support_library(
name = "printf_parser" ,
srcs = ["src/stdio/printf_core/parser.cpp" ],
hdrs = ["src/stdio/printf_core/parser.h" ],
defines = PRINTF_COPTS ,
deps = [
":__support_arg_list" ,
":__support_common" ,
Expand All
@@ -2120,7 +2197,7 @@ libc_support_library(
name = "printf_mock_parser" ,
srcs = ["src/stdio/printf_core/parser.cpp" ],
hdrs = ["src/stdio/printf_core/parser.h" ],
copts = [ "-DLIBC_COPT_MOCK_ARG_LIST " ],
defines = PRINTF_COPTS + [ "LIBC_COPT_MOCK_ARG_LIST " ],
deps = [
":__support_arg_list" ,
":__support_common" ,
Expand All
@@ -2141,6 +2218,7 @@ libc_support_library(
name = "printf_string_writer" ,
srcs = ["src/stdio/printf_core/string_writer.cpp" ],
hdrs = ["src/stdio/printf_core/string_writer.h" ],
defines = PRINTF_COPTS ,
deps = [
":__support_cpp_string_view" ,
":libc_root" ,
Expand All
@@ -2149,10 +2227,23 @@ libc_support_library(
],
)
libc_support_library (
name = "printf_file_writer" ,
hdrs = ["src/stdio/printf_core/file_writer.h" ],
defines = PRINTF_COPTS ,
deps = [
":__support_cpp_string_view" ,
":__support_file_file" ,
":libc_root" ,
":printf_core_structs" ,
],
)
libc_support_library (
name = "printf_writer" ,
srcs = ["src/stdio/printf_core/writer.cpp" ],
hdrs = ["src/stdio/printf_core/writer.h" ],
defines = PRINTF_COPTS ,
deps = [
":__support_cpp_string_view" ,
":libc_root" ,
Expand All
@@ -2175,6 +2266,7 @@ libc_support_library(
"src/stdio/printf_core/string_converter.h" ,
"src/stdio/printf_core/write_int_converter.h" ,
],
defines = PRINTF_COPTS ,
deps = [
":__support_common" ,
":__support_cpp_limits" ,
Expand All
@@ -2197,6 +2289,7 @@ libc_support_library(
name = "printf_main" ,
srcs = ["src/stdio/printf_core/printf_main.cpp" ],
hdrs = ["src/stdio/printf_core/printf_main.h" ],
defines = PRINTF_COPTS ,
deps = [
":__support_arg_list" ,
":libc_root" ,
Expand All
@@ -2211,6 +2304,7 @@ libc_function(
name = "sprintf" ,
srcs = ["src/stdio/sprintf.cpp" ],
hdrs = ["src/stdio/sprintf.h" ],
defines = PRINTF_COPTS ,
deps = [
":__support_arg_list" ,
":errno" ,
Expand All
@@ -2224,6 +2318,7 @@ libc_function(
name = "snprintf" ,
srcs = ["src/stdio/snprintf.cpp" ],
hdrs = ["src/stdio/snprintf.h" ],
defines = PRINTF_COPTS ,
deps = [
":__support_arg_list" ,
":errno" ,
Expand All
@@ -2232,3 +2327,41 @@ libc_function(
":printf_writer" ,
],
)
libc_support_library (
name = "vfprintf_internal" ,
hdrs = ["src/stdio/printf_core/vfprintf_internal.h" ],
defines = PRINTF_COPTS ,
deps = [
":__support_arg_list" ,
":__support_file_file" ,
":__support_macros_attributes" ,
":printf_file_writer" ,
":printf_main" ,
":printf_writer" ,
],
)
libc_function (
name = "printf" ,
srcs = ["src/stdio/printf.cpp" ],
hdrs = ["src/stdio/printf.h" ],
defines = PRINTF_COPTS ,
deps = [
":__support_arg_list" ,
":errno" ,
":vfprintf_internal" ,
],
)
libc_function (
name = "fprintf" ,
srcs = ["src/stdio/fprintf.cpp" ],
hdrs = ["src/stdio/fprintf.h" ],
defines = PRINTF_COPTS ,
deps = [
":__support_arg_list" ,
":errno" ,
":vfprintf_internal" ,
],
)