mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 22:35:33 +00:00
criu: introduce clang-format to format source code
This is another attempt to introduce a tool to format CRIU's source code. This time it is based on clang-format. The .clang-format file is taken from the linux kernel git tree (5.13). I removed all comments from lines which state that it requires at least clang-format 4 or 5. For this resulting file at least clang-format 11 is required. See scripts/fetch-clang-format.sh for all the changes done to the Linux kernel .clang-format file. Acked-by: Mike Rapoport <rppt@linux.ibm.com> Signed-off-by: Adrian Reber <areber@redhat.com>
This commit is contained in:
committed by
Andrei Vagin
parent
cc2317ea48
commit
1e26f170ca
15
scripts/fetch-clang-format.sh
Executable file
15
scripts/fetch-clang-format.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This script fetches .clang-format from the Linux kernel
|
||||
# and slightly adapts it for CRIU.
|
||||
|
||||
URL="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/.clang-format?h=v5.13"
|
||||
|
||||
curl -s "${URL}" | sed -e "
|
||||
s,^\( *\)#\([A-Z]\),\1\2,g;
|
||||
s,ControlStatements,ControlStatementsExceptForEachMacros,g;
|
||||
s,ColumnLimit: 80,ColumnLimit: 120,g;
|
||||
s,Intended for clang-format >= 4,Intended for clang-format >= 11,g;
|
||||
s,ForEachMacros:,ForEachMacros:\n - 'for_each_pstree_item',g;
|
||||
s,\(AlignTrailingComments:.*\)$,\1\nAlignConsecutiveMacros: true,g;
|
||||
" > .clang-format
|
Reference in New Issue
Block a user