clang-format: copy latest and re-format
clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I1617773783af90585a0ff753b6fa548d614f4d09
diff --git a/.clang-format b/.clang-format
index 38daa66..6da79a0 100644
--- a/.clang-format
+++ b/.clang-format
@@ -8,8 +8,10 @@
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
#AlignEscapedNewlines: Left # Unknown to clang-format-4.0
-AlignOperands: true
-AlignTrailingComments: false
+AlignOperands: Align
+AlignTrailingComments:
+ Kind: Always
+ OverEmptyLines: 1
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
@@ -38,6 +40,7 @@
#SplitEmptyFunction: true # Unknown to clang-format-4.0
#SplitEmptyRecord: true # Unknown to clang-format-4.0
#SplitEmptyNamespace: true # Unknown to clang-format-4.0
+BreakAfterAttributes: Never
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
#BreakBeforeInheritanceComma: false # Unknown to clang-format-4.0
@@ -53,6 +56,7 @@
ConstructorInitializerIndentWidth: 8
ContinuationIndentWidth: 8
Cpp11BracedListStyle: false
+DeriveLineEnding: false
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
@@ -66,9 +70,11 @@
#IndentPPDirectives: None # Unknown to clang-format-5.0
IndentWidth: 8
IndentWrappedFunctionNames: false
+InsertNewlineAtEOF: true
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
+LineEnding: LF
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
@@ -79,7 +85,7 @@
ObjCSpaceBeforeProtocolList: true
# Taken from git's rules
-#PenaltyBreakAssignment: 10 # Unknown to clang-format-4.0
+PenaltyBreakAssignment: 10
PenaltyBreakBeforeFirstCallParameter: 30
PenaltyBreakComment: 10
PenaltyBreakFirstLessLess: 0
diff --git a/console-server.c b/console-server.c
index 0a0477d..815431c 100644
--- a/console-server.c
+++ b/console-server.c
@@ -526,10 +526,9 @@
console->pollers[n] = poller;
/* increase pollfds array too */
- console->pollfds =
- reallocarray(console->pollfds,
- (MAX_INTERNAL_POLLFD + console->n_pollers),
- sizeof(*console->pollfds));
+ console->pollfds = reallocarray(
+ console->pollfds, (MAX_INTERNAL_POLLFD + console->n_pollers),
+ sizeof(*console->pollfds));
/* shift the end pollfds up by one */
memcpy(&console->pollfds[n + 1], &console->pollfds[n],
@@ -575,10 +574,9 @@
sizeof(*console->pollfds) *
(MAX_INTERNAL_POLLFD + console->n_pollers - i));
- console->pollfds =
- reallocarray(console->pollfds,
- (MAX_INTERNAL_POLLFD + console->n_pollers),
- sizeof(*console->pollfds));
+ console->pollfds = reallocarray(
+ console->pollfds, (MAX_INTERNAL_POLLFD + console->n_pollers),
+ sizeof(*console->pollfds));
free(poller);
}
diff --git a/test/test-config-parse-logsize.c b/test/test-config-parse-logsize.c
index 7afbd1c..1c64e47 100644
--- a/test/test-config-parse-logsize.c
+++ b/test/test-config-parse-logsize.c
@@ -25,19 +25,19 @@
{ "6M", (6ul << 20), 0 },
{ "4095M", (4095ul << 20), 0 },
{ "2G", (2ul << 30), 0 },
- { "8M\n", (8ul << 20), 0 }, /* Suffix ignored */
+ { "8M\n", (8ul << 20), 0 }, /* Suffix ignored */
{ " 10k", 10ul * 1024ul, 0 }, /* Leading spaces trimmed */
{ "10k ", 10ul * 1024ul, 0 }, /* Trailing spaces trimmed */
{ "\r\t10k \r\t", 10ul * 1024ul, 0 }, /* Spaces trimmed */
- { " 10 kB ", 10ul * 1024ul, 0 }, /* Spaces trimmed */
- { "11G", 0, -1 }, /* Overflow */
- { "4294967296", 0, -1 }, /* Overflow */
- { "4096M", 0, -1 }, /* Overflow */
- { "65535G", 0, -1 }, /* Overflow */
- { "xyz", 0, -1 }, /* Invalid */
- { "000", 0, -1 }, /* Invalid */
- { "0.1", 0, -1 }, /* Invalid */
- { "9T", 0, -1 }, /* Invalid suffix */
+ { " 10 kB ", 10ul * 1024ul, 0 }, /* Spaces trimmed */
+ { "11G", 0, -1 }, /* Overflow */
+ { "4294967296", 0, -1 }, /* Overflow */
+ { "4096M", 0, -1 }, /* Overflow */
+ { "65535G", 0, -1 }, /* Overflow */
+ { "xyz", 0, -1 }, /* Invalid */
+ { "000", 0, -1 }, /* Invalid */
+ { "0.1", 0, -1 }, /* Invalid */
+ { "9T", 0, -1 }, /* Invalid suffix */
};
const size_t num_tests =
sizeof(test_data) / sizeof(struct test_parse_size_unit);