summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2021-03-24 22:46:48 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2021-03-24 22:46:48 (GMT)
commit2e3b24078e63ae944fc1d1e7ef10a70dfd2ebac6 (patch)
tree70714ddd8b7b8fa3bd225577f2acde405fb12333 /bin
parent93080fa6193a49cc44c5e417322047abfa3b55cf (diff)
downloadhdf5-2e3b24078e63ae944fc1d1e7ef10a70dfd2ebac6.zip
hdf5-2e3b24078e63ae944fc1d1e7ef10a70dfd2ebac6.tar.gz
hdf5-2e3b24078e63ae944fc1d1e7ef10a70dfd2ebac6.tar.bz2
Brings the clang-format files from develop
NOTE: Not wired into github actions at this time.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/format_source26
-rwxr-xr-xbin/format_source_patch34
2 files changed, 60 insertions, 0 deletions
diff --git a/bin/format_source b/bin/format_source
new file mode 100755
index 0000000..dce34e5
--- /dev/null
+++ b/bin/format_source
@@ -0,0 +1,26 @@
+#!/bin/bash
+#
+# 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
+#
+# (Remember to update both bin/format_source and bin/format_source_patch)
+
+find . \( -type d -path ./config -prune -and -not -path ./config \) \
+ -or \( \( \! \( \
+ -name H5LTanalyze.c \
+ -or -name H5LTparse.c \
+ -or -name H5LTparse.h \
+ -or -name H5Epubgen.h \
+ -or -name H5Einit.h \
+ -or -name H5Eterm.h \
+ -or -name H5Edefin.h \
+ -or -name H5version.h \
+ -or -name H5overflow.h \
+ \) \) \
+ -and \( -iname *.h -or -iname *.c -or -iname *.cpp -or -iname *.hpp \) \) \
+ | xargs clang-format -style=file -i -fallback-style=none
+
+exit 0
diff --git a/bin/format_source_patch b/bin/format_source_patch
new file mode 100755
index 0000000..439baf2
--- /dev/null
+++ b/bin/format_source_patch
@@ -0,0 +1,34 @@
+#!/bin/bash
+#
+# 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
+#
+# (Remember to update both bin/format_source and bin/format_source_patch)
+
+find . \( -type d -path ./config -prune -and -not -path ./config \) \
+ -or \( \( \! \( \
+ -name H5LTanalyze.c \
+ -or -name H5LTparse.c \
+ -or -name H5LTparse.h \
+ -or -name H5Epubgen.h \
+ -or -name H5Einit.h \
+ -or -name H5Eterm.h \
+ -or -name H5Edefin.h \
+ -or -name H5version.h \
+ -or -name H5overflow.h \
+ \) \) \
+ -and \( -iname *.h -or -iname *.c -or -iname *.cpp -or -iname *.hpp \) \) \
+ | xargs clang-format -style=file -i -fallback-style=none
+
+git diff > clang_format.patch
+
+# Delete if 0 size
+if [ ! -s clang_format.patch ]
+then
+ rm clang_format.patch
+fi
+
+exit 0