DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] devtools: add long lines to the list of options
@ 2017-03-01 17:44 Allain Legacy
  2017-03-01 18:08 ` Stephen Hemminger
  2017-03-06 15:03 ` Thomas Monjalon
  0 siblings, 2 replies; 6+ messages in thread
From: Allain Legacy @ 2017-03-01 17:44 UTC (permalink / raw)
  To: thomas.monjalon; +Cc: dev

The checkpatch.pl tool is flagging warnings on long debug log strings.
Since splitting these strings makes it difficult to search for logs it is
preferred to allow these as exceptions to the long line rule.  The addition
of the LONG_LINE_STRINGS to the list of exceptions will allow lines that
end with a string to exceed the maximum line length, but lines that end
with variables or other constructs will still be flagged as errors.  Also,
lines that make use of PRIx64 with string concatenation will still be
flagged if the beginning of the last string fragment begins after the 80
character threshold.

Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
---
 devtools/checkpatches.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index 78e155e..26ff419 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -45,7 +45,7 @@ options="$options --ignore=LINUX_VERSION_CODE,FILE_PATH_CHANGES,\
 VOLATILE,PREFER_PACKED,PREFER_ALIGNED,PREFER_PRINTF,\
 PREFER_KERNEL_TYPES,BIT_MACRO,CONST_STRUCT,\
 SPLIT_STRING,LINE_SPACING,PARENTHESIS_ALIGNMENT,NETWORKING_BLOCK_COMMENT_STYLE,\
-NEW_TYPEDEFS,COMPARISON_TO_NULL"
+NEW_TYPEDEFS,COMPARISON_TO_NULL,LONG_LINE_STRING"
 
 print_usage () {
 	cat <<- END_OF_HELP
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] devtools: add long lines to the list of options
  2017-03-01 17:44 [dpdk-dev] [PATCH] devtools: add long lines to the list of options Allain Legacy
@ 2017-03-01 18:08 ` Stephen Hemminger
  2017-03-01 18:38   ` Thomas Monjalon
  2017-03-02 13:04   ` Gaëtan Rivet
  2017-03-06 15:03 ` Thomas Monjalon
  1 sibling, 2 replies; 6+ messages in thread
From: Stephen Hemminger @ 2017-03-01 18:08 UTC (permalink / raw)
  To: Allain Legacy; +Cc: thomas.monjalon, dev

On Wed, 1 Mar 2017 12:44:19 -0500
Allain Legacy <allain.legacy@windriver.com> wrote:

> The checkpatch.pl tool is flagging warnings on long debug log strings.
> Since splitting these strings makes it difficult to search for logs it is
> preferred to allow these as exceptions to the long line rule.  The addition
> of the LONG_LINE_STRINGS to the list of exceptions will allow lines that
> end with a string to exceed the maximum line length, but lines that end
> with variables or other constructs will still be flagged as errors.  Also,
> lines that make use of PRIx64 with string concatenation will still be
> flagged if the beginning of the last string fragment begins after the 80
> character threshold.
> 
> Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
> ---
>  devtools/checkpatches.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
> index 78e155e..26ff419 100755
> --- a/devtools/checkpatches.sh
> +++ b/devtools/checkpatches.sh
> @@ -45,7 +45,7 @@ options="$options --ignore=LINUX_VERSION_CODE,FILE_PATH_CHANGES,\
>  VOLATILE,PREFER_PACKED,PREFER_ALIGNED,PREFER_PRINTF,\
>  PREFER_KERNEL_TYPES,BIT_MACRO,CONST_STRUCT,\
>  SPLIT_STRING,LINE_SPACING,PARENTHESIS_ALIGNMENT,NETWORKING_BLOCK_COMMENT_STYLE,\
> -NEW_TYPEDEFS,COMPARISON_TO_NULL"
> +NEW_TYPEDEFS,COMPARISON_TO_NULL,LONG_LINE_STRING"
>  
>  print_usage () {
>  	cat <<- END_OF_HELP

Maybe it is time to have our own DPDK version of checkpatch which knows about
DPDK API's like logging functions?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] devtools: add long lines to the list of options
  2017-03-01 18:08 ` Stephen Hemminger
@ 2017-03-01 18:38   ` Thomas Monjalon
  2017-03-02 12:49     ` Mcnamara, John
  2017-03-02 13:04   ` Gaëtan Rivet
  1 sibling, 1 reply; 6+ messages in thread
From: Thomas Monjalon @ 2017-03-01 18:38 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Allain Legacy, dev

2017-03-01 10:08, Stephen Hemminger:
> > --- a/devtools/checkpatches.sh
> > +++ b/devtools/checkpatches.sh
> > @@ -45,7 +45,7 @@ options="$options --ignore=LINUX_VERSION_CODE,FILE_PATH_CHANGES,\
> >  VOLATILE,PREFER_PACKED,PREFER_ALIGNED,PREFER_PRINTF,\
> >  PREFER_KERNEL_TYPES,BIT_MACRO,CONST_STRUCT,\
> >  SPLIT_STRING,LINE_SPACING,PARENTHESIS_ALIGNMENT,NETWORKING_BLOCK_COMMENT_STYLE,\
> > -NEW_TYPEDEFS,COMPARISON_TO_NULL"
> > +NEW_TYPEDEFS,COMPARISON_TO_NULL,LONG_LINE_STRING"
> 
> Maybe it is time to have our own DPDK version of checkpatch which knows about
> DPDK API's like logging functions?

It is Perl code!
If we can have a reliable maintainer, why not.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] devtools: add long lines to the list of options
  2017-03-01 18:38   ` Thomas Monjalon
@ 2017-03-02 12:49     ` Mcnamara, John
  0 siblings, 0 replies; 6+ messages in thread
From: Mcnamara, John @ 2017-03-02 12:49 UTC (permalink / raw)
  To: Thomas Monjalon, Stephen Hemminger; +Cc: Legacy, Allain (Wind River), dev



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Thomas Monjalon
> Sent: Wednesday, March 1, 2017 6:39 PM
> To: Stephen Hemminger <stephen@networkplumber.org>
> Cc: Legacy, Allain (Wind River) <allain.legacy@windriver.com>;
> dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] devtools: add long lines to the list of
> options
> 
> 2017-03-01 10:08, Stephen Hemminger:
> > > --- a/devtools/checkpatches.sh
> > > +++ b/devtools/checkpatches.sh
> > > @@ -45,7 +45,7 @@ options="$options
> > > --ignore=LINUX_VERSION_CODE,FILE_PATH_CHANGES,\
> > >  VOLATILE,PREFER_PACKED,PREFER_ALIGNED,PREFER_PRINTF,\
> > >  PREFER_KERNEL_TYPES,BIT_MACRO,CONST_STRUCT,\
> > >
> > > SPLIT_STRING,LINE_SPACING,PARENTHESIS_ALIGNMENT,NETWORKING_BLOCK_COM
> > > MENT_STYLE,\
> > > -NEW_TYPEDEFS,COMPARISON_TO_NULL"
> > > +NEW_TYPEDEFS,COMPARISON_TO_NULL,LONG_LINE_STRING"
> >
> > Maybe it is time to have our own DPDK version of checkpatch which
> > knows about DPDK API's like logging functions?
> 
> It is Perl code!
> If we can have a reliable maintainer, why not.

It is not a big change. Something like the following would fix most of
the warnings:

$ git diff
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a8368d1..32981af 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -429,6 +429,7 @@ our $logFunctions = qr{(?x:
        WARN(?:_RATELIMIT|_ONCE|)|
        panic|
        MODULE_[A-Z_]+|
+       PMD_[A-Z_]+_LOG|RTE_LOG|
        seq_vprintf|seq_printf|seq_puts
 )};


However, putting the long string on its own line generally fixes the warning
while keeping the string greppable. 

Something like this (from the patch that triggered this discussion):

	if (eth_dev->data->mac_addrs == NULL) {
		PMD_DRV_LOG(ERR,
			    "Failed to allocate %d bytes needed to store MAC addresses\n",
			    ETHER_ADDR_LEN);
		return -ENOMEM;
	}

Instead of the original:

	if (eth_dev->data->mac_addrs == NULL) {
		PMD_DRV_LOG(ERR, "Failed to allocate %d bytes needed to store MAC addresses\n",
			    ETHER_ADDR_LEN);
		return -ENOMEM;
	}

John

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] devtools: add long lines to the list of options
  2017-03-01 18:08 ` Stephen Hemminger
  2017-03-01 18:38   ` Thomas Monjalon
@ 2017-03-02 13:04   ` Gaëtan Rivet
  1 sibling, 0 replies; 6+ messages in thread
From: Gaëtan Rivet @ 2017-03-02 13:04 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Allain Legacy, thomas.monjalon, dev

On Wed, Mar 01, 2017 at 10:08:51AM -0800, Stephen Hemminger wrote:
>On Wed, 1 Mar 2017 12:44:19 -0500
>Allain Legacy <allain.legacy@windriver.com> wrote:
>
>> The checkpatch.pl tool is flagging warnings on long debug log strings.
>> Since splitting these strings makes it difficult to search for logs it is
>> preferred to allow these as exceptions to the long line rule.  The addition
>> of the LONG_LINE_STRINGS to the list of exceptions will allow lines that
>> end with a string to exceed the maximum line length, but lines that end
>> with variables or other constructs will still be flagged as errors.  Also,
>> lines that make use of PRIx64 with string concatenation will still be
>> flagged if the beginning of the last string fragment begins after the 80
>> character threshold.
>>
>> Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
>> ---
>>  devtools/checkpatches.sh | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
>> index 78e155e..26ff419 100755
>> --- a/devtools/checkpatches.sh
>> +++ b/devtools/checkpatches.sh
>> @@ -45,7 +45,7 @@ options="$options --ignore=LINUX_VERSION_CODE,FILE_PATH_CHANGES,\
>>  VOLATILE,PREFER_PACKED,PREFER_ALIGNED,PREFER_PRINTF,\
>>  PREFER_KERNEL_TYPES,BIT_MACRO,CONST_STRUCT,\
>>  SPLIT_STRING,LINE_SPACING,PARENTHESIS_ALIGNMENT,NETWORKING_BLOCK_COMMENT_STYLE,\
>> -NEW_TYPEDEFS,COMPARISON_TO_NULL"
>> +NEW_TYPEDEFS,COMPARISON_TO_NULL,LONG_LINE_STRING"
>>
>>  print_usage () {
>>  	cat <<- END_OF_HELP
>
>Maybe it is time to have our own DPDK version of checkpatch which knows about
>DPDK API's like logging functions?

Additionally, accepting the format strings PRIu8 and consort would be 
nice, as they are currently flagged as CamelCase. Same as some EAL 
functions (like eal_parse_pci_DomBDF and eal_parse_pci_BDF), but 
renaming those could be a better solution.

-- 
Gaëtan Rivet
6WIND

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] devtools: add long lines to the list of options
  2017-03-01 17:44 [dpdk-dev] [PATCH] devtools: add long lines to the list of options Allain Legacy
  2017-03-01 18:08 ` Stephen Hemminger
@ 2017-03-06 15:03 ` Thomas Monjalon
  1 sibling, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2017-03-06 15:03 UTC (permalink / raw)
  To: Allain Legacy; +Cc: dev

2017-03-01 12:44, Allain Legacy:
> The checkpatch.pl tool is flagging warnings on long debug log strings.
> Since splitting these strings makes it difficult to search for logs it is
> preferred to allow these as exceptions to the long line rule.  The addition
> of the LONG_LINE_STRINGS to the list of exceptions will allow lines that
> end with a string to exceed the maximum line length, but lines that end
> with variables or other constructs will still be flagged as errors.  Also,
> lines that make use of PRIx64 with string concatenation will still be
> flagged if the beginning of the last string fragment begins after the 80
> character threshold.
> 
> Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
[...]
> --- a/devtools/checkpatches.sh
> +++ b/devtools/checkpatches.sh
> @@ -45,7 +45,7 @@ options="$options --ignore=LINUX_VERSION_CODE,FILE_PATH_CHANGES,\
>  VOLATILE,PREFER_PACKED,PREFER_ALIGNED,PREFER_PRINTF,\
>  PREFER_KERNEL_TYPES,BIT_MACRO,CONST_STRUCT,\
>  SPLIT_STRING,LINE_SPACING,PARENTHESIS_ALIGNMENT,NETWORKING_BLOCK_COMMENT_STYLE,\
> -NEW_TYPEDEFS,COMPARISON_TO_NULL"
> +NEW_TYPEDEFS,COMPARISON_TO_NULL,LONG_LINE_STRING"

Applied and gathered LONG_LINE_STRING and SPLIT_STRING on the same line.
Thanks

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-03-06 15:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-01 17:44 [dpdk-dev] [PATCH] devtools: add long lines to the list of options Allain Legacy
2017-03-01 18:08 ` Stephen Hemminger
2017-03-01 18:38   ` Thomas Monjalon
2017-03-02 12:49     ` Mcnamara, John
2017-03-02 13:04   ` Gaëtan Rivet
2017-03-06 15:03 ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).