From 303fc6b5d70cc1d3f5802b0fdd475692266e0805 Mon Sep 17 00:00:00 2001 From: Martin Taibr Date: Sun, 8 Oct 2017 20:08:31 +0200 Subject: [PATCH] fix class() --- qcsrc/tools/uncrustify.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/qcsrc/tools/uncrustify.sh b/qcsrc/tools/uncrustify.sh index b36953e36..5d7bca54a 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 -- 2.39.2