From 3d8f9025b10b9782341592498618f14aa1ccd433 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 8 Feb 2009 13:30:34 +0000 Subject: Factorize grep -v cases. Originally committed as revision 17056 to svn://svn.ffmpeg.org/ffmpeg/trunk --- tools/patcheck | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'tools/patcheck') diff --git a/tools/patcheck b/tools/patcheck index 7f99afca8f..1ee6e1557b 100755 --- a/tools/patcheck +++ b/tools/patcheck @@ -23,6 +23,15 @@ hiegrep(){ cat $TMP } +hiegrep2(){ + arg="$1" + varg="$2" + msg="$3" + shift 3 + grep $OPT '^+' $* | grep -v ':+++' | egrep -v -- "$varg" | egrep --color=always -- "$arg" > $TMP && echo -e "\n$msg" + cat $TMP +} + hiegrep '[[:space:]]$' 'trailing whitespace' $* hiegrep "`echo x | tr 'x' '\t'`" 'tabs' $* #hiegrep ':\+$' 'Empty lines' $* @@ -32,8 +41,7 @@ hiegrep '//[-/<\* ]*$' 'empty comment' $* hiegrep '/\*[-<\* ]*\*/' 'empty comment' $* hiegrep 'for *\( *'"$ERE_PRITYP"' ' 'not gcc 2.95 compatible' $* -egrep $OPT '^\+(int|unsigned|static|void)[a-zA-Z0-9 _]*(init|end)[a-zA-Z0-9 _]*\(.*[^;]$' $* | grep -v 'av_cold'> $TMP && echo -e '\nThese functions may need av_cold, please review the whole patch for similar functions needing av_cold' -cat $TMP +hiegrep2 '(int|unsigned|static|void)[a-zA-Z0-9 _]*(init|end)[a-zA-Z0-9 _]*\(.*[^;]$' '(av_cold|:\+[^a-zA-Z_])' 'These functions may need av_cold, please review the whole patch for similar functions needing av_cold' $* hiegrep '\+= *1 *;' 'can be simplified to ++' $* hiegrep '-= *1 *;' 'can be simplified to --' $* @@ -58,15 +66,12 @@ hiegrep 'if *\( *(0|1) *\)' 'useless if()' $* hiegrep '& *[a-zA-Z0-9_]* *\[ *0 *\]' 'useless & [0]' $* hiegrep '(\( *[0-9] *(&&|\|\|)|(&&|\|\|) *[0-9] *\))' 'overriding condition' $* - -egrep $OPT '^\+.*\.long_name *=' $*| grep -v 'NULL_IF_CONFIG_SMAL'> $TMP && echo -e '\nmissing NULL_IF_CONFIG_SMAL' -cat $TMP +hiegrep2 '\.long_name *=' 'NULL_IF_CONFIG_SMAL' 'missing NULL_IF_CONFIG_SMAL' $* #egrep $OPT '^\+.*const ' $*| grep -v 'static'> $TMP && echo -e '\nnon static const' #cat $TMP -egrep $OPT '^\+'"$ERE_TYPES" $*| grep ':+[a-zA-Z]' | egrep -v '(static|av_|ff_|typedef)'> $TMP && echo -e '\nNon static with no ff_/av_ prefix' -cat $TMP +hiegrep2 "$ERE_TYPES" '(static|av_|ff_|typedef|:\+[^a-zA-Z_])' 'Non static with no ff_/av_ prefix' $* hiegrep ':\+[^}]*else' 'missing } prior to else' $* -- cgit v1.2.3