[clang] [clang] Extend clang's <limits.h> to define *LONG_LONG*_ macros for bionic (PR #115406)

via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 11 09:54:31 PST 2024


https://github.com/ZijunZhaoCCK updated https://github.com/llvm/llvm-project/pull/115406

>From eda669f73765a957cc47d3d684a6443ed2f75edf Mon Sep 17 00:00:00 2001
From: Zijun <zijunzhao at google.com>
Date: Fri, 8 Nov 2024 01:04:21 +0000
Subject: [PATCH] Extend clang's <limits.h> to define *LONG_LONG*_ macros for
 bionic

---
 clang/lib/Headers/limits.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/clang/lib/Headers/limits.h b/clang/lib/Headers/limits.h
index 56dffe568486cc..9879fe81faa651 100644
--- a/clang/lib/Headers/limits.h
+++ b/clang/lib/Headers/limits.h
@@ -111,11 +111,12 @@
 #define ULLONG_MAX (__LONG_LONG_MAX__*2ULL+1ULL)
 #endif
 
-/* LONG_LONG_MIN/LONG_LONG_MAX/ULONG_LONG_MAX are a GNU extension.  It's too bad
-   that we don't have something like #pragma poison that could be used to
-   deprecate a macro - the code should just use LLONG_MAX and friends.
+/* LONG_LONG_MIN/LONG_LONG_MAX/ULONG_LONG_MAX are a GNU extension. Bionic also
+   defines them. It's too bad that we don't have something like #pragma poison
+   that could be used to deprecate a macro - the code should just use LLONG_MAX
+   and friends.
  */
-#if defined(__GNU_LIBRARY__) ? defined(__USE_GNU) : !defined(__STRICT_ANSI__)
+#if (defined(__GNU_LIBRARY__) ? defined(__USE_GNU) : !defined(__STRICT_ANSI__)) || defined(__BIONIC__)
 
 #undef   LONG_LONG_MIN
 #undef   LONG_LONG_MAX



More information about the cfe-commits mailing list