Re: [RFC PATCH 15/15] checkpatch: allow list_for_each helper macros

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

 



On Fri, 2013-10-25 at 03:52 +0000, Paul Zimmerman wrote:
> > From: Dan Williams
> > Sent: Thursday, October 24, 2013 12:45 AM
> > 
> > On Thu, Oct 24, 2013 at 12:36 AM, Dan Williams <dan.j.williams@xxxxxxxxx> wrote:
> > > Permit list_for_each redifinitions like:
> > >
> > > #define for_each_connector_peer(peer, port, c) \
> > >        list_for_each_entry(peer, &(c)->ports, node) \
> > >                if (port != peer)
> > >
> > > ...which triggers:
> > > ERROR: Macros with complex values should be enclosed in parenthesis
> 
> Kind of off-topic, but that macro looks a little dangerous. From what I have
> seen in the kernel, it's usually done something like this:
> 
> #define for_each_connector_peer(peer, port, c) \
> 	list_for_each_entry(peer, &(c)->ports, node) \
> 		if (port == peer) {} else

That seems pretty non-standard.
Look at include/linux/list.h or
$ git grep -E "\{\s*\}\s*else"

Is there any effective difference?


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux