2020-09-05 05:36:52 +08:00
|
|
|
#!/bin/bash
|
2020-10-07 06:37:42 +08:00
|
|
|
#
|
|
|
|
# Recursively format all C & C++ sources and header files, except those in the
|
|
|
|
# 'config' directory and generated files, such as H5LTanalyze.c, etc.
|
|
|
|
#
|
|
|
|
# Note that any files or directories that are excluded here should also be
|
|
|
|
# added to the 'exclude' list in .github/workflows/clang-format-check.yml
|
|
|
|
|
2023-06-14 23:00:46 +08:00
|
|
|
COMMAND="clang-format"
|
|
|
|
|
|
|
|
if [ $# -eq 1 ]; then
|
|
|
|
COMMAND="$COMMAND-$1"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo "bin/format_source <version>"
|
|
|
|
echo ""
|
|
|
|
echo "Format the HDF5 C source using clang-format. The <version>"
|
|
|
|
echo "parameter is optional and can be used to force a specific"
|
|
|
|
echo "installed version of clang-format to be used."
|
|
|
|
echo ""
|
|
|
|
|
2021-03-17 23:25:39 +08:00
|
|
|
find . \( -type d -path ./config -prune -and -not -path ./config \) \
|
2020-10-07 06:37:42 +08:00
|
|
|
-or \( \( \! \( \
|
|
|
|
-name H5LTanalyze.c \
|
|
|
|
-or -name H5LTparse.c \
|
|
|
|
-or -name H5LTparse.h \
|
2024-06-19 05:17:43 +08:00
|
|
|
-or -name H5Edefin.h \
|
2020-10-07 06:37:42 +08:00
|
|
|
-or -name H5Einit.h \
|
2024-06-19 05:17:43 +08:00
|
|
|
-or -name H5Emajdef.h \
|
|
|
|
-or -name H5Emindef.h \
|
|
|
|
-or -name H5Epubgen.h \
|
2020-10-07 06:37:42 +08:00
|
|
|
-or -name H5Eterm.h \
|
|
|
|
-or -name H5version.h \
|
|
|
|
-or -name H5overflow.h \
|
|
|
|
\) \) \
|
2022-04-20 02:08:09 +08:00
|
|
|
-and \( -iname *.h -or -iname *.c -or -iname *.cpp -or -iname *.hpp -or -iname *.java \) \) \
|
2023-06-14 23:00:46 +08:00
|
|
|
| xargs -P0 -n1 ${COMMAND} -style=file -i -fallback-style=none
|
2020-09-05 05:36:52 +08:00
|
|
|
|
2020-10-07 06:37:42 +08:00
|
|
|
exit 0
|