File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ CLANG_FORMAT_COMMAND=${1:- clang-format-19}
4+
5+ TLIB_DIR=" $( dirname $0 ) "
6+
7+ TEMP_FILE=$( mktemp)
8+
9+ NON_CONFORMING_FILES=0
10+ for file in $( find $TLIB_DIR -name ' *.c' -o -name ' *.h' | grep -v softfloat-3) ; do
11+ echo " Checking $file "
12+ FORMATTING_OUTPUT=$( ${CLANG_FORMAT_COMMAND} --style=file --dry-run --Werror --verbose $file 2> ${TEMP_FILE} )
13+ COMMAND_EXIT_CODE=$?
14+ OUTPUT_ERRORS=$( grep error ${TEMP_FILE} | wc -l)
15+ if [ ${OUTPUT_ERRORS} -ne 0 ] || [ ${COMMAND_EXIT_CODE} -ne 0 ] ; then
16+ if [ ${COMMAND_EXIT_CODE} -ne 0 ]; then
17+ echo " Clang-format exited with code ${COMMAND_EXIT_CODE} !!"
18+ fi
19+ cat ${TEMP_FILE}
20+ (( NON_CONFORMING_FILES++ ))
21+ fi
22+ done
23+
24+ if [ ${NON_CONFORMING_FILES} -ne 0 ]; then
25+ echo " Clang-format found non-conforming files: ${NON_CONFORMING_FILES} " >&2
26+ exit 1
27+ fi
You can’t perform that action at this time.
0 commit comments