Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1732028 > unrolled thread
| Started by | Miles Chen <miles.chen@mediatek.com> |
|---|---|
| First post | 2017-09-14 05:10 +0200 |
| Last post | 2017-09-14 12:10 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] checkpatch: support function pointers for unnamed function definition arguments Miles Chen <miles.chen@mediatek.com> - 2017-09-14 05:10 +0200
Re: [PATCH] checkpatch: support function pointers for unnamed function definition arguments Joe Perches <joe@perches.com> - 2017-09-14 07:40 +0200
Re: [PATCH] checkpatch: support function pointers for unnamed function definition arguments Miles Chen <miles.chen@mediatek.com> - 2017-09-14 12:10 +0200
| From | Miles Chen <miles.chen@mediatek.com> |
|---|---|
| Date | 2017-09-14 05:10 +0200 |
| Subject | [PATCH] checkpatch: support function pointers for unnamed function definition arguments |
| Message-ID | <upsHo-7ND-11@gated-at.bofh.it> |
Current unnamed function definition argument does not include function
pointer cases and it reports warnings like:
WARNING: function definition argument 'void' should also have an identifier name
+unsigned int (*dummy)(void);
Support function pointers for unnamed function arguments.
Signed-off-by: Miles Chen <miles.chen@mediatek.com>
---
scripts/checkpatch.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index dd2c262..dc6da15 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5957,7 +5957,7 @@ sub process {
# check for function declarations that have arguments without identifier names
if (defined $stat &&
- $stat =~ /^.\s*(?:extern\s+)?$Type\s*$Ident\s*\(\s*([^{]+)\s*\)\s*;/s &&
+ $stat =~ /^.\s*(?:extern\s+)?$Type\s*\(?\s*\*?\s*$Ident\s*\)\s*\(\s*([^{]+)\s*\)\s*;/s &&
$1 ne "void") {
my $args = trim($1);
while ($args =~ m/\s*($Type\s*(?:$Ident|\(\s*\*\s*$Ident?\s*\)\s*$balanced_parens)?)/g) {
--
1.9.1
[toc] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2017-09-14 07:40 +0200 |
| Subject | Re: [PATCH] checkpatch: support function pointers for unnamed function definition arguments |
| Message-ID | <upv2y-UJ-1@gated-at.bofh.it> |
| In reply to | #1732028 |
On Thu, 2017-09-14 at 11:01 +0800, Miles Chen wrote:
> Current unnamed function definition argument does not include function
> pointer cases and it reports warnings like:
>
> WARNING: function definition argument 'void' should also have an identifier name
>
> Support function pointers for unnamed function arguments.
>
> Signed-off-by: Miles Chen <miles.chen@mediatek.com>
> ---
> scripts/checkpatch.pl | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index dd2c262..dc6da15 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -5957,7 +5957,7 @@ sub process {
>
> # check for function declarations that have arguments without identifier names
> if (defined $stat &&
> - $stat =~ /^.\s*(?:extern\s+)?$Type\s*$Ident\s*\(\s*([^{]+)\s*\)\s*;/s &&
> + $stat =~ /^.\s*(?:extern\s+)?$Type\s*\(?\s*\*?\s*$Ident\s*\)\s*\(\s*([^{]+)\s*\)\s*;/s &&
Better would be to specifically support function pointers like:
---
scripts/checkpatch.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 05dd72693621..7289c1eb0b19 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5957,7 +5957,7 @@ sub process {
# check for function declarations that have arguments without identifier names
if (defined $stat &&
- $stat =~ /^.\s*(?:extern\s+)?$Type\s*$Ident\s*\(\s*([^{]+)\s*\)\s*;/s &&
+ $stat =~ /^.\s*(?:extern\s+)?$Type\s*(?:$Ident|\(\s*\*\s*$Ident\s*\))\s*\(\s*([^{]+)\s*\)\s*;/s &&
$1 ne "void") {
my $args = trim($1);
while ($args =~ m/\s*($Type\s*(?:$Ident|\(\s*\*\s*$Ident?\s*\)\s*$balanced_parens)?)/g) {
[toc] | [prev] | [next] | [standalone]
| From | Miles Chen <miles.chen@mediatek.com> |
|---|---|
| Date | 2017-09-14 12:10 +0200 |
| Subject | Re: [PATCH] checkpatch: support function pointers for unnamed function definition arguments |
| Message-ID | <upzfQ-3Eb-9@gated-at.bofh.it> |
| In reply to | #1732048 |
On Wed, 2017-09-13 at 22:33 -0700, Joe Perches wrote:
> On Thu, 2017-09-14 at 11:01 +0800, Miles Chen wrote:
> > Current unnamed function definition argument does not include function
> > pointer cases and it reports warnings like:
> >
> > WARNING: function definition argument 'void' should also have an identifier name
>
> >
> > Support function pointers for unnamed function arguments.
> >
> > Signed-off-by: Miles Chen <miles.chen@mediatek.com>
> > ---
> > scripts/checkpatch.pl | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > index dd2c262..dc6da15 100755
> > --- a/scripts/checkpatch.pl
> > +++ b/scripts/checkpatch.pl
> > @@ -5957,7 +5957,7 @@ sub process {
> >
> > # check for function declarations that have arguments without identifier names
> > if (defined $stat &&
> > - $stat =~ /^.\s*(?:extern\s+)?$Type\s*$Ident\s*\(\s*([^{]+)\s*\)\s*;/s &&
> > + $stat =~ /^.\s*(?:extern\s+)?$Type\s*\(?\s*\*?\s*$Ident\s*\)\s*\(\s*([^{]+)\s*\)\s*;/s &&
>
> Better would be to specifically support function pointers like:
> ---
> scripts/checkpatch.pl | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 05dd72693621..7289c1eb0b19 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -5957,7 +5957,7 @@ sub process {
>
> # check for function declarations that have arguments without identifier names
> if (defined $stat &&
> - $stat =~ /^.\s*(?:extern\s+)?$Type\s*$Ident\s*\(\s*([^{]+)\s*\)\s*;/s &&
> + $stat =~ /^.\s*(?:extern\s+)?$Type\s*(?:$Ident|\(\s*\*\s*$Ident\s*\))\s*\(\s*([^{]+)\s*\)\s*;/s &&
Hi Joe,
thanks for the advise, it looks better.
I'll verify this patch and submit it again
Miles
> $1 ne "void") {
> my $args = trim($1);
> while ($args =~ m/\s*($Type\s*(?:$Ident|\(\s*\*\s*$Ident?\s*\)\s*$balanced_parens)?)/g) {
>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web