diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000000..7e2dbc5094 --- /dev/null +++ b/.clang-format @@ -0,0 +1,50 @@ +BasedOnStyle: LLVM +IndentWidth: 8 +UseTab: Always +BreakBeforeBraces: Linux +AllowShortIfStatementsOnASingleLine: false +IndentCaseLabels: false +AlwaysBreakAfterReturnType: All +Cpp11BracedListStyle: false +ColumnLimit: 80 +AlignAfterOpenBracket: Align +AlignConsecutiveDeclarations: true +AlwaysBreakBeforeMultilineStrings: false +BreakBeforeBinaryOperators: None +BreakBeforeTernaryOperators: true +AlignEscapedNewlines: Left +DerivePointerAlignment: false +PointerAlignment: Right +IncludeBlocks: Regroup +IncludeCategories: + - Regex: '^' + Priority: 1 + - Regex: '".*"' + Priority: 9 +KeepEmptyLinesAtTheStartOfBlocks: false + +# Taken from git's rules +PenaltyBreakAssignment: 10 +# PenaltyBreakBeforeFirstCallParameter: 30 +PenaltyBreakComment: 10 +PenaltyBreakFirstLessLess: 0 +PenaltyBreakString: 10 +PenaltyExcessCharacter: 100 + +Standard: Cpp11 + +ContinuationIndentWidth: 8 diff --git a/util/copyrights b/util/copyrights index bc7ffbd33f..9ac4f64dd0 100644 --- a/util/copyrights +++ b/util/copyrights @@ -1,3 +1,4 @@ +./.clang-format X 2019,2020 ./.gitlab-ci.yml X 2018,2019,2020 ./.uncrustify.cfg X 2018,2019,2020 ./CHANGES X 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 diff --git a/util/update_copyrights b/util/update_copyrights index fd86d0026b..5ba9209876 100644 --- a/util/update_copyrights +++ b/util/update_copyrights @@ -521,10 +521,10 @@ foreach $file (keys %file_types) { # Process leading white space. # Remove 1-7 spaces followed by a tab into a single # tab if at start of line or proceeded by tabs. - s/^(\t*) {1,7}\t/$1\t/ while (/^\t* {1,7}\t/); + # s/^(\t*) {1,7}\t/$1\t/ while (/^\t* {1,7}\t/); # Convert 8 spaces into tabs if at start of line # or preceeded by tabs. - s/^(\t*) {8}/$1\t/ while (/^\t* {8}/); + # s/^(\t*) {8}/$1\t/ while (/^\t* {8}/); # Remove trailing white space. s/[ \t]*$//; $body = "$body$_";