Re: [PATCH 2.6.20-rc1] ib_verbs: Use explicit if-else statements to avoid errors with do-while macros

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 14, 2006 at 06:44:30AM +0000, Al Viro wrote:
> On Wed, Dec 13, 2006 at 10:10:05PM -0500, Ben Collins wrote:
> > At least on PPC, the "op ? op : dma" construct causes a compile failure
> > because the dma_* is a do{}while(0) macro.
> > 
> > This turns all of them into proper if/else to avoid this problem.
> 
> NAK.
> 
> Proper fix is to kill stupid do { } while (0) mess.  It's supposed
> to behave like a function returning void, so it should be ((void)0).

BTW, even though the original patch is already merged, I think that
we ought to get rid of do-while in such stubs, exactly to avoid such
problems in the future.  Probably even add to CodingStyle - it's not
the first time such crap happens.

IOW, do ; while(0) / do { } while (0)  is not a proper way to do a macro
that imitates a function returning void.

Objections?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux