[dpdk-dev] [PATCH v4 1/7] net/ark: PMD for Atomic Rules Arkville driver stub

Ferruh Yigit ferruh.yigit at intel.com
Wed Mar 29 11:42:28 CEST 2017


On 3/28/2017 10:11 PM, Ed Czeck wrote:

> On Tue, Mar 28, 2017 at 8:58 AM, Ferruh Yigit <ferruh.yigit at intel.com
> <mailto:ferruh.yigit at intel.com>> wrote:
> 
>     On 3/23/2017 7:46 PM, Ed Czeck wrote:
> 
>     >> > +#define ARK_TRACE_ON(fmt, ...) \
>     >> > +     PMD_DRV_LOG(ERR, fmt, ##__VA_ARGS__)
>     >> > +
>     >> > +#define ARK_TRACE_OFF(fmt, ...) \
>     >> > +     do {if (0) PMD_DRV_LOG(ERR, fmt, ##__VA_ARGS__); } while (0)
>     >> why not just "do { } while(0)" ?
>     >
>     > A do while body always executes at least once.  The if (0) is required.
> 
>     Are you sure about this?
> 
>     I believe "do { } while(0)" also removed completely during compile.
> 
> I verified that the if (0) is required.

I have seen a comment added in next version:

/* This pattern allows compiler check arguments even if disabled  */

This clarifies the usage, and if(0), thanks.


More information about the dev mailing list