Add and use .clang-format file.

This commit is contained in:
Markus F.X.J. Oberhumer 2021-01-04 19:07:17 +01:00
parent fdc68812c5
commit 8236276a90
2 changed files with 15 additions and 13 deletions

12
.clang-format Normal file
View File

@ -0,0 +1,12 @@
# for clang-format-10.0.1
---
BasedOnStyle: LLVM
AccessModifierOffset: -4
#AlignConsecutiveAssignments: true
AlwaysBreakTemplateDeclarations: true
ColumnLimit: 100
IndentWidth: 4
SortIncludes: false
SpaceAfterCStyleCast: true
Standard: Cpp03
...

View File

@ -14,22 +14,12 @@ CLANG_FORMAT="$HOME/bin/bin-upx/clang-format-10.0.1"
fi fi
if [[ ! -f $CLANG_FORMAT ]]; then if [[ ! -f $CLANG_FORMAT ]]; then
echo "ERROR: $0: cannot find clang-format-10.0.1" echo "ERROR: $0: cannot find clang-format-10.0.1"
echo "ERROR: $0: please visit https://github.com/upx/upx-stubtools/releases" echo "ERROR: $0: please visit https://github.com/upx/upx-stubtools"
exit 1 exit 1
fi fi
s='Language: Cpp, BasedOnStyle: LLVM, ' # NOTE: we use .clang-format config from upx.git/.clang-format
s="$s"' AccessModifierOffset: -4, '
#s="$s"' AllowShortFunctionsOnASingleLine: None, '
s="$s"' AlwaysBreakTemplateDeclarations: true, '
s="$s"' ColumnLimit: 100, '
####s="$s"' FixNamespaceComments: false, ' # added in llvm-5.0
s="$s"' IndentWidth: 4, '
s="$s"' SortIncludes: false, ' # added in llvm-3.8
s="$s"' SpaceAfterCStyleCast: true, ' # added in llvm-3.6
s="$s"' Standard: Cpp03, '
CLANG_FORMAT_STYLE='-style={'"$s"' }'
#echo $CLANG_FORMAT #echo $CLANG_FORMAT
exec "$CLANG_FORMAT" "$CLANG_FORMAT_STYLE" "$@" exec "$CLANG_FORMAT" -style=file "$@"
exit 1 exit 1