diff mbox

check_GNU_style.sh "80 characters exceeded" error fix

Message ID 547337E2.80000@arm.com
State New
Headers show

Commit Message

Mantas Mikaitis Nov. 24, 2014, 1:51 p.m. UTC
check_GNU_style.sh error "Lines should not exceed 80 characters" does not return the file name and line number where error is present,
only the line of code. Whereas other kind of errors return full information.

This small patch will fix this and make check_GNU_style.sh return full information when patch contains lines longer than 80 errors.

Tested on patches containing >80 chars lines and the script produces full information as necessary.

Would this be a useful enhancement for trunk?

Mantas Mikaitis

gcc/ChangeLog:

          * contrib/check_GNU_style.sh (col): Got rid of cut operation
            from the pipe chain and instead added cut inside awk command.

Comments

Jeff Law Dec. 8, 2014, 10:15 p.m. UTC | #1
On 11/24/14 06:51, Mantas Mikaitis wrote:
> check_GNU_style.sh error "Lines should not exceed 80 characters" does
> not return the file name and line number where error is present,
> only the line of code. Whereas other kind of errors return full
> information.
>
> This small patch will fix this and make check_GNU_style.sh return full
> information when patch contains lines longer than 80 errors.
>
> Tested on patches containing >80 chars lines and the script produces
> full information as necessary.
>
> Would this be a useful enhancement for trunk?
>
> Mantas Mikaitis
>
> gcc/ChangeLog:
>
>           * contrib/check_GNU_style.sh (col): Got rid of cut operation
>             from the pipe chain and instead added cut inside awk command.
Yes.  Please install on the trunk.

Thanks,
Jeff
Gerald Pfeifer Feb. 8, 2015, 3:17 p.m. UTC | #2
On Monday 2014-12-08 15:15, Jeff Law wrote:
>>           * contrib/check_GNU_style.sh (col): Got rid of cut operation
>>             from the pipe chain and instead added cut inside awk command.
> Yes.  Please install on the trunk.

I was going to apply this for Mantas (who does not have write
access), alas the patch does not apply any more and the context
has changed a bit.

Mantas, would you like to propose an updated change?

Gerald
diff mbox

Patch

diff --git a/contrib/check_GNU_style.sh b/contrib/check_GNU_style.sh
index ef8fdda..c405eeb 100755
--- a/contrib/check_GNU_style.sh
+++ b/contrib/check_GNU_style.sh
@@ -86,8 +86,7 @@  col (){
     shift 1
     grep -nH '^+' $* \
 	| grep -v ':+++' \
-	| cut -f 2 -d '+' \
-	| awk '{ if (length ($0) > 80) print $0 }' \
+	| awk -F':\\+' '{ if (length($2) > 80) print $0}' \
 	> $tmp
     if [ -s $tmp ]; then
 	printf "\n$msg\n"