From: Rudolf Polzer Date: Fri, 8 Nov 2013 11:52:10 +0000 (+0100) Subject: Fix function types. X-Git-Tag: xonotic-v0.8.0~264 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=bebb0330e86bf790108564c0dcc69245f7e86849;hp=76070ae3f5dce896143cef5d289083bb078de4fd Fix function types. --- diff --git a/qcsrc/uncrusticracy.sh b/qcsrc/uncrusticracy.sh index ff0bae36ee..c71b6cdced 100644 --- a/qcsrc/uncrusticracy.sh +++ b/qcsrc/uncrusticracy.sh @@ -52,7 +52,7 @@ decide() cat uncrustify.cfg printf "%s = %s\n" "$KEY" "$choice" } > uncrustify.cfg.test - uncrustify -c uncrustify.cfg.test --replace --no-backup $FILES >/dev/null 2>&1 + UNCRUSTIFY_CONFIG=uncrustify.cfg.test sh uncrustify.sh $FILES >/dev/null 2>&1 status=$? if [ $status -gt 1 ]; then echo "# ERROR: $KEY = $choice crashes with status $status." diff --git a/qcsrc/uncrustify.sh b/qcsrc/uncrustify.sh new file mode 100755 index 0000000000..2df39aa3a8 --- /dev/null +++ b/qcsrc/uncrustify.sh @@ -0,0 +1,22 @@ +fix_function_types() { + # Uncrustify handles QC function types (example: + # void(void) func; + # ) wrong and removes the space between type and variable. Fix this by + # a simple sed on ")letter" which should normally not occur. + sed -e 's/)\([A-Za-z0-9]\)/) \1/g' "$@" +} + +if [ -z "$UNCRUSTIFY_CONFIG" ]; then + UNCRUSTIFY_CONFIG=`git rev-parse --show-toplevel`/qcsrc/uncrustify.cfg +fi + +case "$#" in + 0) + uncrustify --frag -c "$UNCRUSTIFY_CONFIG" |\ + fix_function_types + ;; + *) + uncrustify --replace --no-backup -c "$UNCRUSTIFY_CONFIG" "$@" &&\ + fix_function_types -i "$@" + ;; +esac