[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130628171545.GA28672@redhat.com>
Date: Fri, 28 Jun 2013 19:15:45 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Stephen Rothwell <sfr@...b.auug.org.au>
Cc: Randy Dunlap <rdunlap@...radead.org>,
Andrew Morton <akpm@...ux-foundation.org>,
mm-commits@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, linux-fsdevel@...r.kernel.org,
linux-next@...r.kernel.org
Subject: Re: mmotm 2013-06-27-16-36 uploaded (wait event common)
On 06/28, Oleg Nesterov wrote:
>
> On 06/28, Stephen Rothwell wrote:
> >
> > On Thu, 27 Jun 2013 23:06:43 -0700 Randy Dunlap <rdunlap@...radead.org> wrote:
> > >
> > > >> My builds are littered with hundreds of warnings like this one:
> > > >>
> > > >> drivers/tty/tty_ioctl.c:220:6: warning: the omitted middle operand in ?: will always be 'true', suggest explicit middle operand [-Wparentheses]
> > > >>
> > > >> I guess due to this line from wait_event_common():
> > > >>
> > > >> + __ret = __wait_no_timeout(tout) ?: (tout) ?: 1;
> > > >>
> > I added the following to linux-next today:
> > (sorry Randy, I forgot the Reported-by:, Andrew please add)
> >
> > From: Stephen Rothwell <sfr@...b.auug.org.au>
> > Date: Fri, 28 Jun 2013 16:52:58 +1000
> > Subject: [PATCH] fix warnings from ?: operator in wait.h
>
> Argh. This patch strikes again.
>
> Thanks, and sorry. And please help!
>
> I am not sure I understand. Since when gcc dislikes '?:' ?
> /bin/grep shows a lot of users of 'X ?: Y' shortcut?
OK, I have found the machine with the newer gcc.
#define test_1(tout) (!tout ?: 1)
int func_1(long timeout)
{
return test_1(timeout);
}
#define test_2(tout) (tout ?: 1)
int func_2(long timeout)
{
return test_2(timeout);
}
test_1() triggers the same warning, test_2() doesn't. So it doesn't
like "computed-boolean ?: long".
> > Signed-off-by: Stephen Rothwell <sfr@...b.auug.org.au>
> > ---
> > include/linux/wait.h | 18 ++++++++++++++----
> > 1 file changed, 14 insertions(+), 4 deletions(-)
> >
> > diff --git a/include/linux/wait.h b/include/linux/wait.h
> > index 1c08a6c..f3b793d 100644
> > --- a/include/linux/wait.h
> > +++ b/include/linux/wait.h
> > @@ -197,7 +197,12 @@ wait_queue_head_t *bit_waitqueue(void *, int);
> > for (;;) { \
> > __ret = prepare_to_wait_event(&wq, &__wait, state); \
> > if (condition) { \
> > - __ret = __wait_no_timeout(tout) ?: __tout ?: 1; \
> > + __ret = __wait_no_timeout(tout); \
> > + if (!__ret) { \
> > + __ret = __tout; \
> > + if (!__ret) \
> > + __ret = 1; \
> > + } \
> > break; \
> > } \
> > \
> > @@ -218,9 +223,14 @@ wait_queue_head_t *bit_waitqueue(void *, int);
> > #define wait_event_common(wq, condition, state, tout) \
> > ({ \
> > long __ret; \
> > - if (condition) \
> > - __ret = __wait_no_timeout(tout) ?: (tout) ?: 1; \
> > - else \
> > + if (condition) { \
> > + __ret = __wait_no_timeout(tout); \
> > + if (!__ret) { \
> > + __ret = (tout); \
> > + if (!__ret) \
> > + __ret = 1; \
> > + } \
> > + } else \
> > __ret = __wait_event_common(wq, condition, state, tout);\
> > __ret; \
> > })
Thanks. This should fix the isssue.
I'll try to send the cleanup patch later, this doesn't look very nice...
Oleg.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists