From: Martin Taibr Date: Sun, 8 Oct 2017 18:08:31 +0000 (+0200) Subject: fix class() X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=303fc6b5d70cc1d3f5802b0fdd475692266e0805;p=xonotic%2Fxonotic-data.pk3dir.git fix class() --- diff --git a/qcsrc/tools/uncrustify.sh b/qcsrc/tools/uncrustify.sh index b36953e366..5d7bca54a4 100755 --- a/qcsrc/tools/uncrustify.sh +++ b/qcsrc/tools/uncrustify.sh @@ -6,6 +6,12 @@ fix_function_types() { sed -e 's/)\([A-Za-z_]\)/) \1/g' "$@" } +fix_class() { + # uncrustify changes stuff like `class(WaypointSprite) .float helpme;` + # into `class(WaypointSprite).float helpme;` - revert it + sed -E -e 's/(class\([A-Za-z1-9_]+\))(\.[A-Za-z1-9_]+)/\1 \2/g' "$@" +} + if [ -z "$UNCRUSTIFY_CONFIG" ]; then UNCRUSTIFY_CONFIG=`git rev-parse --show-toplevel`/qcsrc/uncrustify.cfg fi @@ -13,10 +19,12 @@ fi case "$#" in 0) uncrustify --frag -c "$UNCRUSTIFY_CONFIG" |\ - fix_function_types + fix_function_types |\ + fix_class ;; *) uncrustify --replace --no-backup -c "$UNCRUSTIFY_CONFIG" "$@" ;\ - fix_function_types -i "$@" + fix_function_types -i "$@";\ + fix_class -i "$@" ;; esac