misc/check-doc.sh

This commit is contained in:
Wolfgang Bumiller 2013-04-22 12:22:24 +02:00
parent 1759388e3f
commit d6f6241872

43
misc/check-doc.sh Normal file
View file

@ -0,0 +1,43 @@
#!/bin/sh
prog=$0
die() {
echo "$@"
exit 1
}
want() {
test -e "$1" && return
echo "$prog: missing $1"
echo "$prog: run this script from the top of a gmqcc source tree"
exit 1
}
for i in opts.def \
doc/gmqcc.1 \
gmqcc.ini.example
do want "$i"; done
# y/_ABCDEFGHIJKLMNOPQRSTUVWXYZ/-abcdefghijklmnopqrstuvwxyz/;
check_opt() {
opt_def_name=$1
arg_char=$2
for i in $(sed -ne \
'/^#ifdef GMQCC_TYPE_'${opt_def_name}'$/,/^#endif/{
/GMQCC_DEFINE_FLAG/{
s/^.*GMQCC_DEFINE_FLAG(\([^,)]*\)[),].*$/\1/;p;
}
}' opts.def)
do
opt=$(echo "$i" | tr -- '_A-Z' '-a-z')
grep -qF -- ".It Fl "${arg_char}" Ns Cm $opt" \
doc/gmqcc.1 || echo "doc/gmqcc.1: missing: -${arg_char}$opt"
grep -q -- "[^a-zA-Z_]$i[^a-zA-Z_]" \
gmqcc.ini.example || echo "gmqcc.ini.example: missing: $i"
done
}
check_opt FLAGS f
check_opt WARNS W
check_opt OPTIMIZATIONS O