* [PATCH] selftests/timers: Guard LONG_MAX / LONG_MIN defines
@ 2024-06-04 23:12 Edward Liaw
2024-06-05 6:27 ` Nathan Chancellor
0 siblings, 1 reply; 2+ messages in thread
From: Edward Liaw @ 2024-06-04 23:12 UTC (permalink / raw)
To: shuah, Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
John Stultz, Stephen Boyd, Nathan Chancellor, Nick Desaulniers,
Bill Wendling, Justin Stitt
Cc: linux-kernel, linux-kselftest, kernel-team, Edward Liaw, llvm
Add ifndef guards around LONG_MAX / LONG_MIN defines. When building with
Android bionic, these macros are redefined because bionic's time.h will
include linux/time.h, which includes limit.h.
INFO: From Compiling common/tools/testing/selftests/timers/valid-adjtimex.c:
common/tools/testing/selftests/timers/valid-adjtimex.c:107:9: warning: 'LONG_MAX' macro redefined [-Wmacro-redefined]
107 | #define LONG_MAX (~0UL>>1)
| ^
prebuilts/clang/host/linux-x86/clang-r522817/lib/clang/18/include/limits.h:47:9: note: previous definition is here
47 | #define LONG_MAX __LONG_MAX__
| ^
common/tools/testing/selftests/timers/valid-adjtimex.c:108:9: warning: 'LONG_MIN' macro redefined [-Wmacro-redefined]
108 | #define LONG_MIN (-LONG_MAX - 1)
| ^
prebuilts/clang/host/linux-x86/clang-r522817/lib/clang/18/include/limits.h:52:9: note: previous definition is here
52 | #define LONG_MIN (-__LONG_MAX__ -1L)
| ^
Signed-off-by: Edward Liaw <edliaw@google.com>
---
tools/testing/selftests/timers/valid-adjtimex.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/testing/selftests/timers/valid-adjtimex.c b/tools/testing/selftests/timers/valid-adjtimex.c
index d500884801d8..3d9f1baff86e 100644
--- a/tools/testing/selftests/timers/valid-adjtimex.c
+++ b/tools/testing/selftests/timers/valid-adjtimex.c
@@ -102,8 +102,12 @@ long outofrange_freq[NUM_FREQ_OUTOFRANGE] = {
1000 * SHIFTED_PPM,
};
+#ifndef LONG_MAX
#define LONG_MAX (~0UL>>1)
+#endif
+#ifndef LONG_MIN
#define LONG_MIN (-LONG_MAX - 1)
+#endif
long invalid_freq[NUM_FREQ_INVALID] = {
LONG_MAX,
--
2.45.1.288.g0e0cd299f1-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] selftests/timers: Guard LONG_MAX / LONG_MIN defines
2024-06-04 23:12 [PATCH] selftests/timers: Guard LONG_MAX / LONG_MIN defines Edward Liaw
@ 2024-06-05 6:27 ` Nathan Chancellor
0 siblings, 0 replies; 2+ messages in thread
From: Nathan Chancellor @ 2024-06-05 6:27 UTC (permalink / raw)
To: Edward Liaw
Cc: shuah, Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
John Stultz, Stephen Boyd, Nick Desaulniers, Bill Wendling,
Justin Stitt, linux-kernel, linux-kselftest, kernel-team, llvm
On Tue, Jun 04, 2024 at 11:12:18PM +0000, Edward Liaw wrote:
> Add ifndef guards around LONG_MAX / LONG_MIN defines. When building with
> Android bionic, these macros are redefined because bionic's time.h will
> include linux/time.h, which includes limit.h.
>
> INFO: From Compiling common/tools/testing/selftests/timers/valid-adjtimex.c:
> common/tools/testing/selftests/timers/valid-adjtimex.c:107:9: warning: 'LONG_MAX' macro redefined [-Wmacro-redefined]
> 107 | #define LONG_MAX (~0UL>>1)
> | ^
> prebuilts/clang/host/linux-x86/clang-r522817/lib/clang/18/include/limits.h:47:9: note: previous definition is here
> 47 | #define LONG_MAX __LONG_MAX__
> | ^
> common/tools/testing/selftests/timers/valid-adjtimex.c:108:9: warning: 'LONG_MIN' macro redefined [-Wmacro-redefined]
> 108 | #define LONG_MIN (-LONG_MAX - 1)
> | ^
> prebuilts/clang/host/linux-x86/clang-r522817/lib/clang/18/include/limits.h:52:9: note: previous definition is here
> 52 | #define LONG_MIN (-__LONG_MAX__ -1L)
> | ^
>
> Signed-off-by: Edward Liaw <edliaw@google.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
> ---
> tools/testing/selftests/timers/valid-adjtimex.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/tools/testing/selftests/timers/valid-adjtimex.c b/tools/testing/selftests/timers/valid-adjtimex.c
> index d500884801d8..3d9f1baff86e 100644
> --- a/tools/testing/selftests/timers/valid-adjtimex.c
> +++ b/tools/testing/selftests/timers/valid-adjtimex.c
> @@ -102,8 +102,12 @@ long outofrange_freq[NUM_FREQ_OUTOFRANGE] = {
> 1000 * SHIFTED_PPM,
> };
>
> +#ifndef LONG_MAX
> #define LONG_MAX (~0UL>>1)
> +#endif
> +#ifndef LONG_MIN
> #define LONG_MIN (-LONG_MAX - 1)
> +#endif
>
> long invalid_freq[NUM_FREQ_INVALID] = {
> LONG_MAX,
> --
> 2.45.1.288.g0e0cd299f1-goog
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-06-05 6:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-04 23:12 [PATCH] selftests/timers: Guard LONG_MAX / LONG_MIN defines Edward Liaw
2024-06-05 6:27 ` Nathan Chancellor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).