mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:54:58 +00:00
Meta: Switch to clang-format-16 as the standard formatter
This includes a few new options to the .clang-format configuration file to A) adhere to option changes within clang-format 16 (namely the option AlignTrailingComments), and B) enforce existing style guide rules with new clang-format rules.
This commit is contained in:
parent
1e733b1cf4
commit
388d455575
12 changed files with 31 additions and 26 deletions
|
@ -28,21 +28,21 @@ fi
|
|||
if (( ${#files[@]} )); then
|
||||
TOOLCHAIN_DIR=Toolchain/Local/clang/bin
|
||||
CLANG_FORMAT=false
|
||||
if command -v clang-format-15 >/dev/null 2>&1 ; then
|
||||
CLANG_FORMAT=clang-format-15
|
||||
elif command -v brew >/dev/null 2>&1 && command -v "$(brew --prefix llvm@15)"/bin/clang-format >/dev/null 2>&1 ; then
|
||||
CLANG_FORMAT="$(brew --prefix llvm@15)"/bin/clang-format
|
||||
elif command -v $TOOLCHAIN_DIR/clang-format >/dev/null 2>&1 && $TOOLCHAIN_DIR/clang-format --version | grep -qF ' 15.' ; then
|
||||
if command -v clang-format-16 >/dev/null 2>&1 ; then
|
||||
CLANG_FORMAT=clang-format-16
|
||||
elif command -v brew >/dev/null 2>&1 && command -v "$(brew --prefix llvm@16)"/bin/clang-format >/dev/null 2>&1 ; then
|
||||
CLANG_FORMAT="$(brew --prefix llvm@16)"/bin/clang-format
|
||||
elif command -v $TOOLCHAIN_DIR/clang-format >/dev/null 2>&1 && $TOOLCHAIN_DIR/clang-format --version | grep -qF ' 16.' ; then
|
||||
CLANG_FORMAT=$TOOLCHAIN_DIR/clang-format
|
||||
elif command -v clang-format >/dev/null 2>&1 ; then
|
||||
CLANG_FORMAT=clang-format
|
||||
if ! "${CLANG_FORMAT}" --version | awk '{ if (substr($NF, 1, index($NF, ".") - 1) < 15) exit 1; }'; then
|
||||
echo "You are using '$("${CLANG_FORMAT}" --version)', which appears to not be clang-format 15 or later."
|
||||
if ! "${CLANG_FORMAT}" --version | awk '{ if (substr($NF, 1, index($NF, ".") - 1) < 16) exit 1; }'; then
|
||||
echo "You are using '$("${CLANG_FORMAT}" --version)', which appears to not be clang-format 16 or later."
|
||||
echo "It is very likely that the resulting changes are not what you wanted."
|
||||
fi
|
||||
else
|
||||
echo "clang-format-15 is not available, but C or C++ files need linting! Either skip this script, or install clang-format-15."
|
||||
echo "(If you install a package 'clang-format', please make sure it's version 15 or later.)"
|
||||
echo "clang-format-16 is not available, but C or C++ files need linting! Either skip this script, or install clang-format-16."
|
||||
echo "(If you install a package 'clang-format', please make sure it's version 16 or later.)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue