From d83271b093ec206c2f47a9c636a5727cf63cad5e Mon Sep 17 00:00:00 2001 From: Caslyn Tonelli <6718161+Caslyn@users.noreply.github.com> Date: Mon, 1 Apr 2024 09:51:38 -0700 Subject: [libc] Include algorithm.h to parser.h (#87125) This includes algorithm.h directly to provide the definition for `cpp:max` in parser.h. This will define `max(...)` in the libc namespace for build systems that pull in parser.h explicitly. --- libc/src/stdio/printf_core/CMakeLists.txt | 1 + libc/src/stdio/printf_core/parser.h | 1 + utils/bazel/llvm-project-overlay/libc/BUILD.bazel | 1 + 3 files changed, 3 insertions(+) diff --git a/libc/src/stdio/printf_core/CMakeLists.txt b/libc/src/stdio/printf_core/CMakeLists.txt index 02819ea..7db79c5 100644 --- a/libc/src/stdio/printf_core/CMakeLists.txt +++ b/libc/src/stdio/printf_core/CMakeLists.txt @@ -42,6 +42,7 @@ add_header_library( libc.src.__support.arg_list libc.src.__support.ctype_utils libc.src.__support.str_to_integer + libc.src.__support.CPP.algorithm libc.src.__support.CPP.bit libc.src.__support.CPP.optional libc.src.__support.CPP.string_view diff --git a/libc/src/stdio/printf_core/parser.h b/libc/src/stdio/printf_core/parser.h index 8e8c77e..eda978a 100644 --- a/libc/src/stdio/printf_core/parser.h +++ b/libc/src/stdio/printf_core/parser.h @@ -10,6 +10,7 @@ #define LLVM_LIBC_SRC_STDIO_PRINTF_CORE_PARSER_H #include "include/llvm-libc-macros/stdfix-macros.h" +#include "src/__support/CPP/algorithm.h" // max #include "src/__support/CPP/optional.h" #include "src/__support/CPP/type_traits.h" #include "src/__support/str_to_integer.h" diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel index 9169f33..9dfe4c4 100644 --- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel @@ -3041,6 +3041,7 @@ libc_support_library( deps = [ ":__support_arg_list", ":__support_common", + ":__support_cpp_algorithm", ":__support_cpp_bit", ":__support_cpp_optional", ":__support_cpp_string_view", -- cgit v1.1