Merge commit 'aae086cc650e42eec1eea8db28cd01fa868d7f90'
This commit is contained in:
11
external/toxcore/c-toxcore/other/astyle/astylerc
vendored
11
external/toxcore/c-toxcore/other/astyle/astylerc
vendored
@ -1,5 +1,6 @@
|
||||
# Bracket Style Options
|
||||
--style=kr
|
||||
--attach-namespaces
|
||||
|
||||
# Tab Options
|
||||
--indent=spaces=4
|
||||
@ -9,15 +10,21 @@
|
||||
|
||||
# Padding Options
|
||||
--pad-header
|
||||
--break-blocks
|
||||
--pad-oper
|
||||
# Not supported in restyled's astyle.
|
||||
#--unpad-brackets
|
||||
--unpad-paren
|
||||
--align-pointer=name
|
||||
--align-reference=name
|
||||
# Disabled because it causes very large changes and it's unclear whether we
|
||||
# want all of those.
|
||||
#--squeeze-ws
|
||||
|
||||
# Formatting Options
|
||||
--add-braces
|
||||
--convert-tabs
|
||||
--max-code-length=120
|
||||
--max-code-length=200
|
||||
--attach-return-type
|
||||
|
||||
# Other Options
|
||||
--preserve-date
|
||||
|
@ -2,36 +2,6 @@
|
||||
|
||||
set -ex
|
||||
|
||||
SOURCE_DIR="$1"
|
||||
ASTYLE="$2"
|
||||
|
||||
# Go to the source root.
|
||||
if [ -z "$SOURCE_DIR" ]; then
|
||||
SOURCE_DIR=.
|
||||
fi
|
||||
cd "$SOURCE_DIR"
|
||||
|
||||
if [ -z "$ASTYLE" ] || ! which "$ASTYLE"; then
|
||||
ASTYLE=astyle
|
||||
fi
|
||||
|
||||
if ! which "$ASTYLE"; then
|
||||
# If we couldn't find or install an astyle binary, don't do anything.
|
||||
echo "Could not find an astyle binary; please install astyle."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
readarray -t CC_SOURCES <<<"$(find . '(' -name '*.cc' ')')"
|
||||
CC_SOURCES+=(toxcore/crypto_core.c)
|
||||
CC_SOURCES+=(toxcore/ping_array.c)
|
||||
|
||||
for bin in clang-format-11 clang-format-7 clang-format-6.0 clang-format-5.0 clang-format; do
|
||||
if which "$bin"; then
|
||||
"$bin" -i -style='{BasedOnStyle: Google, ColumnLimit: 100}' "${CC_SOURCES[@]}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
FIND="find ."
|
||||
FIND="$FIND '(' -name '*.[ch]' ')'"
|
||||
FIND="$FIND -and -not -name '*.api.h'"
|
||||
@ -40,7 +10,15 @@ FIND="$FIND -and -not -wholename './third_party/*'"
|
||||
FIND="$FIND -and -not -wholename './toxencryptsave/crypto_pwhash*'"
|
||||
|
||||
readarray -t C_SOURCES <<<"$(eval "$FIND")"
|
||||
readarray -t CC_SOURCES <<<"$(find . '(' -name '*.cc' -or -name '*.hh' ')')"
|
||||
#CC_SOURCES+=(toxcore/crypto_core.c)
|
||||
#CC_SOURCES+=(toxcore/ping_array.c)
|
||||
|
||||
"$ASTYLE" -n --options=other/astyle/astylerc "${C_SOURCES[@]}"
|
||||
# Format C++ sources with clang-format.
|
||||
clang-format -i "${CC_SOURCES[@]}"
|
||||
|
||||
# Format C sources with astyle. We can't use clang-format, because it strongly
|
||||
# messes up formatting of non_null annotations.
|
||||
astyle -n --options=other/astyle/astylerc "${C_SOURCES[@]}"
|
||||
|
||||
git diff --color=always --exit-code
|
||||
|
Reference in New Issue
Block a user