mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Willy Tarreau <w@1wt.eu>
To: "Thomas Weißschuh" <thomas@t-8ch.de>
Cc: Vincent Dagonneau <v@vda.io>, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 4/4] tools/nolibc: add tests for the integer limits in stdint.h
Date: Sun, 19 Feb 2023 20:15:16 +0100	[thread overview]
Message-ID: <Y/J1RB1T4tFeBxgs@1wt.eu> (raw)
In-Reply-To: <c549eaa8-02c4-4ca5-9ad9-6b713e183609@t-8ch.de>

Hi Thomas,

On Sun, Feb 19, 2023 at 07:04:04PM +0000, Thomas Weißschuh wrote:
> > +#elif __SIZEOF_LONG__ == 4
> > +		CASE_TEST(limit_intptr_min);        EXPECT_EQ(1, INTPTR_MIN,  (intptr_t)  0x80000000); break;
> > +		CASE_TEST(limit_intptr_max);        EXPECT_EQ(1, INTPTR_MAX,  (intptr_t)  0x7fffffff); break;
> > +		CASE_TEST(limit_uintptr_max);       EXPECT_EQ(1, UINTPTR_MAX, (uintptr_t) 0xffffffffU); break;
> > +		CASE_TEST(limit_ptrdiff_min);       EXPECT_EQ(1, PTRDIFF_MIN, (ptrdiff_t) 0x80000000); break;
> > +		CASE_TEST(limit_ptrdiff_max);       EXPECT_EQ(1, PTRDIFF_MAX, (ptrdiff_t) 0x7fffffff); break;
> > +		CASE_TEST(limit_ptrdiff_min);       EXPECT_EQ(1, PTRDIFF_MIN, (ptrdiff_t) 0x80000000); break;
> > +		CASE_TEST(limit_ptrdiff_max);       EXPECT_EQ(1, PTRDIFF_MAX, (ptrdiff_t) 0x7fffffff); break;
> 
> ptrdiff tests are duplicate.

Argh, I thought I had already removed these duplicates, I noticed them
previously indeed. Vincent, please address this in your next iteration.

> > +		CASE_TEST(limit_size_max);          EXPECT_EQ(1, SIZE_MAX,    (size_t)    0xffffffffU); break;
> > +#else
> > +# warning "__SIZEOF_LONG__ is undefined"
> 
> Why not #error?

It's just a matter of choice. Since the tool's goal is to spot errors,
and if possible several at once, I find it preferable to still not fail
on other tests, as often when you get multiple failures it's easier to
figure what's going on. During the last test session I precisely had a
build error that was quite annoying because once I managed to fix it I
figured the fix was not the right one regarding other places.

Alternately we could probably just add one line that always reports a
failure like the other ones (it would be even better so that we can
compare all outputs and still know that something fails):

 +#else
 +		CASE_TEST(__SIZEOF_LONG__defined);  EXPECT_EQ(1, 1, 0); break;

> > +#endif /* __WORDSIZE == 64 */
> 
> #endif comment is now incorrect

Good catch indeed!
> 
> > +			case __LINE__:
> 
> The "case" should be further left, no?

You're right!

Thank you!
Willy

  reply	other threads:[~2023-02-19 19:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-19 18:51 [RFC PATCH 0/4] tools/nolibc: add stdint and more integer types Willy Tarreau
2023-02-19 18:51 ` [RFC PATCH 1/4] tools/nolibc: add stdint.h Willy Tarreau
2023-02-19 18:51 ` [RFC PATCH 2/4] tools/nolibc: add integer types and integer limit macros Willy Tarreau
2023-02-19 19:16   ` Thomas Weißschuh
2023-02-19 19:23     ` Willy Tarreau
2023-02-20  9:14   ` David Laight
2023-02-20 14:47     ` Willy Tarreau
2023-02-20 20:27       ` Vincent Dagonneau
2023-02-19 18:51 ` [RFC PATCH 3/4] tools/nolibc: enlarge column width of tests Willy Tarreau
2023-02-19 18:51 ` [RFC PATCH 4/4] tools/nolibc: add tests for the integer limits in stdint.h Willy Tarreau
2023-02-19 19:04   ` Thomas Weißschuh
2023-02-19 19:15     ` Willy Tarreau [this message]
2023-02-20 20:29       ` Vincent Dagonneau

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=Y/J1RB1T4tFeBxgs@1wt.eu \
    --to=w@1wt.eu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thomas@t-8ch.de \
    --cc=v@vda.io \
    /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

Powered by JetHome