Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Jul 2013 16:33:13 +0200
From:      Svatopluk Kraus <onwahe@gmail.com>
To:        Sergey Kandaurov <pluknet@gmail.com>
Cc:        freebsd-current@freebsd.org
Subject:   Re: too many warnigns for variable 'cons_next_next'
Message-ID:  <CAFHCsPVvXRL-bPaWMbXcVTe9gfS96NmMb4Wooj6K85JDQy0pHg@mail.gmail.com>
In-Reply-To: <CAE-mSOLRK_aSNoY%2BUFLZVADxz0m_ynKJB=JX42CLbNf5E5L2Pg@mail.gmail.com>
References:  <CAFHCsPUGfK4RiwYWb75qLCkDhzBjN45w182WS1HrYUiYHAKMbg@mail.gmail.com> <CAE-mSOLRK_aSNoY%2BUFLZVADxz0m_ynKJB=JX42CLbNf5E5L2Pg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jul 1, 2013 at 3:40 PM, Sergey Kandaurov <pluknet@gmail.com> wrote:

>  On 1 July 2013 17:11, Svatopluk Kraus <onwahe@gmail.com> wrote:
> > Hi,
> >
> >   could somebody help me, please, with too many following warnings:
> > sys/buf_ring.h:189:33: warning: variable 'cons_next_next' set but not
> used
> >
> > As the warning is produced by header which is included a lot, the
> important
> > warnings are visible poorly among them. I think that
> buf_ring_dequeue_sc()
> > in sys/buf_ring.h could be change to suppress the warning this way:
> > static __inline void *
> > buf_ring_dequeue_sc(struct buf_ring *br)
> > {
> > -   uint32_t cons_head, cons_next, cons_next_next;
> > +   uint32_t cons_head, cons_next, cons_next_next __unused;
> >     uint32_t prod_tail;
> >     void *buf;
> >
> >     cons_head = br->br_cons_head;
> >     prod_tail = br->br_prod_tail;
> >
> > +   if (cons_head == prod_tail)
> > +       return (NULL);
> >
> >     cons_next = (cons_head + 1) & br->br_cons_mask;
> > -   cons_next_next = (cons_head + 2) & br->br_cons_mask;
> >
> > -   if (cons_head == prod_tail)
> > -       return (NULL);
> > #ifdef PREFETCH_DEFINED
> > +   cons_next_next = (cons_head + 2) & br->br_cons_mask;
> >     if (cons_next != prod_tail) {
> >         prefetch(br->br_ring[cons_next]);
> >         if (cons_next_next != prod_tail)
> >             prefetch(br->br_ring[cons_next_next]);
> >     }
> > #endif
> >
>
> Why not put its declaration under #ifdef as well? YMMV.
>
> --
> wbr,
> pluknet
>


It's possible too. But, why not to do some optimalization at the same time?

Svata



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFHCsPVvXRL-bPaWMbXcVTe9gfS96NmMb4Wooj6K85JDQy0pHg>