diff mbox

checkpatch: port fix from kernel "## is not a valid modifier"

Message ID 1423510988-48508-1-git-send-email-borntraeger@de.ibm.com
State New
Headers show

Commit Message

Christian Borntraeger Feb. 9, 2015, 7:43 p.m. UTC
From: Andy Whitcroft <apw@canonical.com>

checkpatch currently loops on fpu/softfloat.c
Turns out this is fixed in the Linux version of checkpatch.

So this is a port of Andy Whitcrofts fix from Linux,
Original commit was commit 89a883530fe7 ("checkpatch: ## is not a
valid modifier")

Cc: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 scripts/checkpatch.pl | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Peter Maydell Feb. 9, 2015, 10:54 p.m. UTC | #1
On 9 February 2015 at 19:43, Christian Borntraeger
<borntraeger@de.ibm.com> wrote:
> From: Andy Whitcroft <apw@canonical.com>
>
> checkpatch currently loops on fpu/softfloat.c
> Turns out this is fixed in the Linux version of checkpatch.
>
> So this is a port of Andy Whitcrofts fix from Linux,
> Original commit was commit 89a883530fe7 ("checkpatch: ## is not a
> valid modifier")
>
> Cc: Andy Whitcroft <apw@canonical.com>
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
>  scripts/checkpatch.pl | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 5df61f9..8635f4c 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -1061,7 +1061,9 @@ sub possible {
>                         case|
>                         else|
>                         asm|__asm__|
> -                       do
> +                       do|
> +                       \#|
> +                       \#\#|

Are you sure this line should end with a '|', given it's the
last item in the alternation ?

>                 )(?:\s|$)|
>                 ^(?:typedef|struct|enum)\b
>             )}x;
> --
> 1.9.3
>

thanks
-- PMM
Christian Borntraeger Feb. 10, 2015, 8:07 a.m. UTC | #2
Am 09.02.2015 um 23:54 schrieb Peter Maydell:
> On 9 February 2015 at 19:43, Christian Borntraeger
> <borntraeger@de.ibm.com> wrote:
>> From: Andy Whitcroft <apw@canonical.com>
>>
>> checkpatch currently loops on fpu/softfloat.c
>> Turns out this is fixed in the Linux version of checkpatch.
>>
>> So this is a port of Andy Whitcrofts fix from Linux,
>> Original commit was commit 89a883530fe7 ("checkpatch: ## is not a
>> valid modifier")
>>
>> Cc: Andy Whitcroft <apw@canonical.com>
>> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
>> ---
>>  scripts/checkpatch.pl | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
>> index 5df61f9..8635f4c 100755
>> --- a/scripts/checkpatch.pl
>> +++ b/scripts/checkpatch.pl
>> @@ -1061,7 +1061,9 @@ sub possible {
>>                         case|
>>                         else|
>>                         asm|__asm__|
>> -                       do
>> +                       do|
>> +                       \#|
>> +                       \#\#|
> 
> Are you sure this line should end with a '|', given it's the
> last item in the alternation ?

Good question - dont know. But the kernel version looks the same.
Christian Borntraeger Feb. 10, 2015, 9:40 a.m. UTC | #3
Am 09.02.2015 um 23:54 schrieb Peter Maydell:
> On 9 February 2015 at 19:43, Christian Borntraeger
> <borntraeger@de.ibm.com> wrote:
>> From: Andy Whitcroft <apw@canonical.com>
>>
>> checkpatch currently loops on fpu/softfloat.c
>> Turns out this is fixed in the Linux version of checkpatch.
>>
>> So this is a port of Andy Whitcrofts fix from Linux,
>> Original commit was commit 89a883530fe7 ("checkpatch: ## is not a
>> valid modifier")
>>
>> Cc: Andy Whitcroft <apw@canonical.com>
>> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
>> ---
>>  scripts/checkpatch.pl | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
>> index 5df61f9..8635f4c 100755
>> --- a/scripts/checkpatch.pl
>> +++ b/scripts/checkpatch.pl
>> @@ -1061,7 +1061,9 @@ sub possible {
>>                         case|
>>                         else|
>>                         asm|__asm__|
>> -                       do
>> +                       do|
>> +                       \#|
>> +                       \#\#|
> 
> Are you sure this line should end with a '|', given it's the
> last item in the alternation ?

Getting rid of that additional | also works, but both ways fix the endless loop.
Certainly not having the "|" seems cleaner. (No idea why it works).
Shall I respin without the "|"? I will then also send a patch for the kernel, in case we resync again in the future.

Christian
Markus Armbruster Feb. 10, 2015, 12:01 p.m. UTC | #4
Christian Borntraeger <borntraeger@de.ibm.com> writes:

> Am 09.02.2015 um 23:54 schrieb Peter Maydell:
>> On 9 February 2015 at 19:43, Christian Borntraeger
>> <borntraeger@de.ibm.com> wrote:
>>> From: Andy Whitcroft <apw@canonical.com>
>>>
>>> checkpatch currently loops on fpu/softfloat.c
>>> Turns out this is fixed in the Linux version of checkpatch.
>>>
>>> So this is a port of Andy Whitcrofts fix from Linux,
>>> Original commit was commit 89a883530fe7 ("checkpatch: ## is not a
>>> valid modifier")
>>>
>>> Cc: Andy Whitcroft <apw@canonical.com>
>>> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
>>> ---
>>>  scripts/checkpatch.pl | 4 +++-
>>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
>>> index 5df61f9..8635f4c 100755
>>> --- a/scripts/checkpatch.pl
>>> +++ b/scripts/checkpatch.pl
>>> @@ -1061,7 +1061,9 @@ sub possible {
>>>                         case|
>>>                         else|
>>>                         asm|__asm__|
>>> -                       do
>>> +                       do|
>>> +                       \#|
>>> +                       \#\#|
>> 
>> Are you sure this line should end with a '|', given it's the
>> last item in the alternation ?
>
> Getting rid of that additional | also works, but both ways fix the endless loop.
> Certainly not having the "|" seems cleaner. (No idea why it works).
> Shall I respin without the "|"? I will then also send a patch for the
> kernel, in case we resync again in the future.

If it works, I'd take it as is into QEMU, and get the cleanup from the
kernel in the next resync.
diff mbox

Patch

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 5df61f9..8635f4c 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1061,7 +1061,9 @@  sub possible {
 			case|
 			else|
 			asm|__asm__|
-			do
+			do|
+			\#|
+			\#\#|
 		)(?:\s|$)|
 		^(?:typedef|struct|enum)\b
 	    )}x;