Skip to content

Commit

Permalink
Fixed alignment & line width in formatting script
Browse files Browse the repository at this point in the history
Clang-fromat default linux configuration is extended with following:
  AlignConsecutiveMacros: true
  AlignConsecutiveBitFields: true
In addition, column limit set to 100 as it is default in Linux kernel:
  ColumnLimit: 100

All changes above are done with sed and not bulletproof.

In addition, all extra parameters to script are now passed to
clang-format command line
  • Loading branch information
klogg committed May 9, 2024
1 parent d5e6923 commit 81a43f7
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions scripts/clang-format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ if [ ! -f .clang-format ]; then
wget https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/.clang-format
fi

# TODO: Add following:
# AlignConsecutiveMacros: true
# AlignConsecutiveBitFields: true
sed -i '/AlignConsecutiveAssignments/i AlignConsecutiveMacros: true\nAlignConsecutiveBitFields: true' .clang-format
sed -i 's/\(ColumnLimit: \)[0-9]*/\1100/g' .clang-format

for file in {,bridge/}*.[ch]
do
if [[ $file == $mod_pattern ]]; then
continue
fi
clang-format -i "$file"
clang-format $@ -i "$file"
done

0 comments on commit 81a43f7

Please sign in to comment.