[libc-commits] [libc] [libc] Include algorithm.h to parser.h (PR #87125)

Caslyn Tonelli via libc-commits libc-commits at lists.llvm.org
Fri Mar 29 16:22:16 PDT 2024


https://github.com/Caslyn created https://github.com/llvm/llvm-project/pull/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.

>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] [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"



More information about the libc-commits mailing list