diff mbox series

scripts/checkpatch.pl: process .c.inc and .h.inc files as C source

Message ID 20210520195142.941261-1-matheus.ferst@eldorado.org.br
State New
Headers show
Series scripts/checkpatch.pl: process .c.inc and .h.inc files as C source | expand

Commit Message

Matheus K. Ferst May 20, 2021, 7:51 p.m. UTC
From: Matheus Ferst <matheus.ferst@eldorado.org.br>

Change the regex used to determine whether a file should be processed as
C source to include .c.inc and .h.inc extensions.

Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br>
---
 scripts/checkpatch.pl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Bruno Larsen (billionai) May 20, 2021, 7:55 p.m. UTC | #1
On 20/05/2021 16:51, matheus.ferst@eldorado.org.br wrote:
> From: Matheus Ferst <matheus.ferst@eldorado.org.br>
>
> Change the regex used to determine whether a file should be processed as
> C source to include .c.inc and .h.inc extensions.
>
> Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br>
> ---
>   scripts/checkpatch.pl | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 3d185cceac..bbcd25ae05 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -12,7 +12,7 @@ use Term::ANSIColor qw(:constants);
>   my $P = $0;
>   $P =~ s@.*/@@g;
>   
> -our $SrcFile    = qr{\.(?:h|c|cpp|s|S|pl|py|sh)$};
> +our $SrcFile    = qr{\.(?:(h|c)(\.inc)?|cpp|s|S|pl|py|sh)$};
>   
>   my $V = '0.31';
>   
> @@ -1671,7 +1671,7 @@ sub process {
>   		}
>   
>   # check we are in a valid C source file if not then ignore this hunk
> -		next if ($realfile !~ /\.(h|c|cpp)$/);
> +		next if ($realfile !~ /\.((h|c)(\.inc)?|cpp)$/);
there's an extra ). shouldn't it be ((h|c(\.inc)?|cpp)$/)?
>   
>   # Block comment styles
>
Luis Fernando Fujita Pires May 21, 2021, 1:19 p.m. UTC | #2
From: Matheus Ferst <matheus.ferst@eldorado.org.br>
> 
> Change the regex used to determine whether a file should be processed as C
> source to include .c.inc and .h.inc extensions.
> 
> Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br>
> ---
>  scripts/checkpatch.pl | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Luis Pires <luis.pires@eldorado.org.br>
Matheus K. Ferst June 7, 2021, 12:18 p.m. UTC | #3
On 20/05/2021 16:51, matheus.ferst@eldorado.org.br wrote:
> From: Matheus Ferst <matheus.ferst@eldorado.org.br>
> 
> Change the regex used to determine whether a file should be processed as
> C source to include .c.inc and .h.inc extensions.
> 
> Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br>
> ---
>   scripts/checkpatch.pl | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 3d185cceac..bbcd25ae05 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -12,7 +12,7 @@ use Term::ANSIColor qw(:constants);
>   my $P = $0;
>   $P =~ s@.*/@@g;
>   
> -our $SrcFile    = qr{\.(?:h|c|cpp|s|S|pl|py|sh)$};
> +our $SrcFile    = qr{\.(?:(h|c)(\.inc)?|cpp|s|S|pl|py|sh)$};
>   
>   my $V = '0.31';
>   
> @@ -1671,7 +1671,7 @@ sub process {
>   		}
>   
>   # check we are in a valid C source file if not then ignore this hunk
> -		next if ($realfile !~ /\.(h|c|cpp)$/);
> +		next if ($realfile !~ /\.((h|c)(\.inc)?|cpp)$/);
>   
>   # Block comment styles
>   
> 
ping
Alex Bennée June 7, 2021, 1:49 p.m. UTC | #4
"Matheus K. Ferst" <matheus.ferst@eldorado.org.br> writes:

> On 20/05/2021 16:51, matheus.ferst@eldorado.org.br wrote:
>> From: Matheus Ferst <matheus.ferst@eldorado.org.br>
>> Change the regex used to determine whether a file should be
>> processed as
>> C source to include .c.inc and .h.inc extensions.
>> Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br>
>> ---
>>   scripts/checkpatch.pl | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
>> index 3d185cceac..bbcd25ae05 100755
>> --- a/scripts/checkpatch.pl
>> +++ b/scripts/checkpatch.pl
>> @@ -12,7 +12,7 @@ use Term::ANSIColor qw(:constants);
>>   my $P = $0;
>>   $P =~ s@.*/@@g;
>>   -our $SrcFile    = qr{\.(?:h|c|cpp|s|S|pl|py|sh)$};
>> +our $SrcFile    = qr{\.(?:(h|c)(\.inc)?|cpp|s|S|pl|py|sh)$};
>>     my $V = '0.31';
>>   @@ -1671,7 +1671,7 @@ sub process {
>>   		}
>>     # check we are in a valid C source file if not then ignore this
>> hunk
>> -		next if ($realfile !~ /\.(h|c|cpp)$/);
>> +		next if ($realfile !~ /\.((h|c)(\.inc)?|cpp)$/);
>>     # Block comment styles
>>   
> ping

Seeing as checkpatch.pl is in it's own odd fixes silo I might as well
pick it up for my PR that I'm rolling.

Queued to pr/070621-testing-updates-1, thanks.
diff mbox series

Patch

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 3d185cceac..bbcd25ae05 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -12,7 +12,7 @@  use Term::ANSIColor qw(:constants);
 my $P = $0;
 $P =~ s@.*/@@g;
 
-our $SrcFile    = qr{\.(?:h|c|cpp|s|S|pl|py|sh)$};
+our $SrcFile    = qr{\.(?:(h|c)(\.inc)?|cpp|s|S|pl|py|sh)$};
 
 my $V = '0.31';
 
@@ -1671,7 +1671,7 @@  sub process {
 		}
 
 # check we are in a valid C source file if not then ignore this hunk
-		next if ($realfile !~ /\.(h|c|cpp)$/);
+		next if ($realfile !~ /\.((h|c)(\.inc)?|cpp)$/);
 
 # Block comment styles