diff mbox

[check_GNU_style.sh] More aggressively ignore dg-xxx directives

Message ID 57FCC339.3040902@foss.arm.com
State New
Headers show

Commit Message

Kyrill Tkachov Oct. 11, 2016, 10:47 a.m. UTC
Hi all,

check_GNU_style.sh complains a lot about dg-* directives in the testsuite and in particular about line lengths.
There's nothing we can do about the directives and sometimes they're supposed to be long, in particular the scan-assembler
checks in dg-final.  Currently check_GNU_style.sh has code to avoid warning for dg-* directives but it's too weak, it doesn't
catch dg-final or dg-options directives.
This patch makes the code ignore all "{ dg-.*" lines for length purposes.
This eliminates a lot of false positives in my patches and didn't filter any legitimate warnings in my patches.

Ok for trunk?

Thanks,
Kyrill

2016-10-11  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * check_GNU_style.sh (col): Ignore dg-XXX directives for line length
     complaints.

Comments

Jakub Jelinek Oct. 11, 2016, 10:56 a.m. UTC | #1
On Tue, Oct 11, 2016 at 11:47:21AM +0100, Kyrill Tkachov wrote:
> check_GNU_style.sh complains a lot about dg-* directives in the testsuite and in particular about line lengths.
> There's nothing we can do about the directives and sometimes they're supposed to be long, in particular the scan-assembler
> checks in dg-final.  Currently check_GNU_style.sh has code to avoid warning for dg-* directives but it's too weak, it doesn't
> catch dg-final or dg-options directives.
> This patch makes the code ignore all "{ dg-.*" lines for length purposes.
> This eliminates a lot of false positives in my patches and didn't filter any legitimate warnings in my patches.

I wonder if we just shouldn't ignore all line lengths in testcases (or
perhaps any coding style whatsoever).  Some testcases are meant to be
formatted more-less according to our coding style (but, e.g.
/* PR tree-optimization/12345 */
comments never end with . and 2 spaces), except for dg- directives, but
others are entered in whatever form they came from the reporter.

	Jakub
Bernd Schmidt Oct. 11, 2016, 11:01 a.m. UTC | #2
On 10/11/2016 12:56 PM, Jakub Jelinek wrote:
> On Tue, Oct 11, 2016 at 11:47:21AM +0100, Kyrill Tkachov wrote:
>> check_GNU_style.sh complains a lot about dg-* directives in the testsuite and in particular about line lengths.
>> There's nothing we can do about the directives and sometimes they're supposed to be long, in particular the scan-assembler
>> checks in dg-final.  Currently check_GNU_style.sh has code to avoid warning for dg-* directives but it's too weak, it doesn't
>> catch dg-final or dg-options directives.
>> This patch makes the code ignore all "{ dg-.*" lines for length purposes.
>> This eliminates a lot of false positives in my patches and didn't filter any legitimate warnings in my patches.
>
> I wonder if we just shouldn't ignore all line lengths in testcases (or
> perhaps any coding style whatsoever).  Some testcases are meant to be
> formatted more-less according to our coding style (but, e.g.
> /* PR tree-optimization/12345 */
> comments never end with . and 2 spaces), except for dg- directives, but
> others are entered in whatever form they came from the reporter.

I agree, probably best not to check testcases for style (but then I 
don't trust automatic checkers anyway).


Bernd
Kyrill Tkachov Oct. 11, 2016, 11:03 a.m. UTC | #3
On 11/10/16 11:56, Jakub Jelinek wrote:
> On Tue, Oct 11, 2016 at 11:47:21AM +0100, Kyrill Tkachov wrote:
>> check_GNU_style.sh complains a lot about dg-* directives in the testsuite and in particular about line lengths.
>> There's nothing we can do about the directives and sometimes they're supposed to be long, in particular the scan-assembler
>> checks in dg-final.  Currently check_GNU_style.sh has code to avoid warning for dg-* directives but it's too weak, it doesn't
>> catch dg-final or dg-options directives.
>> This patch makes the code ignore all "{ dg-.*" lines for length purposes.
>> This eliminates a lot of false positives in my patches and didn't filter any legitimate warnings in my patches.
> I wonder if we just shouldn't ignore all line lengths in testcases (or
> perhaps any coding style whatsoever).  Some testcases are meant to be
> formatted more-less according to our coding style (but, e.g.
> /* PR tree-optimization/12345 */
> comments never end with . and 2 spaces), except for dg- directives, but
> others are entered in whatever form they came from the reporter.

I would be up for ignoring the testsuite altogether in check_GNU_style.sh.
If there's consensus on this I can look into making that change.

Kyrill

> 	Jakub
Jeff Law Oct. 11, 2016, 3:13 p.m. UTC | #4
On 10/11/2016 05:01 AM, Bernd Schmidt wrote:
> On 10/11/2016 12:56 PM, Jakub Jelinek wrote:
>> On Tue, Oct 11, 2016 at 11:47:21AM +0100, Kyrill Tkachov wrote:
>>> check_GNU_style.sh complains a lot about dg-* directives in the
>>> testsuite and in particular about line lengths.
>>> There's nothing we can do about the directives and sometimes they're
>>> supposed to be long, in particular the scan-assembler
>>> checks in dg-final.  Currently check_GNU_style.sh has code to avoid
>>> warning for dg-* directives but it's too weak, it doesn't
>>> catch dg-final or dg-options directives.
>>> This patch makes the code ignore all "{ dg-.*" lines for length
>>> purposes.
>>> This eliminates a lot of false positives in my patches and didn't
>>> filter any legitimate warnings in my patches.
>>
>> I wonder if we just shouldn't ignore all line lengths in testcases (or
>> perhaps any coding style whatsoever).  Some testcases are meant to be
>> formatted more-less according to our coding style (but, e.g.
>> /* PR tree-optimization/12345 */
>> comments never end with . and 2 spaces), except for dg- directives, but
>> others are entered in whatever form they came from the reporter.
>
> I agree, probably best not to check testcases for style (but then I
> don't trust automatic checkers anyway).
Agreed that checking testcases for style isn't desirable.


jeff
diff mbox

Patch

commit d0685da3487fc4cc614c64851185fed5c350bb7b
Author: Kyrylo Tkachov <kyrylo.tkachov@arm.com>
Date:   Tue Oct 11 11:33:50 2016 +0100

    [check_GNU_style.sh] More aggressively ignore dg-xxx directives

diff --git a/contrib/check_GNU_style.sh b/contrib/check_GNU_style.sh
index 87a276c..ed4e07f 100755
--- a/contrib/check_GNU_style.sh
+++ b/contrib/check_GNU_style.sh
@@ -178,7 +178,7 @@  col (){
 	cat "$tmp" \
 	    | sed 's/^[0-9]*:+//' \
 	    | expand \
-	    | awk '$0 !~ /{[[:space:]]*dg-(error|warning|message)[[:space:]]/ { \
+	    | awk '$0 !~ /{[[:space:]]*dg-[^[:space:]]+[[:space:]]/ { \
 		     if (length($0) > 80) \
 		       printf "%s\033[1;31m%s\033[0m\n", \
 			      substr($0,1,80), \