Path: blob/main/contrib/jemalloc/scripts/check-formatting.sh
39492 views
#!/bin/bash12# The files that need to be properly formatted. We'll grow this incrementally3# until it includes all the jemalloc source files (as we convert things over),4# and then just replace it with5# find -name '*.c' -o -name '*.h' -o -name '*.cpp6FILES=(7)89if command -v clang-format &> /dev/null; then10CLANG_FORMAT="clang-format"11elif command -v clang-format-8 &> /dev/null; then12CLANG_FORMAT="clang-format-8"13else14echo "Couldn't find clang-format."15fi1617if ! $CLANG_FORMAT -version | grep "version 8\." &> /dev/null; then18echo "clang-format is the wrong version."19exit 120fi2122for file in ${FILES[@]}; do23if ! cmp --silent $file <($CLANG_FORMAT $file) &> /dev/null; then24echo "Error: $file is not clang-formatted"25exit 126fi27done282930