From: Jean-Baptiste Theou <jtheou@adeneo-embedded.us>
To: Joe Perches <joe@perches.com>
Cc: <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] checkpatch.pl: Fix wrong curly bracket position reporting
Date: Wed, 18 Dec 2013 09:43:08 -0800 [thread overview]
Message-ID: <52B1DEAC.40901@adeneo-embedded.us> (raw)
In-Reply-To: <1387345186.13593.7.camel@joe-AO722>
Hi Joe,
Looks good to me, it fix this issue and for sure more global.
Regards,
Jean-Baptiste
On 12/17/2013 09:39 PM, Joe Perches wrote:
> On Tue, 2013-12-17 at 18:59 -0800, Jean-Baptiste Theou wrote:
>> This patch fixes wrong curly bracket position reporting when function
>> declarations have only one void argument.
>>
>> Missing error (ERROR: space required before the open brace '{') on this
>> situation :
>>
>> int foo(void){
>> ...
>> }
> That's true for any declaration with { on the same line.
>
> Perhaps this would be better:
> ---
> scripts/checkpatch.pl | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 8f3aecd..c4dbb8a 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2784,7 +2784,8 @@ sub process {
>
> # function brace can't be on same line, except for #defines of do while,
> # or if closed on same line
> - if (($line=~/$Type\s*$Ident\(.*\).*\s{/) and
> + if ($^V && $^V ge 5.10.0 &&
> + ($line=~/$Type\s*$Ident\s*$balanced_parens\s*{\s*$/) &&
> !($line=~/\#\s*define.*do\s{/) and !($line=~/}/)) {
> ERROR("OPEN_BRACE",
> "open brace '{' following function declarations go on the next line\n" . $herecurr);
> @@ -3159,7 +3160,9 @@ sub process {
> ## }
>
> #need space before brace following if, while, etc
> - if (($line =~ /\(.*\){/ && $line !~ /\($Type\){/) ||
> + if ($^V && $^V ge 5.10.0 &&
> + ($line !~ /$Type\s*$Ident\s*$balanced_parens\s*{\s*$/) &&
> + ($line =~ /\(.*\){/ && $line !~ /\($Type\){/) ||
> $line =~ /do{/) {
> if (ERROR("SPACING",
> "space required before the open brace '{'\n" . $herecurr) &&
>
>
next prev parent reply other threads:[~2013-12-18 17:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-18 2:59 [PATCH] checkpatch.pl: Fix wrong curly bracket position reporting Jean-Baptiste Theou
2013-12-18 5:39 ` Joe Perches
2013-12-18 17:43 ` Jean-Baptiste Theou [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-12-18 2:56 Jean-Baptiste Theou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52B1DEAC.40901@adeneo-embedded.us \
--to=jtheou@adeneo-embedded.us \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox