File: format-source

package info (click to toggle)
libtoxcore 0.2.20-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,124 kB
  • sloc: ansic: 75,034; cpp: 4,933; sh: 1,115; python: 651; makefile: 329; perl: 39
file content (24 lines) | stat: -rwxr-xr-x 782 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/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