checkpatch: Don't WARN about missing spaces in audio files
PATCH 1/1 checkpatch: Don't WARN about missing spaces in audio files
Disable warnings for spaces before opening parenthesis in hw/{ac97,adlib,cs4231a,es1370,gus,sb16}.c.
--- scripts/checkpatch.pl | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
scripts/checkpatch.pl +5 -0
@@ -246,6 +246,8 @@ our $allowed_asm_includes = qr{(?x: )}; # memory.h: ARM has a custom one +our $audio_files = qr{hw/ac97.c|hw/adlib.c|hw/cs4231a.c|hw/es1370.c|hw/gus.c|hw/sb16.c}; + sub build_types { my $mods = "(?x: \n" . join("|\n ", @modifierList) . "\n)"; my $all = "(?x: \n" . join("|\n ", @typeList) . "\n)";
@@ -1966,6 +1968,9 @@ sub process { asm|__asm__)$/x) { + # malc wants to keep spacing consistent in the audio files. + } elsif ($realfile =~ /($audio_files)/) { + # cpp #define statements have non-optional spaces, ie # if there is a space between the name and the open # parenthesis it is simply not a parameter group.
Signature · 1 line
1.7.7
Am 09.02.2012 15:59, schrieb Andreas Färber:
Quoted 7 lines
Disable warnings for spaces before opening parenthesis in
hw/{ac97,adlib,cs4231a,es1370,gus,sb16}.c.Signed-off-by Andreas Färber <[email protected]>Cc Blue Swirl <[email protected]>Cc malc <[email protected]>---
For testing I used the following pseudo-patch:
--8<--
hw/sb16.c +1 -1
@@ -1,1 +1,1 @@ -device_init (foobar) +type_init (foobar)
hw/foo.c +1 -1
@@ -1,1 +1,1 @@ -device_init (foobar) +type_init (foobar)
--8<--
Adding a rule to warn about missing space before parenthesis is left as an exercise for malc.
Andreas
Quoted 26 lines
scripts/checkpatch.pl | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)scripts/checkpatch.pl +5
-0@@ -246,6 +246,8 @@ our $allowed_asm_includes = qr{(?x: )}; # memory.h: ARM has a custom one +our $audio_files = qr{hw/ac97.c|hw/adlib.c|hw/cs4231a.c|hw/es1370.c|hw/gus.c|hw/sb16.c}; + sub build_types { my $mods = "(?x: \n" . join("|\n ", @modifierList) . "\n)"; my $all = "(?x: \n" . join("|\n ", @typeList) . "\n)";@@ -1966,6 +1968,9 @@ sub process { asm|__asm__)$/x) { + # malc wants to keep spacing consistent in the audio files. + } elsif ($realfile =~ /($audio_files)/) { + # cpp #define statements have non-optional spaces, ie # if there is a space between the name and the open # parenthesis it is simply not a parameter group.
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Quoted 6 lines · Andreas F?rber
Disable warnings for spaces before opening parenthesis in
hw/{ac97,adlib,cs4231a,es1370,gus,sb16}.c.Signed-off-by Andreas F?rber <[email protected]>Cc Blue Swirl <[email protected]>Cc malc <[email protected]>
Thanks.
scripts/checkpatch.pl our $allowed_asm_includes = qr{(?x: · line 249
Quoted 13 lines
--- scripts/checkpatch.pl | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)scripts/checkpatch.pl +1
-0@@ -246,6 +246,8 @@ our $allowed_asm_includes = qr{(?x: )}; # memory.h: ARM has a custom one +our $audio_files = qr{hw/ac97.c|hw/adlib.c|hw/cs4231a.c|hw/es1370.c|hw/gus.c|hw/sb16.c};
My perl is not up to snuff so i wouldn't know how to add audio/* to the mix.
Quoted 15 lines
scripts/checkpatch.pl +4
-0+ sub build_types { my $mods = "(?x: \n" . join("|\n ", @modifierList) . "\n)"; my $all = "(?x: \n" . join("|\n ", @typeList) . "\n)";@@ -1966,6 +1968,9 @@ sub process { asm|__asm__)$/x) { + # malc wants to keep spacing consistent in the audio files. + } elsif ($realfile =~ /($audio_files)/) { + # cpp #define statements have non-optional spaces, ie # if there is a space between the name and the open # parenthesis it is simply not a parameter group.
Signature · 1 line
mailto:[email protected]
Quoted 2 lines · Andreas Färber
Disable warnings for spaces before opening parenthesis in
hw/{ac97,adlib,cs4231a,es1370,gus,sb16}.c.
Why audio files are such a special thing?
Isn't it be better to revert a patch that introduced checkpatch.pl errors?
Signature · 5 lines
Kind regards, Evgeny Voevodin, Leading Software Engineer, ASWG, Moscow R&D center, Samsung Electronics e-mail: [email protected]
Quoted 5 lines · Evgeny Voevodin
Quoted 2 lines · Andreas F?rber
Disable warnings for spaces before opening parenthesis in
hw/{ac97,adlib,cs4231a,es1370,gus,sb16}.c.Why audio files are such a special thing?
Because they are consistently formatted the way they are.
Quoted 1 line
Isn't it be better to revert a patch that introduced checkpatch.pl errors?
No.
Signature · 1 line
mailto:[email protected]
Quoted 9 lines · malc
Quoted 5 lines · Evgeny Voevodin
Quoted 2 lines · Andreas F?rber
Disable warnings for spaces before opening parenthesis in
hw/{ac97,adlib,cs4231a,es1370,gus,sb16}.c.Why audio files are such a special thing?
Because they are consistently formatted the way they are.
I personally hate the QEMU Coding Style I dislike inconsistency more than any particular style.
So I'm with malc here. I'd be opposed to introducing a new file that deviated from Coding Style but for the ones that already do, I see no reason to convert them all at once or make the code deviate from the style it's already using.
Quoted 4 lines
Quoted 2 lines
Isn't it be better to revert a patch that introduced checkpatch.pl errors?
No.
Regards,
Anthony Liguori
Quoted 1 line
Quoted 34 lines · Andreas Färber
Disable warnings for spaces before opening parenthesis in
hw/{ac97,adlib,cs4231a,es1370,gus,sb16}.c.Signed-off-by Andreas Färber <[email protected]>Cc Blue Swirl <[email protected]>Cc malc <[email protected]>---
scripts/checkpatch.pl | 5 +++++1 files changed, 5 insertions(+), 0 deletions(-)scripts/checkpatch.pl +5
-1@@ -246,6 +246,8 @@ our $allowed_asm_includes = qr{(?x: )}; # memory.h: ARM has a custom one +our $audio_files = qr{hw/ac97.c|hw/adlib.c|hw/cs4231a.c|hw/es1370.c|hw/gus.c|hw/sb16.c}; + sub build_types { my $mods = "(?x: \n" . join("|\n ", @modifierList) . "\n)"; my $all = "(?x: \n" . join("|\n ", @typeList) . "\n)";@@ -1966,6 +1968,9 @@ sub process { asm|__asm__)$/x) { + # malc wants to keep spacing consistent in the audio files. + } elsif ($realfile =~ /($audio_files)/) { + # cpp #define statements have non-optional spaces, ie # if there is a space between the name and the open # parenthesis it is simply not a parameter group. --
Quoted 2 lines
1.7.7
NACK to such special casing.
Quoted 10 lines · Anthony Liguori
Quoted 9 lines · malc
Quoted 6 lines · Evgeny Voevodin
Quoted 3 lines · Andreas F?rber
Disable warnings for spaces before opening parenthesis in
hw/{ac97,adlib,cs4231a,es1370,gus,sb16}.c.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Why audio files are such a special thing?
Because they are consistently formatted the way they are.
I personally hate the QEMU Coding Style I dislike inconsistency more than any particular style.
I dislike unclear rules more than inconsistency or coding styles.
Quoted 4 lines
So I'm with malc here. I'd be opposed to introducing a new file that deviated from Coding Style but for the ones that already do, I see no reason to convert them all at once or make the code deviate from the style it's already using.
I'd make a rule, specify the level of importance and try to stick to it. I would not oppose global reformatting to GNU style even (which I hate) if that would be the rule. I don't like laissez faire, but if that is the rule then fine.
Quoted 16 lines
Quoted 7 lines
Quoted 4 lines
Isn't it be better to revert a patch that introduced checkpatch.pl errors?
No.
Regards,
Anthony Liguori
Quoted 1 line
Quoted 22 lines · Blue Swirl
Quoted 10 lines · Anthony Liguori
Quoted 9 lines · malc
Quoted 6 lines · Evgeny Voevodin
Quoted 3 lines · Andreas F?rber
Disable warnings for spaces before opening parenthesis in
hw/{ac97,adlib,cs4231a,es1370,gus,sb16}.c.Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Why audio files are such a special thing?
Because they are consistently formatted the way they are.
I personally hate the QEMU Coding Style I dislike inconsistency more than any particular style.
I dislike unclear rules more than inconsistency or coding styles.
Quoted 8 lines
Quoted 4 lines
So I'm with malc here. I'd be opposed to introducing a new file that deviated from Coding Style but for the ones that already do, I see no reason to convert them all at once or make the code deviate from the style it's already using.
I'd make a rule, specify the level of importance and try to stick to it. I would not oppose global reformatting to GNU style even (which I hate) if that would be the rule.
I really hate having these discussions. I would almost rather we just pay the one-time cost of re-indenting so we can stop debating about this.
For folks that feel strongly about this, please submit the following:
An indent command that takes the tree to CODING_STYLE along with a diffstat of the end result.
Depending on how bad the diffstat is, we can consider doing this and ending this set of arguments once and for all.
Regards,
Anthony Liguori
Quoted 21 lines
I don't like laissez faire, but if
that is the rule then fine.Quoted 16 lines
Quoted 7 lines
Quoted 4 lines
Isn't it be better to revert a patch that introduced checkpatch.pl errors?
No.
Regards,
Anthony Liguori
Quoted 1 line
Quoted 11 lines · Anthony Liguori
I really hate having these discussions. I would almost rather we just pay the one-time cost of re-indenting so we can stop debating about this.
For folks that feel strongly about this, please submit the following:
An indent command that takes the tree to
CODING_STYLEalong with a diffstat of the end result.Depending on how bad the diffstat is, we can consider doing this and ending this set of arguments once and for all.
The only justification for an idiosyncratic coding style I can buy is minimizing reindentation of old code. If we reindent anyway, reindent to something that isn't specific to the QEMU island, please.
Quoted 8 lines · Markus Armbruster
Quoted 6 lines · Anthony Liguori
I really hate having these discussions. I would almost rather we just pay the one-time cost of re-indenting so we can stop debating about this.
For folks that feel strongly about this, please submit the following:
Quoted 8 lines
Quoted 5 lines
An indent command that takes the tree to
CODING_STYLEalong with a diffstat of the end result.Depending on how bad the diffstat is, we can consider doing this and ending this set of arguments once and for all.
The only justification for an idiosyncratic coding style I can buy is minimizing reindentation of old code.
Well this was what I was getting at in my previous comments. If we just need to reindent < 10 files with a few random changes here and there, then maybe that isn't so bad.
But if we have to touch every single file in the tree in a significant way, then no way is it justified.
Quoted 2 lines
If we reindent anyway, reindent
to something that isn't specific to the QEMU island, please.
I don't even want to consider something that touches every line of code. That's effectively creating a new source tree and losing the continuity of our SCM history.
Regards,
Anthony Liguori
Quoted 39 lines · Anthony Liguori
Quoted 38 lines · Blue Swirl
Quoted 18 lines · Anthony Liguori
Quoted 16 lines · malc
Quoted 9 lines · Evgeny Voevodin
Quoted 4 lines · Andreas F?rber
Disable warnings for spaces before opening parenthesis in
hw/{ac97,adlib,cs4231a,es1370,gus,sb16}.c.Why audio files are such a special thing?
Quoted 6 lines
Quoted 1 line
Because they are consistently formatted the way they are.
I personally hate the QEMU Coding Style I dislike inconsistency more than any particular style.
I dislike unclear rules more than inconsistency or coding styles.
Quoted 5 lines
So I'm with malc here. I'd be opposed to introducing a new file that deviated from Coding Style but for the ones that already do, I see no reason
to convert them all at once or make the code deviate from the style it's already using.
Quoted 7 lines
Quoted 3 lines
I'd make a rule, specify the level of importance and try to stick to it. I would not oppose global reformatting to GNU style even (which I hate) if that would be the rule.
I really hate having these discussions. I would almost rather we just pay the one-time cost of re-indenting so we can stop debating about this.
Fully agree on both.
Quoted 7 lines
For folks that feel strongly about this, please submit the following:
An indent command that takes the tree to
CODING_STYLEalong with a diffstat of the end result.Depending on how bad the diffstat is, we can consider doing this and ending this set of arguments once and for all.
IIRC GNU indent could not be convinced to follow QEMU style. A quick test on target-sparc with the command
indent -kr -i4 -nut -sob -l80 -ss -ncs -il0 -cp1 -nfca -TCPUState -TCPUSPARCState *.[ch]
is very close, but I couldn't avoid comment reformatting despite -nfca, indent is totally confused with helper.h and some casts get spaces despite -ncs.
Quoted 29 lines
Regards,
Anthony Liguori
Quoted 23 lines
I don't like laissez faire, but if
that is the rule then fine.Quoted 18 lines
Quoted 8 lines
Quoted 4 lines
Isn't it be better to revert a patch that introduced checkpatch.pl errors?
No.
Regards,
Anthony Liguori
Quoted 1 line
PATCH 1/1 astyle: Formatting rules for QEMU
These AStyle rules try to implement the QEMU coding style.
AStyle can also fix only certain aspects of the coding style, for example indentation.
---
Hi Blue,
maybe this AStyle rules work better. I tried them with target-sparc, and the result does look quite good.
Regards,
Stefan
scripts/astylerc | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) create mode 100644 scripts/astylerc
scripts/astylerc new file +19 -0
@@ -0,0 +1,19 @@ +# Artistic Style (astyle) options for qemu source code. + +# Usage: +# astyle --options=scripts/astylerc {source files} + +# For best results, use latest astyle from http://astyle.sourceforge.net/. + +add-brackets +align-pointer=name +convert-tabs +max-code-length=80 +style=otbs +brackets=linux +indent=spaces=4 +max-code-length=80 +max-instatement-indent=60 +pad-oper +pad-header +unpad-paren
Signature · 1 line
1.7.9
Quoted 21 lines · Anthony Liguori
Quoted 12 lines · Markus Armbruster
Quoted 9 lines · Anthony Liguori
I really hate having these discussions. I would almost rather we just pay the one-time cost of re-indenting so we can stop debating about this.
For folks that feel strongly about this, please submit the following:
An indent command that takes the tree to
CODING_STYLEalong with a diffstat of the end result.Quoted 6 lines
Quoted 2 lines
Depending on how bad the diffstat is, we can consider doing this and ending this set of arguments once and for all.
The only justification for an idiosyncratic coding style I can buy is minimizing reindentation of old code.
Quoted 6 lines
Well this was what I was getting at in my previous comments. If we just need to reindent < 10 files with a few random changes here and there, then maybe that isn't so bad.
But if we have to touch every single file in the tree in a significant way, then no way is it justified.
One way to handle this is gradual reformatting, every time when code is touched, only changes towards common CODING_STYLE are allowed. Small, contained reformatting patches should be also allowed, for example to adjust brace style in one file a time or to remove spaces at the end of line.
Quoted 7 lines
Quoted 2 lines
If we reindent anyway, reindent
to something that isn't specific to the QEMU island, please.I don't even want to consider something that touches every line of code. That's effectively creating a new source tree and losing the continuity of our SCM history.
I think only 'git blame' output would be affected and that is not 100% reliable anyway, considering for example code movement.
Quoted 5 lines
Regards,
Anthony Liguori
Re: [Qemu-devel] [PATCH] astyle: Formatting rules for QEMU
In reply to Stefan WeilQuoted 5 lines · Stefan Weil
These AStyle rules try to implement the QEMU coding style.
AStyle can also fix only certain aspects of the coding style, for example indentation.
Quoted 7 lines
Signed-off-by Stefan Weil <[email protected]>---
Hi Blue,
maybe this AStyle rules work better. I tried them with target-sparc, and the result does look quite good.
There are still indentation problems when expressions continue to next line, also this does not look OK:
target-sparc/translate.c +1 -1
@@ -36,7 +36,7 @@#define DYNAMIC_PC 1/* dynamic pc value */ #define JUMP_PC 2/* dynamic pc value which takes only two values -according to jump_pc[T2] */ +according to jump_pc[T2] */
Moving the brace to same line as switch case should not be necessary.
Overall astyle seems to be a better tool than GNU indent.
I also tried to use Emacs to perform the indenting with the attached scripts, but the result is not that great either, especially some macros and helper.h confuse indentation.
Quoted 14 lines
Regards,
Stefanscripts/astylerc | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)create mode 100644
scripts/astylercscripts/astylerc new file +1
-0@@ -0,0 +1,19 @@ +# Artistic Style (astyle) options for qemu source code.
scripts/astylerc line 11
Quoted 10 lines
scripts/astylerc new file +10
-0+ +# Usage: +# astyle --options=scripts/astylerc {source files} + +# For best results, use latest astyle from http://astyle.sourceforge.net/. + +add-brackets +align-pointer=name +convert-tabs +max-code-length=80
This is only supported by the SVN HEAD, not even the download tarball offered.
Quoted 11 lines
scripts/astylerc new file +8
-1+style=otbs +brackets=linux +indent=spaces=4 +max-code-length=80 +max-instatement-indent=60 +pad-oper +pad-header +unpad-paren --1.7.9
Am 18.02.2012 10:13, schrieb Blue Swirl:
Quoted 5 lines · Anthony Liguori
Quoted 4 lines
Well this was what I was getting at in my previous comments. If we just need to reindent < 10 files with a few random changes here and there, then maybe that isn't so bad.
Quoted 8 lines
Quoted 2 lines
But if we have to touch every single file in the tree in a significant way, then no way is it justified.
One way to handle this is gradual reformatting, every time when code is touched, only changes towards common
CODING_STYLEare allowed. Small, contained reformatting patches should be also allowed, for example to adjust brace style in one file a time or to remove spaces at the end of line.
I'd appreciate it very much if we could remove spaces at line endings for all non binary files as soon as possible.
Newer versions of git (maybe also older ones with appropriate configuration, see 'git config --help', core.whitespace / blank-at-eol/ apply.whitespace) complain about patches which add such spaces. Nevertheless even recent patches did add spaces, so obviously not all committers use that git settings.
It's good practice to use an editor which automatically removes spaces at end of line (I think most editors can be configured to do this). With the current code, this is difficult because it introduces additional whitespace changes when I edit a file with spaces which are removed by the editor.
Quoted 9 lines
Quoted 6 lines
I don't even want to consider something that touches every line of code.
That's effectively creating a new source tree and losing the
continuity of
our SCM history.I think only 'git blame' output would be affected and that is not 100% reliable anyway, considering for example code movement.
'git blame' can optionally ignore whitespace changes, so that is not really a problem. It can even ignore code movements :-) Just use 'git blame -w -C'.
Regards,
Stefan
Re: [Qemu-devel] [PATCH] astyle: Formatting rules for QEMU
In reply to Blue SwirlAm 18.02.2012 11:10, schrieb Blue Swirl:
target-sparc/translate.c line 39
Quoted 10 lines
There are still indentation problems when expressions continue to next line, also this does not look OK:
target-sparc/translate.c +1
-1@@ -36,7 +36,7 @@#define DYNAMIC_PC 1/* dynamic pc value */ #define JUMP_PC 2/* dynamic pc value which takes only two values -according to jump_pc[T2] */ +according to jump_pc[T2] */
Writing comments like this looks nice, but needs more work when the comments are written. Maintenance of the code is also more
difficult: any time a new line with a longer name is added, you have to reformat all other lines to preserve the good look.
Just add this line to the code given above to see what I mean:
#define ANY_LONG_PC 3 /* just an example */
This is why I usually write comments in an extra line before the code statement.
Regards,
Stefan
Quoted 9 lines · Stefan Weil
Am 18.02.2012 10:13, schrieb Blue Swirl:
Quoted 8 lines · Anthony Liguori
Quoted 6 lines
Well this was what I was getting at in my previous comments. If we just need to reindent < 10 files with a few random changes here and there, then maybe that isn't so bad.
But if we have to touch every single file in the tree in a significant way, then no way is it justified.
Quoted 8 lines
Quoted 5 lines
One way to handle this is gradual reformatting, every time when code is touched, only changes towards common
CODING_STYLEare allowed. Small, contained reformatting patches should be also allowed, for example to adjust brace style in one file a time or to remove spaces at the end of line.I'd appreciate it very much if we could remove spaces at line endings for all non binary files as soon as possible.
Why?
I really can't understand this. It's not visible so it does no harm.
Regards,
Anthony Liguori
Quoted 24 lines · Anthony Liguori
Quoted 23 lines · Stefan Weil
Am 18.02.2012 10:13, schrieb Blue Swirl:
Quoted 19 lines
Quoted 9 lines · Anthony Liguori
Well this was what I was getting at in my previous comments. If we just need to reindent < 10 files with a few random changes here and there, then
maybe that isn't so bad.But if we have to touch every single file in the tree in a significant way,
then no way is it justified.One way to handle this is gradual reformatting, every time when code is touched, only changes towards common
CODING_STYLEare allowed. Small, contained reformatting patches should be also allowed, for example to adjust brace style in one file a time or to remove spaces at the end of line.
Quoted 7 lines
Quoted 2 lines
I'd appreciate it very much if we could remove spaces at line endings for all non binary files as soon as possible.
Why?
I really can't understand this. It's not visible so it does no harm.
It's not the end of the world, but they could be mangled (which will make patches fail to apply) when mailed and they waste precious bytes. They are also not useful in any way, so better remove them.
Quoted 3 lines
Regards,
Anthony Liguori
Am 18.02.2012 10:13, schrieb Blue Swirl:
Quoted 2 lines
One way to handle this is gradual reformatting, every time when code is touched, only changes towards common
CODING_STYLEare allowed.
That's what we've been doing wrt braces and I appreciate us not cluttering the history with reformatting commits.
Especially at a time where I'm touching every target (and seeing quite some variations on coding style) I'm not so happy about this initiative.
Quoted 7 lines · Anthony Liguori
Quoted 3 lines
I don't even want to consider something that touches every line of code.
That's effectively creating a new source tree and losing the continuity of
our SCM history.I think only 'git blame' output would be affected and that is not 100% reliable anyway, considering for example code movement.
I use repo.or.cz's blame function quite often to find out who to cc or what commit to mention, and (valid) typo fixes are already troublesome, requiring to go to the parent commit and to navigate to the same file in its tree. One cannot specify any custom ignore options there.
Is there a better tool to do such interactive, recursive git-blame?
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Quoted 9 lines · Andreas Färber
Quoted 2 lines
I think only 'git blame' output would be affected and that is not 100% reliable anyway, considering for example code movement.
I use repo.or.cz's blame function quite often to find out who to cc or what commit to mention, and (valid) typo fixes are already troublesome, requiring to go to the parent commit and to navigate to the same file in its tree. One cannot specify any custom ignore options there.
Is there a better tool to do such interactive, recursive git-blame?
I use 'git gui blame $commit $file &' for interactive recursive blaming.
When you find the line that you are interested in blaming, you can
click on the commit link on the left side to see the context at the time of the commit that introduced the state of that line, then right click on the right side (the line in question) to easily trigger a 'blame parent' operation. It's about the only thing that I use 'git gui' for, but I find it well worth the pain of using a tcl frontend.
Signature · 2 lines
Eric Blake [email protected] +1-919-301-3266 Libvirt virtualization library http://libvirt.org