Merge pull request #2486 from nghttp2/bump-clang-format

Bump clang-format to 19
This commit is contained in:
Tatsuhiro Tsujikawa
2025-08-23 18:21:03 +09:00
committed by GitHub
8 changed files with 46 additions and 21 deletions

View File

@@ -35,7 +35,29 @@ AlignConsecutiveShortCaseStatements:
Enabled: false Enabled: false
AcrossEmptyLines: false AcrossEmptyLines: false
AcrossComments: false AcrossComments: false
AlignCaseArrows: false
AlignCaseColons: false AlignCaseColons: false
AlignConsecutiveTableGenBreakingDAGArgColons:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveTableGenCondOperatorColons:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignConsecutiveTableGenDefinitionColons:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
AlignFunctionPointers: false
PadOperators: false
AlignEscapedNewlines: Right AlignEscapedNewlines: Right
AlignOperands: Align AlignOperands: Align
AlignTrailingComments: AlignTrailingComments:
@@ -45,6 +67,7 @@ AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: true
AllowBreakBeforeNoexceptSpecifier: Never AllowBreakBeforeNoexceptSpecifier: Never
AllowShortBlocksOnASingleLine: Never AllowShortBlocksOnASingleLine: Never
AllowShortCaseExpressionOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: false AllowShortCaseLabelsOnASingleLine: false
AllowShortCompoundRequirementOnASingleLine: true AllowShortCompoundRequirementOnASingleLine: true
AllowShortEnumsOnASingleLine: true AllowShortEnumsOnASingleLine: true
@@ -53,9 +76,7 @@ AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
AttributeMacros: AttributeMacros:
- __capability - __capability
BinPackArguments: true BinPackArguments: true
@@ -83,6 +104,7 @@ BraceWrapping:
BreakAdjacentStringLiterals: true BreakAdjacentStringLiterals: true
BreakAfterAttributes: Leave BreakAfterAttributes: Leave
BreakAfterJavaFieldAnnotations: false BreakAfterJavaFieldAnnotations: false
BreakAfterReturnType: None
BreakArrays: true BreakArrays: true
BreakBeforeBinaryOperators: None BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: Always BreakBeforeConceptDeclarations: Always
@@ -90,8 +112,10 @@ BreakBeforeBraces: Attach
BreakBeforeInlineASMColon: OnlyMultiline BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeTernaryOperators: true BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon BreakConstructorInitializers: BeforeColon
BreakFunctionDefinitionParameters: false
BreakInheritanceList: BeforeColon BreakInheritanceList: BeforeColon
BreakStringLiterals: true BreakStringLiterals: true
BreakTemplateDeclarations: MultiLine
ColumnLimit: 80 ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:' CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false CompactNamespaces: false
@@ -147,12 +171,15 @@ IntegerLiteralSeparator:
HexMinDigits: 0 HexMinDigits: 0
JavaScriptQuotes: Leave JavaScriptQuotes: Leave
JavaScriptWrapImports: true JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false KeepEmptyLines:
KeepEmptyLinesAtEOF: false AtEndOfFile: false
AtStartOfBlock: false
AtStartOfFile: true
LambdaBodyIndentation: Signature LambdaBodyIndentation: Signature
LineEnding: DeriveLF LineEnding: DeriveLF
MacroBlockBegin: '' MacroBlockBegin: ''
MacroBlockEnd: '' MacroBlockEnd: ''
MainIncludeChar: Quote
MaxEmptyLinesToKeep: 1 MaxEmptyLinesToKeep: 1
NamespaceIndentation: None NamespaceIndentation: None
ObjCBinPackProtocolList: Auto ObjCBinPackProtocolList: Auto
@@ -221,6 +248,7 @@ SpacesInLineCommentPrefix:
Maximum: -1 Maximum: -1
SpacesInParens: Never SpacesInParens: Never
SpacesInParensOptions: SpacesInParensOptions:
ExceptDoubleParentheses: false
InCStyleCasts: false InCStyleCasts: false
InConditionalStatements: false InConditionalStatements: false
InEmptyParentheses: false InEmptyParentheses: false
@@ -235,6 +263,7 @@ StatementMacros:
- munit_void_test_decl - munit_void_test_decl
- nghttp2_max_def - nghttp2_max_def
- nghttp2_min_def - nghttp2_min_def
TableGenBreakInsideDAGArg: DontBreak
TabWidth: 8 TabWidth: 8
UseTab: Never UseTab: Never
VerilogBreakBetweenInstancePorts: true VerilogBreakBetweenInstancePorts: true

View File

@@ -26,7 +26,7 @@ Coding style
We use clang-format to format source code consistently. The We use clang-format to format source code consistently. The
clang-format configuration file .clang-format is located at the root clang-format configuration file .clang-format is located at the root
directory. Since clang-format produces slightly different results directory. Since clang-format produces slightly different results
between versions, we currently use clang-format-18. between versions, we currently use clang-format-19.
To detect any violation to the coding style, we recommend to setup git To detect any violation to the coding style, we recommend to setup git
pre-commit hook to check coding style of the changes you introduced. pre-commit hook to check coding style of the changes you introduced.

View File

@@ -2948,7 +2948,7 @@ int main(int argc, char **argv) {
<< std::endl; << std::endl;
} }
struct sigaction act {}; struct sigaction act{};
act.sa_handler = SIG_IGN; act.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &act, nullptr); sigaction(SIGPIPE, &act, nullptr);

View File

@@ -2427,7 +2427,7 @@ int run(char **uris, int n) {
int failures = 0; int failures = 0;
int data_fd = -1; int data_fd = -1;
nghttp2_data_provider2 data_prd; nghttp2_data_provider2 data_prd;
struct stat data_stat {}; struct stat data_stat{};
if (!config.datafile.empty()) { if (!config.datafile.empty()) {
if (config.datafile == "-") { if (config.datafile == "-") {
@@ -3051,7 +3051,7 @@ int main(int argc, char **argv) {
static_cast<size_t>(config.encoder_header_table_size)); static_cast<size_t>(config.encoder_header_table_size));
} }
struct sigaction act {}; struct sigaction act{};
act.sa_handler = SIG_IGN; act.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &act, nullptr); sigaction(SIGPIPE, &act, nullptr);
reset_timer(); reset_timer();

View File

@@ -479,7 +479,7 @@ int main(int argc, char **argv) {
set_color_output(color || isatty(fileno(stdout))); set_color_output(color || isatty(fileno(stdout)));
struct sigaction act {}; struct sigaction act{};
act.sa_handler = SIG_IGN; act.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &act, nullptr); sigaction(SIGPIPE, &act, nullptr);

View File

@@ -193,7 +193,7 @@ read_tls_ticket_key_file(const std::vector<std::string_view> &files,
size_t i = 0; size_t i = 0;
for (auto &file : files) { for (auto &file : files) {
struct stat fst {}; struct stat fst{};
if (stat(file.data(), &fst) == -1) { if (stat(file.data(), &fst) == -1) {
auto error = errno; auto error = errno;

View File

@@ -95,7 +95,7 @@ int shrpx_signal_set(sigset_t *set) {
namespace { namespace {
template <typename Signals> template <typename Signals>
int signal_set_handler(void (*handler)(int), Signals &&sigs) { int signal_set_handler(void (*handler)(int), Signals &&sigs) {
struct sigaction act {}; struct sigaction act{};
act.sa_handler = handler; act.sa_handler = handler;
sigemptyset(&act.sa_mask); sigemptyset(&act.sa_mask);
int rv; int rv;

View File

@@ -347,22 +347,18 @@ template <typename T, std::size_t N>
[[nodiscard]] std::span< [[nodiscard]] std::span<
const uint8_t, N == std::dynamic_extent ? std::dynamic_extent : N * sizeof(T)> const uint8_t, N == std::dynamic_extent ? std::dynamic_extent : N * sizeof(T)>
as_uint8_span(std::span<T, N> s) noexcept { as_uint8_span(std::span<T, N> s) noexcept {
return std::span < const uint8_t, return std::span<const uint8_t, N == std::dynamic_extent ? std::dynamic_extent
N == std::dynamic_extent : N * sizeof(T)>{
? std::dynamic_extent reinterpret_cast<const uint8_t *>(s.data()), s.size_bytes()};
: N * sizeof(T) >
{reinterpret_cast<const uint8_t *>(s.data()), s.size_bytes()};
} }
template <typename T, std::size_t N> template <typename T, std::size_t N>
[[nodiscard]] std::span<uint8_t, N == std::dynamic_extent ? std::dynamic_extent [[nodiscard]] std::span<uint8_t, N == std::dynamic_extent ? std::dynamic_extent
: N * sizeof(T)> : N * sizeof(T)>
as_writable_uint8_span(std::span<T, N> s) noexcept { as_writable_uint8_span(std::span<T, N> s) noexcept {
return std::span < uint8_t, return std::span<uint8_t, N == std::dynamic_extent ? std::dynamic_extent
N == std::dynamic_extent : N * sizeof(T)>{
? std::dynamic_extent reinterpret_cast<uint8_t *>(s.data()), s.size_bytes()};
: N * sizeof(T) >
{reinterpret_cast<uint8_t *>(s.data()), s.size_bytes()};
} }
template <typename R> template <typename R>