From mboxrd@z Thu Jan 1 00:00:00 1970 From: greg@kroah.com (Greg KH) Date: Fri, 13 Mar 2015 15:46:17 +0100 Subject: CHECK: Alignment should match open parenthesis In-Reply-To: References: <20150313124332.GA22044@opentech.at> <1158748566.6782126.1426252169494.JavaMail.yahoo@mail.yahoo.com> <20150313132802.GA13910@opentech.at> <20150313134707.GB13910@opentech.at> Message-ID: <20150313144617.GA19212@kroah.com> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org On Fri, Mar 13, 2015 at 04:35:30PM +0200, Daniel Baluta wrote: > On Fri, Mar 13, 2015 at 3:47 PM, Nicholas Mc Guire wrote: > > On Fri, 13 Mar 2015, Nicholas Mc Guire wrote: > > > >> On Fri, 13 Mar 2015, palik imre wrote: > >> > >> > On Friday, 13 March 2015, 13:43, Nicholas Mc Guire wrote: > >> > > On Fri, 13 Mar 2015, palik imre wrote: > >> > > > >> > > > >> > > > Sorry for the silly question, but I have some issues with this checkpatch.pl warning. > >> > > > > >> > > > I mean Documentation/CodingStyle says: > >> > > > > >> > > > Outside of comments, documentation and except in Kconfig, spaces are never > >> > > > used for indentation, and the above example is deliberately broken. > >> > > > > >> > > > But checkpatch.pl claims I should align to open parentheses. These two things seem to be contradictory to me. Could somebody clarify this? > >> > > > >> > > > > >> > > leading tabs *followed* by spaces to align parameters to a function are fine > >> > > >> > The emacs settings in Documentation/CodingStyle seem to contradict to you, > >> > as it is set up to use c-lineup-arglist-tabs-only > >> > > >> The problem is that CodingStyle does not explicitly address > >> parameter alignment for functions that do not fit on a single line > >> but checkpatch.pl does > >> > >> you can try it out - if you align to the opening braces with spaces > >> with preceding TABs it will not fuss and this is also common practice. > >> > > here is a quick shot at summarizing this > > > > > > If the parameter list to a functions would exceed the 80 char limit then break > > it at the separators, and align to opening braces, e.g.: > > > > ret = fw_load_from_user_helper(fw, name, device, > > opt_flags, timeout); > > > > or: > > > > int = > > wait_for_completion_interruptible_timeout(data->completion, > > PMI_TIMEOUT); > > > > Note that this is indented by tabs and then aligned with spaced to fit the > > opening braces. If you can not fit it even if you break the parameter list > > at the commas then indent by tabs only but *significantly* to the left of > > the opening braces, e.g.: > > > > int ret = wait_for_completion_interruptible_timeout( > > &info->done, usecs_to_jiffies(TIMEOUT_US)); > > > > > > would be suprised if there is no writeup somewhere alredy > > but I did not find this covered in Documentations anywhere. > > I think it would be a coding idea to have this in CodingStyle doc :). Really? Do you want to codify every tiny thing here? Just use common sense people, it's not that big of a deal... greg k-h