summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorvries <vries@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-18 07:07:44 +0000
committervries <vries@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-18 07:07:44 +0000
commitc9c25cdd4803654200362008f5f495cfeea77f69 (patch)
treec848add72a05e4dacbf92c0e178c727d3a64b6a3 /contrib
parent92a91d1761ea32416ad99e7494d795bae41745a0 (diff)
downloadgcc-c9c25cdd4803654200362008f5f495cfeea77f69.tar.gz
check_GNU_style.sh: Don't cat empty file
2015-05-18 Tom de Vries <tom@codesourcery.com> * check_GNU_style.sh (g, ag, vg): Don't cat empty file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223284 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'contrib')
-rw-r--r--contrib/ChangeLog4
-rwxr-xr-xcontrib/check_GNU_style.sh30
2 files changed, 28 insertions, 6 deletions
diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index 1ab3fdf858b..8276c9866d9 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,5 +1,9 @@
2015-05-18 Tom de Vries <tom@codesourcery.com>
+ * check_GNU_style.sh (g, ag, vg): Don't cat empty file.
+
+2015-05-18 Tom de Vries <tom@codesourcery.com>
+
* check_GNU_style.sh (g, ag, vg, col): Declare local vars with local.
2015-05-18 Tom de Vries <tom@codesourcery.com>
diff --git a/contrib/check_GNU_style.sh b/contrib/check_GNU_style.sh
index 728c11a691d..ab59b1e6fc0 100755
--- a/contrib/check_GNU_style.sh
+++ b/contrib/check_GNU_style.sh
@@ -84,10 +84,16 @@ grep $format '^+' $files \
g (){
local msg="$1"
local arg="$2"
+
+ local found=false
cat $inp \
| egrep --color=always -- "$arg" \
- > $tmp && printf "\n$msg\n"
- cat $tmp
+ > "$tmp" && found=true
+
+ if $found; then
+ printf "\n$msg\n"
+ cat "$tmp"
+ fi
}
# And Grep
@@ -95,11 +101,17 @@ ag (){
local msg="$1"
local arg1="$2"
local arg2="$3"
+
+ local found=false
cat $inp \
| egrep --color=always -- "$arg1" \
| egrep --color=always -- "$arg2" \
- > $tmp && printf "\n$msg\n"
- cat $tmp
+ > "$tmp" && found=true
+
+ if $found; then
+ printf "\n$msg\n"
+ cat "$tmp"
+ fi
}
# reVerse Grep
@@ -107,11 +119,17 @@ vg (){
local msg="$1"
local varg="$2"
local arg="$3"
+
+ local found=false
cat $inp \
| egrep -v -- "$varg" \
| egrep --color=always -- "$arg" \
- > $tmp && printf "\n$msg\n"
- cat $tmp
+ > "$tmp" && found=true
+
+ if $found; then
+ printf "\n$msg\n"
+ cat "$tmp"
+ fi
}
col (){