-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[clang] Extend clang's <limits.h> to define *LONG_LONG*_ macros for bionic #115406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-backend-x86 @llvm/pr-subscribers-clang Author: None (ZijunZhaoCCK) ChangesLONG_LONG_ macros are not GNU-only extensions any more. Bionic also defines them. Full diff: https://github.com/llvm/llvm-project/pull/115406.diff 1 Files Affected:
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
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM for Android; tagging @AaronBallman as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Release note and test coverage?
I tested it locally. I copied code to |
Yes, we've got tests for Clang-supplied headers in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM aside from some minor changes to the release note.
LONG_LONG_ macros are not GNU-only extensions any more. Bionic also defines them.