[dpdk-dev] [PATCH v2 01/17] ixgbe: use the right debug macro

Jay Rolette rolette at infiniteio.com
Tue Sep 2 19:57:05 CEST 2014


On Tue, Sep 2, 2014 at 9:21 AM, Thomas Monjalon <thomas.monjalon at 6wind.com>
wrote:

> >> -#define        FUNC_PTR_OR_ERR_RET(func, retval) do {             \
> > >> -       if ((func) == NULL) {                              \
> > >> -               DEBUGOUT("%s:%d function not supported\n", \
> > >> -                       __func__, __LINE__);               \
> > >> -               return (retval);                           \
> > >> -       }                                                  \
> > >> +#define        FUNC_PTR_OR_ERR_RET(func, retval) do {              \
> > >> +       if ((func) == NULL) {                               \
> > >> +               PMD_DRV_LOG("%s:%d function not supported", \
> > >> +                           __func__, __LINE__);            \
> > >> +               return retval;                            \
> > >>
> > > Need to keep the parens around retval in your macro
> >
> > Actually, checkpatch complained about this.
> > So I can keep the parenthesis, but then I don't want Thomas to tell me my
> > patch does not pass checkpatch :-)
>
> You're right, I care about checkpatch :)
> I don't see a case where parens are needed with return. Please give an
> example.


Looking at it again, in this specific case you are correct. It is good
hygiene to always use parens around macro arguments, but this specific case
is ok without. It does add a small bit of danger if retval ends up getting
used elsewhere in the macro, but that's about it. Probably not worth
redoing the patch over that.

Jay


More information about the dev mailing list