[libc] [llvm] [libc] Include algorithm.h to parser.h (PR #87125)
Caslyn Tonelli via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 31 13:05:50 PDT 2024
https://github.com/Caslyn updated https://github.com/llvm/llvm-project/pull/87125
>From 4efd8ff4860668d452a09616527987d2a86b9a52 Mon Sep 17 00:00:00 2001
From: Caslyn Tonelli <caslyn at google.com>
Date: Fri, 29 Mar 2024 15:43:10 -0700
Subject: [PATCH 1/2] [libc] Include algorithm.h to parser.h
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/parser.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/libc/src/stdio/printf_core/parser.h b/libc/src/stdio/printf_core/parser.h
index 8e8c77e219fa4d..eda978a83ea8af 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"
>From 9f55341f81fa45a4e3e1ce03c2288c22ddf3e086 Mon Sep 17 00:00:00 2001
From: Caslyn Tonelli <caslyn at google.com>
Date: Sun, 31 Mar 2024 13:03:30 -0700
Subject: [PATCH 2/2] Add algorithm.h to deps
---
libc/src/stdio/printf_core/CMakeLists.txt | 1 +
utils/bazel/llvm-project-overlay/libc/BUILD.bazel | 1 +
2 files changed, 2 insertions(+)
diff --git a/libc/src/stdio/printf_core/CMakeLists.txt b/libc/src/stdio/printf_core/CMakeLists.txt
index 02819ea25ea055..7db79c54beb0ae 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/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 9169f330baac3c..9dfe4c48184e3e 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",
More information about the llvm-commits
mailing list