diff --git a/.clang-format b/.clang-format index eb3621f5c0..013502522c 100644 --- a/.clang-format +++ b/.clang-format @@ -2,7 +2,7 @@ Language: Cpp BasedOnStyle: WebKit AccessModifierOffset: -4 -AlignAfterOpenBracket: Align +AlignAfterOpenBracket: true AlignConsecutiveAssignments: true #AlignConsecutiveAssignments: Consecutive #AlignConsecutiveBitFields: Consecutive @@ -14,14 +14,14 @@ AlignTrailingComments: true AllowAllArgumentsOnNextLine: true AllowAllConstructorInitializersOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: false -AllowShortBlocksOnASingleLine: true +AllowShortBlocksOnASingleLine: Never AllowShortCaseLabelsOnASingleLine: true -AllowShortFunctionsOnASingleLine: All +AllowShortFunctionsOnASingleLine: InlineOnly AllowShortLambdasOnASingleLine: All AllowShortIfStatementsOnASingleLine: Never AllowShortLoopsOnASingleLine: false -AlwaysBreakAfterDefinitionReturnType: None -AlwaysBreakAfterReturnType: TopLevel +AllowShortNamespacesOnASingleLine: false +BreakAfterReturnType: TopLevelDefinitions AlwaysBreakBeforeMultilineStrings: false AlwaysBreakTemplateDeclarations: MultiLine BinPackArguments: true @@ -83,7 +83,10 @@ IndentWidth: 4 IndentWrappedFunctionNames: false JavaScriptQuotes: Leave JavaScriptWrapImports: true -KeepEmptyLinesAtTheStartOfBlocks: false +KeepEmptyLines: + AtEndOfFile: false + AtStartOfBlock: false + AtStartOfFile: false MacroBlockBegin: '' MacroBlockEnd: '' MaxEmptyLinesToKeep: 3 @@ -92,7 +95,7 @@ ObjCBinPackProtocolList: Auto ObjCBlockIndentWidth: 4 ObjCSpaceAfterProperty: true ObjCSpaceBeforeProtocolList: true -PenaltyBreakAssignment: 40 +PenaltyBreakAssignment: 50 PenaltyBreakBeforeFirstCallParameter: 100 PenaltyBreakComment: 300 PenaltyBreakFirstLessLess: 120 @@ -102,6 +105,8 @@ PenaltyExcessCharacter: 75 PenaltyReturnTypeOnItsOwnLine: 50 PointerAlignment: Left ReflowComments: false +RemoveEmptyLinesInUnwrappedLines: true +SkipMacroDefinitionBody: true SortIncludes: true SortUsingDeclarations: true SpaceAfterCStyleCast: false @@ -113,7 +118,7 @@ SpaceBeforeCtorInitializerColon: true SpaceBeforeInheritanceColon: true SpaceBeforeParens: ControlStatements SpaceBeforeRangeBasedForLoopColon: true -SpaceInEmptyBlock: false +SpaceInEmptyBraces: Never SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 2 SpacesInAngles: false @@ -126,6 +131,8 @@ StatementMacros: - Q_UNUSED - QT_REQUIRE_VERSION TabWidth: 8 +#TemplateNames: +#TypeNames: UseTab: Never #... diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 65c2ffcd18..8a4cf3c142 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -308,7 +308,7 @@ jobs: # the console output). - desc: "clang-format" nametag: clang-format - runner: ubuntu-24.04 + runner: ubuntu-26.04 cxx_std: 17 extra_artifacts: "src/*.*" python_ver: "3.10" @@ -318,8 +318,8 @@ jobs: skip_tests: 1 setenvs: export SKIP_SYSTEM_DEPS_INSTALL=1 SKIP_APT_GET_UPDATE=1 INSTALL_OPENCV=0 QT_VERSION=0 USE_LIBHEIF=0 - EXTRA_DEP_PACKAGES="clang-format-17" - CLANG_FORMAT_EXE=clang-format-17 + CLANG_FORMAT_EXE=clang-format-22 + EXTRA_DEP_PACKAGES="clang-format-22" - desc: latest releases gcc15 C++23 py3.12 avx2 exr3.4 ocio2.4 nametag: linux-latest-releases diff --git a/src/cmake/compiler.cmake b/src/cmake/compiler.cmake index 6ec98ee70e..971830b049 100644 --- a/src/cmake/compiler.cmake +++ b/src/cmake/compiler.cmake @@ -613,7 +613,7 @@ endif () # Note: skip all of this checking, setup, and cmake-format target if this # is being built as a subproject. if (PROJECT_IS_TOP_LEVEL) - set (CLANG_FORMAT_EXE_HINT "" CACHE PATH "clang-format executable's directory (will search if not specified") + set_cache (CLANG_FORMAT_EXE_HINT "" "clang-format executable's directory (will search if not specified") set (CLANG_FORMAT_INCLUDES "src/*.h" "src/*.cpp" "testsuite/*.cpp" "testsuite/*.h" CACHE STRING "Glob patterns to include for clang-format") set (CLANG_FORMAT_EXCLUDES "*pugixml*" "*SHA1*" "*/farmhash.cpp"