]>
git.ipfire.org Git - thirdparty/pdns.git/blob - build-scripts/format-code
4 # Reformat code, but do not touch if no changes.
7 if [ "$0" != "./build-scripts/format-code" -a "$0" != "build-scripts/format-code" ]; then
8 echo "Please run me from the root checkout dir"
13 echo usage
: $0 file...
15 echo format C
++ files
, does not
touch non-regular files
18 if [ ! -e .clang-format
]; then
19 echo "No .clang-format file found in .";
27 if [ x
$CIRCLECI = xtrue
]; then
31 FORMAT
=clang-format-11
32 if ! which $FORMAT 2> /dev
/null
; then
36 if [ $verbose = 1 ]; then
37 echo Using executable
$FORMAT
40 for file in "${@}"; do
41 if [ -h "$file" -o ! -f "$file" ]; then
42 if [ $verbose = 1 ]; then
43 echo "$file: skipped, not a regular file or unreadable"
47 tmp
=$
(mktemp
"$file.XXXXXXXX")
48 if ! $FORMAT -style=file "$file" > "$tmp"; then
51 if ! cmp -s "$file" "$tmp"; then
52 echo "$file: reformatted"
55 if [ $verbose = 1 ]; then
56 echo "$file: already formatted to perfection"