From: Nathan Chancellor <nathan@kernel.org>
To: Edward Liaw <edliaw@google.com>
Cc: shuah@kernel.org, Anna-Maria Behnsen <anna-maria@linutronix.de>,
Frederic Weisbecker <frederic@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
John Stultz <jstultz@google.com>, Stephen Boyd <sboyd@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
kernel-team@android.com, llvm@lists.linux.dev
Subject: Re: [PATCH] selftests/timers: Guard LONG_MAX / LONG_MIN defines
Date: Tue, 4 Jun 2024 23:27:11 -0700 [thread overview]
Message-ID: <20240605062711.GG279426@thelio-3990X> (raw)
In-Reply-To: <20240604231219.444603-1-edliaw@google.com>
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
>
prev parent reply other threads:[~2024-06-05 6:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-04 23:12 [PATCH] selftests/timers: Guard LONG_MAX / LONG_MIN defines Edward Liaw
2024-06-05 6:27 ` Nathan Chancellor [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240605062711.GG279426@thelio-3990X \
--to=nathan@kernel.org \
--cc=anna-maria@linutronix.de \
--cc=edliaw@google.com \
--cc=frederic@kernel.org \
--cc=jstultz@google.com \
--cc=justinstitt@google.com \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=morbo@google.com \
--cc=ndesaulniers@google.com \
--cc=sboyd@kernel.org \
--cc=shuah@kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox