aboutsummaryrefslogtreecommitdiffstats
path: root/format-code
diff options
context:
space:
mode:
authorJay Berkenbilt <jberkenbilt@users.noreply.github.com>2023-06-17 17:58:00 +0200
committerGitHub <noreply@github.com>2023-06-17 17:58:00 +0200
commit0152f25489fa1d39da1ece0bb800c0204ae654ce (patch)
tree4c52dc6cb2da0c99e3e6badaa8e544534525e9b2 /format-code
parent071fe4a0e5c7e6abd6725552d1bf0b6119bce1c9 (diff)
parent1d979adde53c3a473c274c39af7f1925ba07e45d (diff)
downloadqpdf-0152f25489fa1d39da1ece0bb800c0204ae654ce.tar.zst
Merge pull request #991 from jberkenbilt/clang-format-version
Bump minimum clang-format version to 16
Diffstat (limited to 'format-code')
-rwxr-xr-xformat-code13
1 files changed, 13 insertions, 0 deletions
diff --git a/format-code b/format-code
index 5ec5275d..295c5d05 100755
--- a/format-code
+++ b/format-code
@@ -19,6 +19,19 @@
# Please see "Code Formatting" in the manual for additional notes.
+# If a newer version of clang-format causes changes to the output that
+# are improvements, bump the minimum required version of clang-format
+# here, and update manual/contributing.rst. There's a comment there
+# that refers to this comment. See also .clang-format.
+min_version=16
+
+clang_version=$(clang-format --version | \
+ awk '{for (i=1; i<=NF; i++) if ($i == "version") {print int($(i+1)); exit}}')
+if [ "$clang_version" -lt "$min_version" ]; then
+ echo "clang-format version >= $min_version is required"
+ exit 2
+fi
+
cd $(dirname $0)
for i in $(find . -name 'build*' -prune -o '(' \
-name '*.hh' -o -name '*.h' -o -name '*.cc' -o -name '*.c' \