mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Michael Karcher <kernel@mkarcher.dialup.fu-berlin.de>,
	Randy Dunlap <rdunlap@infradead.org>,
	linux-kernel@vger.kernel.org, linux-sh@vger.kernel.org,
	Segher Boessenkool <segher@kernel.crashing.org>,
	Rich Felker <dalias@libc.org>,
	Yoshinori Sato <ysato@users.osdn.me>,
	John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>,
	jakub@gcc.gnu.org
Subject: Re: [PATCH: 1/1] sh4: avoid spurious gcc warning
Date: Mon, 23 Jan 2023 15:49:38 +0100	[thread overview]
Message-ID: <CAMuHMdXQ3MxtJycmTxomz_iJnYj6-2Mf8t7jUzoY490O2DhQfQ@mail.gmail.com> (raw)
In-Reply-To: <Y80vRJfPJ4mIO8Cm@tucnak>

Hi Jakub,

On Sun, Jan 22, 2023 at 1:47 PM Jakub Jelinek <jakub@redhat.com> wrote:
> On Sun, Jan 22, 2023 at 12:33:41PM +0100, Michael Karcher wrote:
> > Am 22.01.2023 um 08:00 schrieb Randy Dunlap:
> > > > -#define _INTC_ARRAY(a) a, __same_type(a, NULL) ? 0 : sizeof(a)/sizeof(*a)
> > > > +#define _INTC_ARRAY(a) a, sizeof(a)/(_Generic((a), typeof(NULL): 0xFFFFFFFFU, default: sizeof(*a)))
> > > s/: / : / in 2 places.
> > >
> > > Tested-by: Randy Dunlap <rdunlap@infradead.org> # build-tested
> >
> > Thanks for your confirmation! Are you sure about the space before the colon?
>
> No, it should be without those, see various other _Generic uses in
> include/linux/
> All those are formatted on one line for each case, so for the above macro it
> would be
> #define _INTC_ARRAY(a) (a), sizeof(a)/(_Generic((a),                    \
>                                        typeof(NULL):    -1,             \
>                                        default:         sizeof(*(a)))
> or so.
> Anyway, two comments:
> 1) I'd use -1 as that would be after promotion to size_t the largest size_t
>    unlike 0xFFFFFFFFU; of course, as for the void * case a can't be an array,
>    any value > sizeof(void*) will do

Or SIZE_MAX.

include/linux/limits.h:#define SIZE_MAX (~(size_t)0)

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  parent reply	other threads:[~2023-01-23 14:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-22  0:15 Michael.Karcher
2023-01-22  7:00 ` Randy Dunlap
2023-01-22 11:33   ` Michael Karcher
2023-01-22 12:42     ` Jakub Jelinek
2023-01-22 16:02       ` Randy Dunlap
2023-01-23 14:49       ` Geert Uytterhoeven [this message]
2023-01-22 12:35 ` John Paul Adrian Glaubitz
     [not found] ` <c411961861df4ae4b011317ff2c3c7df@AcuMS.aculab.com>
2023-01-23 16:11   ` Jakub Jelinek
2023-01-23 18:00     ` Michael Karcher

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=CAMuHMdXQ3MxtJycmTxomz_iJnYj6-2Mf8t7jUzoY490O2DhQfQ@mail.gmail.com \
    --to=geert@linux-m68k.org \
    --cc=dalias@libc.org \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=jakub@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=kernel@mkarcher.dialup.fu-berlin.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=segher@kernel.crashing.org \
    --cc=ysato@users.osdn.me \
    /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

all inboxes | Powered by JetHome®