toxcore/other/astyle/format-source
iphydf 4e2dba4d9f
chore: Reformat sources with astyle.
Restyled astyle is fixed now.
2024-02-02 01:31:32 +00:00

25 lines
782 B
Bash
Executable File

#!/bin/bash
set -ex
FIND="find ."
FIND="$FIND '(' -name '*.[ch]' ')'"
FIND="$FIND -and -not -name '*.api.h'"
FIND="$FIND -and -not -wholename './super_donators/*'"
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)
# 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