summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorvries <vries@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-12 16:23:38 +0000
committervries <vries@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-12 16:23:38 +0000
commit56f07b76a8e38519e9b34d559f20a803250efd43 (patch)
tree1dccfa8af972465d6efe228b48904f2cc7d547ca /contrib
parent93f7b419a927e642c44cc9d9ca834bd8f44fdd86 (diff)
downloadgcc-56f07b76a8e38519e9b34d559f20a803250efd43.tar.gz
check_GNU_style.sh: Fix tab size in 80 characters check
2015-05-12 Tom de Vries <tom@codesourcery.com> * check_GNU_style.sh (col): Fix tab size. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223088 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'contrib')
-rw-r--r--contrib/ChangeLog4
-rwxr-xr-xcontrib/check_GNU_style.sh38
2 files changed, 35 insertions, 7 deletions
diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index 97941f77f00..e9768a21a10 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,5 +1,9 @@
2015-05-12 Tom de Vries <tom@codesourcery.com>
+ * check_GNU_style.sh (col): Fix tab size.
+
+2015-05-12 Tom de Vries <tom@codesourcery.com>
+
* check_GNU_style.sh: Put stdin into a temp file.
2015-05-12 Tom de Vries <tom@codesourcery.com>
diff --git a/contrib/check_GNU_style.sh b/contrib/check_GNU_style.sh
index 318eb6adca5..90c612ff1cb 100755
--- a/contrib/check_GNU_style.sh
+++ b/contrib/check_GNU_style.sh
@@ -116,13 +116,37 @@ vg (){
col (){
msg="$1"
- cat $inp \
- | awk -F':\\+' '{ if (length($2) > 80) print $0}' \
- > $tmp
- if [ -s $tmp ]; then
- printf "\n$msg\n"
- cat $tmp
- fi
+ local first=true
+ local f
+ for f in $files; do
+ local prefix=""
+ if [ $nfiles -ne 1 ]; then
+ prefix="$f:"
+ fi
+
+ # Don't reuse $inp, which may be generated using -H and thus contain a
+ # file prefix.
+ grep -n '^+' $f \
+ | grep -v ':+++' \
+ > $tmp
+
+ cat $tmp | while IFS= read -r line; do
+ local longline
+ # Filter out the line number prefix and the patch line modifier '+'
+ # to obtain the bare line, before we use expand.
+ longline=$(echo "$line" \
+ | sed 's/^[0-9]*:+//' \
+ | expand \
+ | awk '{ if (length($0) > 80) print $0}')
+ if [ "$longline" != "" ]; then
+ if $first; then
+ printf "\n$msg\n"
+ first=false
+ fi
+ echo "$prefix$line"
+ fi
+ done
+ done
}
col 'Lines should not exceed 80 characters.'