#!/bin/sh
+# if no argument provided, write stdin to a file and re-run the script
+if [ $# = 0 ]; then
+ cat > patcheck.stdout
+ $0 patcheck.stdout
+ rm -f patcheck.stdout
+ exit
+fi
+
TMP=patcheck.tmp
OPT="-nH"
#FILES=`grep '^+++' $* | sed 's/+++ //g'`
hiegrep 'for *\( *'"$ERE_PRITYP"' ' 'not gcc 2.95 compatible' $*
hiegrep '(static|inline|const) *\1' 'duplicate word' $*
hiegrep 'INIT_VLC_USE_STATIC' 'forbidden ancient vlc type' $*
+hiegrep '=[-+\*\&] ' 'looks like compound assignment' $*
+hiegrep2 '/\*\* *[a-zA-Z0-9].*' '\*/' 'Inconsistently formatted doxygen comment' $*
+hiegrep '; */\*\*[^<]' 'Misformatted doxygen comment' $*
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 '(:\+|,|;)( *|static|\*)*'"$ERE_PRITYP"' *\*( |\*)*(src|source|input|in[^a-z])' 'missing const?' $*
hiegrep '(:\+|,|;)( *|static|\*)*'"$ERE_PRITYP"' *(src|source|input|in)([0-9A-Z_][0-9A-Za-z_]*){1,} *\[' 'missing const (test2)?' $*
hiegrep ' *static *'"$ERE_FUNCS"'[^)]*\);' 'static prototype, maybe you should reorder your functions' $*
+hiegrep '@file: *[a-zA-Z0-9_]' 'doxy filetag with filename can in the future cause problems when forgotten during a rename' $*
hiegrep2 '\.long_name *=' 'NULL_IF_CONFIG_SMAL' 'missing NULL_IF_CONFIG_SMAL' $*
hiegrep2 '\.pix_fmts *= *\(' 'const' 'missing const for pix_fmts array' $*
hiegrep2 "$ERE_TYPES" '(static|av_|ff_|typedef|:\+[^a-zA-Z_])' 'Non static with no ff_/av_ prefix' $*
hiegrep ':\+[^}#]*else' 'missing } prior to else' $*
+hiegrep '(if|while|for)\(' 'missing whitespace between keyword and ( (feel free to ignore)' $*
+hiegrep '(else|do){' 'missing whitespace between keyword and { (feel free to ignore)' $*
+hiegrep '}(else|while)' 'missing whitespace between } and keyword (feel free to ignore)' $*
#FIXME this should print the previous statement maybe
hiegrep ':\+ *{ *$' '{ should be on the same line as the related previous statement' $*
cat $TMP
fi
-grep '^Index:.*Changelog' $* >/dev/null || printf "\nMissing changelog entry (ignore if minor change)\n"
+grep '^+++ .*Changelog' $* >/dev/null || printf "\nMissing changelog entry (ignore if minor change)\n"
cat $* | tr '\n' '@' | egrep --color=always -o '(fprintf|av_log|printf)\([^)]*\)[+ ;@]*\1' >$TMP && printf "\nMergeable calls\n"
cat $TMP | tr '@' '\n'