Skip to content

Commit c54fbc9

Browse files
authored
Make clang-format not modify ink_autoconf.h.in and ink_autoconf.h (#8935)
ink_autoconf.h.in and ink_autoconf.h are generated files created with autoconf. After they are made, if the user builds with them and then calls the clang-format target, clang-format will dutifully format these files according to our .clang-format specification. This then results in a future invocation of make rebuilding most of the files in the repository because those file are fundamental dependencies in our repository. This patch addresses the issue by simply not calling clang-format on these generated, not checked in, files. This fixes #8934
1 parent 952bf25 commit c54fbc9

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

tools/clang-format.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,15 @@ EOF
7878
exit 1
7979
else
8080
for file in $(find $DIR -iname \*.[ch] -o -iname \*.cc -o -iname \*.h.in); do
81-
echo $file
82-
${FORMAT} -i $file
81+
# The ink_autoconf.h and ink_autoconf.h.in files are generated files,
82+
# so they do not need to be re-formatted by clang-format. Doing so
83+
# results in make rebuilding all our files, so we skip formatting them
84+
# here.
85+
base_name=$(basename ${file})
86+
[ ${base_name} = 'ink_autoconf.h.in' -o ${base_name} = 'ink_autoconf.h' ] && continue
87+
88+
echo $file
89+
${FORMAT} -i $file
8390
done
8491
fi
8592
}

0 commit comments

Comments
 (0)