[libc-commits] [PATCH] D158040: [libc] limits.h: include compiler limits if not already included
Alfred Persson Forsberg via Phabricator via libc-commits
libc-commits at lists.llvm.org
Tue Aug 15 16:46:12 PDT 2023
alfredfo created this revision.
alfredfo added reviewers: michaelrj, thesamesam.
Herald added projects: libc-project, All.
Herald added a subscriber: libc-commits.
alfredfo requested review of this revision.
The LLVM-libc build itself will override include paths and prefer it's
own limits.h over the compiler's limits.h. Because we rely on the
compiler limits.h for numerical limits in LLVM-libc it needs to be
include_next:ed if not already included. The other method to work
around this is to define all numeric macros in place.
Signed-off-by: Alfred Persson Forsberg <cat at catcream.org>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D158040
Files:
libc/include/llvm-libc-macros/limits-macros.h
Index: libc/include/llvm-libc-macros/limits-macros.h
===================================================================
--- libc/include/llvm-libc-macros/limits-macros.h
+++ libc/include/llvm-libc-macros/limits-macros.h
@@ -2,6 +2,10 @@
#define __LLVM_LIBC_MACROS_LIMITS_MACROS_H
#ifdef __linux__
+#if !defined _GCC_LIMITS_H_ && !defined __CLANG_LIMITS_H && \
+ __has_include_next(<limits.h>)
+#include_next <limits.h>
+#fi
#include <linux/limits.h>
#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158040.550546.patch
Type: text/x-patch
Size: 488 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230815/0fabb0c6/attachment.bin>
More information about the libc-commits
mailing list