diff --git a/.clang-format b/.clang-format index 3b396b9..3d974a5 100644 --- a/.clang-format +++ b/.clang-format @@ -3,7 +3,7 @@ BasedOnStyle: LLVM --- Language: Cpp -BasedOnStyle: LLVM +#BasedOnStyle: LLVM AccessModifierOffset: -4 AlignAfterOpenBracket: Align AlignArrayOfStructures: Right @@ -12,93 +12,138 @@ AlignConsecutiveAssignments: AcrossEmptyLines: false AcrossComments: false AlignCompound: false + AlignFunctionDeclarations: false + AlignFunctionPointers: false PadOperators: true AlignConsecutiveBitFields: Enabled: false AcrossEmptyLines: false AcrossComments: false AlignCompound: false + AlignFunctionDeclarations: false + AlignFunctionPointers: false PadOperators: false AlignConsecutiveDeclarations: Enabled: false AcrossEmptyLines: false AcrossComments: false AlignCompound: false + AlignFunctionDeclarations: true + AlignFunctionPointers: false PadOperators: false AlignConsecutiveMacros: Enabled: true AcrossEmptyLines: false AcrossComments: true AlignCompound: false + AlignFunctionDeclarations: false + AlignFunctionPointers: false + PadOperators: false +AlignConsecutiveShortCaseStatements: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCaseArrows: false + AlignCaseColons: false +AlignConsecutiveTableGenBreakingDAGArgColons: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionDeclarations: false + AlignFunctionPointers: false + PadOperators: false +AlignConsecutiveTableGenCondOperatorColons: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionDeclarations: false + AlignFunctionPointers: false + PadOperators: false +AlignConsecutiveTableGenDefinitionColons: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionDeclarations: false + AlignFunctionPointers: false PadOperators: false AlignEscapedNewlines: Right -AlignOperands: AlignAfterOperator -AlignTrailingComments: true +AlignOperands: Align +AlignTrailingComments: + Kind: Always + OverEmptyLines: 1 AllowAllArgumentsOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: true -AllowShortEnumsOnASingleLine: true +AllowBreakBeforeNoexceptSpecifier: Never AllowShortBlocksOnASingleLine: Never +AllowShortCaseExpressionOnASingleLine: true AllowShortCaseLabelsOnASingleLine: false +AllowShortCompoundRequirementOnASingleLine: true +AllowShortEnumsOnASingleLine: false AllowShortFunctionsOnASingleLine: None -AllowShortLambdasOnASingleLine: Inline AllowShortIfStatementsOnASingleLine: Never +AllowShortLambdasOnASingleLine: Inline AllowShortLoopsOnASingleLine: false +AllowShortNamespacesOnASingleLine: false AlwaysBreakAfterDefinitionReturnType: None -AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: false -AlwaysBreakTemplateDeclarations: Yes AttributeMacros: - __capability - DPLX_ATTR_FORCE_INLINE - DPLX_ATTR_NO_UNIQUE_ADDRESS + - DPLX_ATTR_DP_DEPRECATED + - DPLX_ATTR_DP_DEPRECATED_ BinPackArguments: true -BinPackParameters: false +BinPackParameters: OnePerLine +BitFieldColonSpacing: Both BraceWrapping: AfterCaseLabel: false - AfterClass: false + AfterClass: true AfterControlStatement: Always - AfterEnum: false - AfterFunction: false - AfterNamespace: false + AfterEnum: true + AfterExternBlock: true + AfterFunction: true + AfterNamespace: true AfterObjCDeclaration: false - AfterStruct: false - AfterUnion: false - AfterExternBlock: false - BeforeCatch: false - BeforeElse: false + AfterStruct: true + AfterUnion: true + BeforeCatch: true + BeforeElse: true BeforeLambdaBody: false - BeforeWhile: false + BeforeWhile: true IndentBraces: false SplitEmptyFunction: true SplitEmptyRecord: true SplitEmptyNamespace: true +BreakAdjacentStringLiterals: true +BreakAfterAttributes: Leave +BreakAfterJavaFieldAnnotations: true +BreakAfterReturnType: None +BreakArrays: false BreakBeforeBinaryOperators: All BreakBeforeConceptDeclarations: Always -BreakBeforeBraces: Allman -BreakBeforeInheritanceComma: false -BreakInheritanceList: BeforeComma +BreakBeforeBraces: Custom +BreakBeforeInlineASMColon: OnlyMultiline BreakBeforeTernaryOperators: true -BreakConstructorInitializersBeforeComma: false +BreakBinaryOperations: Never BreakConstructorInitializers: BeforeComma -BreakAfterJavaFieldAnnotations: false +BreakFunctionDefinitionParameters: false +BreakInheritanceList: BeforeComma BreakStringLiterals: true +BreakTemplateDeclarations: Yes ColumnLimit: 80 CommentPragmas: '^ IWYU pragma:' -QualifierAlignment: Right CompactNamespaces: false ConstructorInitializerIndentWidth: 4 ContinuationIndentWidth: 8 Cpp11BracedListStyle: true -DeriveLineEnding: true DerivePointerAlignment: false DisableFormat: false EmptyLineAfterAccessModifier: Never EmptyLineBeforeAccessModifier: LogicalBlock ExperimentalAutoDetectBinPacking: false -PackConstructorInitializers: Never -# deprecated, replaced by PackConstructorInitializers -#ConstructorInitializerAllOnOneLineOrOnePerLine: true -#AllowAllConstructorInitializersOnNextLine: false FixNamespaceComments: true ForEachMacros: - foreach @@ -109,41 +154,62 @@ IncludeBlocks: Regroup IncludeCategories: - Regex: '^<[[:alpha:]_]*>$' Priority: 2 + SortPriority: 0 CaseSensitive: false - Regex: '^ boost-*, + -boost-use-ranges, bugprone-*, -bugprone-easily-swappable-parameters, + -bugprone-forward-declaration-namespace, clang-analyzer-*, + -clang-analyzer-core.uninitialized.Assign, + -clang-analyzer-optin.core.EnumCastOutOfRange, clang-diagnostic-*, cppcoreguidelines-*, -cppcoreguidelines-avoid-c-arrays, + -cppcoreguidelines-avoid-do-while, + -cppcoreguidelines-missing-std-forward, + -cppcoreguidelines-rvalue-reference-param-not-moved, -cppcoreguidelines-special-member-functions, + -cppcoreguidelines-use-default-member-init, modernize-*, -modernize-avoid-c-arrays, + -cppcoreguidelines-avoid-do-while, -modernize-use-default-member-init, + -modernize-use-designated-initializers, + -modernize-use-ranges, performance-*, + -performance-enum-size, portability-*, + -portability-template-virtual-member-function, readability-*, -readability-identifier-length, -readability-magic-numbers, -readability-named-parameter, + -readability-redundant-inline-specifier, -readability-redundant-member-init, -readability-static-accessed-through-instance WarningsAsErrors: true diff --git a/.copier-answers.yml b/.copier-answers.yml index 1198b65..73bf49a 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: v0.3.2 +_commit: v0.4.0 _src_path: gh:deeplex/copier-cpp email: henrik@gassmann.onl full_name: Henrik Steffen Gaßmann diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 943b21f..e328bd5 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,21 +1,37 @@ -// For format details, see https://aka.ms/devcontainer.json. For config options, see the -// README at: https://github.com/devcontainers/templates/tree/main/src/cpp { - "name": "C++", - "image": "ghcr.io/deeplex/devcontainer-cpp:ubuntu-22.04", + "name": "Deeplex | C++", + "image": "ghcr.io/deeplex/devcontainer-cpp:ubuntu-24.04", "customizations": { "vscode": { "extensions": [ + // general editor utility "EditorConfig.EditorConfig", + // GitHub integration "github.vscode-github-actions", + "GitHub.vscode-pull-request-github", + // C++ + "llvm-vs-code-extensions.vscode-clangd", + "ms-vscode.cmake-tools", + // sphinx "lextudio.restructuredtext", "ms-python.python", - "ms-vscode.cpptools", - "ms-vscode.cmake-tools", "trond-snekvik.simple-rst", - "twxs.cmake", ] } }, + "features": { + "ghcr.io/devcontainers/features/common-utils:2": { + "installZsh": true, + "installOhMyZsh": true, + "installOhMyZshConfig": true, + "upgradePackages": true, + "username": "vscode" + }, + "ghcr.io/devcontainers/features/python:1": { + "version": "os-provided", + "installTools": true, + "toolsToInstall": "copier,pipenv" + } + }, "postCreateCommand": "cd ${containerWorkspaceFolder}/docs && pipenv sync --dev", } \ No newline at end of file diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 0000000..7075bc2 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,2 @@ +# style: reformat sources with clang-format-20 +1ea3a75242d244116a138b598d44e707c789bbf4 diff --git a/.github/workflows/cpp-ci.yml b/.github/workflows/cpp-ci.yml index 682e99a..bc48de3 100644 --- a/.github/workflows/cpp-ci.yml +++ b/.github/workflows/cpp-ci.yml @@ -14,36 +14,38 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-13, ubuntu-22.04, windows-2022] + os: [ubuntu-24.04, windows-2022] compiler: [gcc, clang, msvc] exclude: - - os: macos-13 - compiler: msvc - - os: ubuntu-22.04 + - os: ubuntu-24.04 compiler: msvc - os: windows-2022 compiler: gcc include: - os: macos-13 + compiler: gcc triplet: x64-macos - - os: macos-13 + - os: macos-15 compiler: clang - triplet: x64-macos + triplet: arm64-macos install: | - HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install llvm@16 - - os: ubuntu-22.04 + HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install llvm@19 + - os: ubuntu-24.04 triplet: x64-linux - - os: ubuntu-22.04 + - os: ubuntu-24.04 triplet: x64-linux compiler: clang install: | sudo cp tools/llvm-snapshot.gpg.key.asc /etc/apt/trusted.gpg.d/llvm-snapshot.asc - sudo add-apt-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main" + sudo add-apt-repository "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-19 main" sudo apt-get -qq update - sudo apt-get -qq -y install clang-16 + sudo apt-get -qq -y install clang-19 - os: windows-2022 triplet: x64-windows + permissions: + actions: read + env: CTEST_OUTPUT_ON_FAILURE: "1" @@ -56,69 +58,81 @@ jobs: - uses: lukka/get-cmake@latest with: - cmakeVersion: 3.22.6 + cmakeVersion: 3.31.7 + + - name: Restore vcpkg cache + id: vcpkg-cache + uses: TAServers/vcpkg-cache@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + prefix: vcpkg/${{ matrix.triplet }}-${{ matrix.compiler }}/ - name: Initialize vcpkg - uses: lukka/run-vcpkg@v11 + uses: lukka/run-vcpkg@b3dd708d38df5c856fe1c18dc0d59ab771f93921 with: vcpkgDirectory: ${{ github.workspace }}/build/vcpkg - vcpkgGitCommitId: a42af01b72c28a8e1d7b48107b33e4f286a55ef6 - - name: Build ${{ matrix.triplet }}-${{ matrix.compiler }} preset + - name: Build ${{ matrix.triplet }}-${{ matrix.compiler }}-ci preset uses: lukka/run-cmake@v10 with: - configurePreset: ${{ matrix.triplet }}-${{ matrix.compiler }} - buildPreset: ${{ matrix.triplet }}-${{ matrix.compiler }} - testPreset: ${{ matrix.triplet }}-${{ matrix.compiler }} + configurePreset: ${{ matrix.triplet }}-${{ matrix.compiler }}-ci + buildPreset: ${{ matrix.triplet }}-${{ matrix.compiler }}-ci + testPreset: ${{ matrix.triplet }}-${{ matrix.compiler }}-ci env: CC: '' CXX: '' + VCPKG_BINARY_SOURCES: "clear;files,${{ steps.vcpkg-cache.outputs.path }},readwrite" - - name: Build ${{ matrix.triplet }}-${{ matrix.compiler }}-release preset + - name: Build ${{ matrix.triplet }}-${{ matrix.compiler }}-ci-release preset uses: lukka/run-cmake@v10 with: - configurePreset: ${{ matrix.triplet }}-${{ matrix.compiler }} - buildPreset: ${{ matrix.triplet }}-${{ matrix.compiler }}-release - testPreset: ${{ matrix.triplet }}-${{ matrix.compiler }}-release + configurePreset: ${{ matrix.triplet }}-${{ matrix.compiler }}-ci + buildPreset: ${{ matrix.triplet }}-${{ matrix.compiler }}-ci-release + testPreset: ${{ matrix.triplet }}-${{ matrix.compiler }}-ci-release env: CC: '' CXX: '' - - - name: Prevent uploading a corrupted vcpkg cache - if: ${{ failure() || cancelled() }} - run: | - echo "RUNVCPKG_NO_CACHE=1" >> $GITHUB_ENV - shell: bash - + VCPKG_BINARY_SOURCES: "clear;files,${{ steps.vcpkg-cache.outputs.path }},readwrite" check-format: name: clang-tidy & clang-format - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 + + permissions: + actions: read steps: - uses: actions/checkout@v3 - - name: "Install clang-tools-16" + - name: "Install clang-tools-20" run: | sudo cp ${{ github.workspace }}/tools/llvm-snapshot.gpg.key.asc /etc/apt/trusted.gpg.d/llvm-snapshot.asc - sudo add-apt-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main" + sudo add-apt-repository "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-20 main" sudo apt-get -qq update - sudo apt-get -qq -y install clang-16 clang-tidy-16 clang-format-16 + sudo apt-get -qq -y install clang-20 clang-tidy-20 clang-format-20 - uses: lukka/get-cmake@latest with: - cmakeVersion: 3.22.6 + cmakeVersion: 3.31.7 + + - name: Restore vcpkg cache + id: vcpkg-cache + uses: TAServers/vcpkg-cache@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + prefix: vcpkg/lint/ - name: Initialize vcpkg - uses: lukka/run-vcpkg@v11 + uses: lukka/run-vcpkg@b3dd708d38df5c856fe1c18dc0d59ab771f93921 with: vcpkgDirectory: ${{ github.workspace }}/../vcpkg - vcpkgGitCommitId: a42af01b72c28a8e1d7b48107b33e4f286a55ef6 - - name: Configure x64-linux-clang preset + - name: Configure x64-linux-ci-lint preset uses: lukka/run-cmake@v10 with: configurePreset: x64-linux-ci-lint + env: + VCPKG_BINARY_SOURCES: "clear;files,${{ steps.vcpkg-cache.outputs.path }},readwrite" - uses: cpp-linter/cpp-linter-action@v2 name: Lint with clang-format and clang-tidy @@ -126,7 +140,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - version: 16.0.6 + version: 20 style: file # use .clang-format settings tidy-checks: '' # use .clang-tidy settings extensions: cpp,hpp @@ -137,8 +151,3 @@ jobs: - name: Fail if issues have been raised if: steps.linter.outputs.checks-failed > 0 run: exit 1 - - - if: ${{ failure() || cancelled() }} - run: | - echo "RUNVCPKG_NO_CACHE=1" >> $GITHUB_ENV - shell: bash diff --git a/.gitignore b/.gitignore index 03d47e0..e5481f2 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,5 @@ build/ /.idea /cmake-build-debug /cmake-build-release +# cache directory used eg by clangd +.cache diff --git a/.vscode/extensions.json b/.vscode/extensions.json index d61d539..7bbe9cf 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,12 +1,16 @@ { "recommendations": [ + // general editor utility "EditorConfig.EditorConfig", + // GitHub integration "github.vscode-github-actions", + "GitHub.vscode-pull-request-github", + // C++ + "llvm-vs-code-extensions.vscode-clangd", + "ms-vscode.cmake-tools", + // sphinx "lextudio.restructuredtext", "ms-python.python", - "ms-vscode.cpptools-extension-pack", - "ms-vscode.cmake-tools", "trond-snekvik.simple-rst", - "twxs.cmake", ] } \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 7894eee..5c589c0 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -80,6 +80,7 @@ "ranges": "cpp", "ratio": "cpp", "regex": "cpp", + "resumable": "cpp", "scoped_allocator": "cpp", "semaphore": "cpp", "set": "cpp", diff --git a/CMakeLists.txt b/CMakeLists.txt index a667605..6790318 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ # http://creativecommons.org/publicdomain/zero/1.0/ # ######################################################################## -cmake_minimum_required(VERSION 3.22) +cmake_minimum_required(VERSION 3.23...4.0) list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/tools/cmake/") ######################################################################## diff --git a/CMakePresets.json b/CMakePresets.json index c7ef595..4868136 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -16,6 +16,7 @@ "BUILD_TESTING": true, "WARNINGS_AS_ERRORS": true, "CMAKE_DEBUG_POSTFIX": "-dbg", + "CMAKE_EXPORT_COMPILE_COMMANDS": true, "CMAKE_INSTALL_PREFIX": "${sourceDir}/build/zinstall" } }, @@ -33,8 +34,7 @@ "CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreaded$<$:Debug>", "VCPKG_TARGET_TRIPLET": "x64-windows-static" }, - "environment": { - }, + "environment": {}, "vendor": { "microsoft.com/VisualStudioSettings/CMake/1.0": { "hostOS": [ @@ -52,6 +52,12 @@ "CMAKE_CXX_COMPILER": "cl" } }, + { + "name": "x64-windows-msvc-ci", + "inherits": [ + "x64-windows-msvc" + ] + }, { "name": "x64-windows-msvc-lto", "inherits": [ @@ -86,6 +92,12 @@ } } }, + { + "name": "x64-windows-clang-ci", + "inherits": [ + "x64-windows-clang" + ] + }, { "name": "x64-linux", "hidden": true, @@ -126,38 +138,76 @@ "x64-linux" ], "cacheVariables": { - "VCPKG_TARGET_TRIPLET": "x64-linux-clang-16", - "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/x64-linux-clang-16.cmake" + "VCPKG_TARGET_TRIPLET": "x64-linux-clang", + "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/x64-linux-clang.cmake" } }, { - "name": "x64-linux-ci-lint", + "name": "x64-linux-clang-19", + "inherits": [ + "x64-linux-clang" + ], + "cacheVariables": { + "VCPKG_TARGET_TRIPLET": "x64-linux-clang-19", + "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/x64-linux-clang-19.cmake" + } + }, + { + "name": "x64-linux-clang-20", "inherits": [ "x64-linux-clang" ], "cacheVariables": { - "VCPKG_TARGET_TRIPLET": "x64-linux-clang-16", - "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/x64-linux-clang-16.cmake", - "CMAKE_EXPORT_COMPILE_COMMANDS": true + "VCPKG_TARGET_TRIPLET": "x64-linux-clang-20", + "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/x64-linux-clang-20.cmake" } }, + { + "name": "x64-linux-clang-ci", + "inherits": [ + "x64-linux-clang-19" + ] + }, + { + "name": "x64-linux-ci-lint", + "inherits": [ + "x64-linux-clang-20" + ] + }, { "name": "x64-linux-gcc", "inherits": [ "x64-linux" ], "cacheVariables": { - "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/x64-linux-gcc-12.cmake", + "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/x64-linux-gcc.cmake", "CMAKE_CXX_FLAGS": "-fconcepts-diagnostics-depth=0 -ftemplate-backtrace-limit=0 -fsanitize=address,leak,undefined -g -fno-omit-frame-pointer", "CMAKE_EXE_LINKER_FLAGS": "-fsanitize=address,leak,undefined" } }, { - "name": "x64-macos", - "hidden": true, - "inherits": [ "base" ], + "name": "x64-linux-gcc-12", + "inherits": [ + "x64-linux-gcc" + ], "cacheVariables": { - "VCPKG_TARGET_TRIPLET": "x64-osx" + "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/x64-linux-gcc-12.cmake" + } + }, + { + "name": "x64-linux-gcc-ci", + "inherits": [ + "x64-linux-gcc-12" + ] + }, + { + "name": "arm64-macos-clang", + "inherits": [ + "base" + ], + "cacheVariables": { + "VCPKG_TARGET_TRIPLET": "arm64-macos-clang-19-brew", + "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/arm64-macos-clang-19-brew.cmake" }, "vendor": { "microsoft.com/VisualStudioSettings/CMake/1.0": { @@ -168,20 +218,33 @@ } }, { - "name": "x64-macos-clang", - "inherits": [ "x64-macos" ], - "cacheVariables": { - "VCPKG_TARGET_TRIPLET": "x64-osx-clang-16-brew", - "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/x64-macos-clang-16-brew.cmake" - } + "name": "arm64-macos-clang-ci", + "inherits": [ + "arm64-macos-clang" + ] }, { "name": "x64-macos-gcc", - "inherits": [ "x64-macos" ], + "inherits": [ + "base" + ], "cacheVariables": { "VCPKG_TARGET_TRIPLET": "x64-osx-gcc-12", "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/tools/toolchains/x64-macos-gcc-12.cmake" + }, + "vendor": { + "microsoft.com/VisualStudioSettings/CMake/1.0": { + "hostOS": [ + "macOS" + ] + } } + }, + { + "name": "x64-macos-gcc-ci", + "inherits": [ + "x64-macos-gcc" + ] } ], "buildPresets": [ @@ -195,6 +258,16 @@ "inherits": "x64-windows-msvc", "configuration": "RelWithDebInfo" }, + { + "name": "x64-windows-msvc-ci", + "configurePreset": "x64-windows-msvc-ci", + "configuration": "Debug" + }, + { + "name": "x64-windows-msvc-ci-release", + "inherits": "x64-windows-msvc-ci", + "configuration": "RelWithDebInfo" + }, { "name": "x64-windows-clang", "configurePreset": "x64-windows-clang", @@ -205,6 +278,16 @@ "inherits": "x64-windows-clang", "configuration": "RelWithDebInfo" }, + { + "name": "x64-windows-clang-ci", + "configurePreset": "x64-windows-clang-ci", + "configuration": "Debug" + }, + { + "name": "x64-windows-clang-ci-release", + "inherits": "x64-windows-clang-ci", + "configuration": "RelWithDebInfo" + }, { "name": "x64-linux-clang", "configurePreset": "x64-linux-clang", @@ -215,6 +298,16 @@ "inherits": "x64-linux-clang", "configuration": "RelWithDebInfo" }, + { + "name": "x64-linux-clang-ci", + "configurePreset": "x64-linux-clang-ci", + "configuration": "Debug" + }, + { + "name": "x64-linux-clang-ci-release", + "inherits": "x64-linux-clang-ci", + "configuration": "RelWithDebInfo" + }, { "name": "x64-linux-gcc", "configurePreset": "x64-linux-gcc", @@ -226,13 +319,33 @@ "configuration": "RelWithDebInfo" }, { - "name": "x64-macos-clang", - "configurePreset": "x64-macos-clang", + "name": "x64-linux-gcc-ci", + "configurePreset": "x64-linux-gcc-ci", + "configuration": "Debug" + }, + { + "name": "x64-linux-gcc-ci-release", + "inherits": "x64-linux-gcc-ci", + "configuration": "RelWithDebInfo" + }, + { + "name": "arm64-macos-clang", + "configurePreset": "arm64-macos-clang", + "configuration": "Debug" + }, + { + "name": "arm64-macos-clang-release", + "inherits": "arm64-macos-clang", + "configuration": "RelWithDebInfo" + }, + { + "name": "arm64-macos-clang-ci", + "configurePreset": "arm64-macos-clang-ci", "configuration": "Debug" }, { - "name": "x64-macos-clang-release", - "inherits": "x64-macos-clang", + "name": "arm64-macos-clang-ci-release", + "inherits": "arm64-macos-clang-ci", "configuration": "RelWithDebInfo" }, { @@ -244,6 +357,16 @@ "name": "x64-macos-gcc-release", "inherits": "x64-macos-gcc", "configuration": "RelWithDebInfo" + }, + { + "name": "x64-macos-gcc-ci", + "configurePreset": "x64-macos-gcc-ci", + "configuration": "Debug" + }, + { + "name": "x64-macos-gcc-ci-release", + "inherits": "x64-macos-gcc-ci", + "configuration": "RelWithDebInfo" } ], "testPresets": [ @@ -265,6 +388,16 @@ "inherits": "x64-windows-msvc", "configuration": "RelWithDebInfo" }, + { + "name": "x64-windows-msvc-ci", + "configurePreset": "x64-windows-msvc-ci", + "configuration": "Debug" + }, + { + "name": "x64-windows-msvc-ci-release", + "inherits": "x64-windows-msvc-ci", + "configuration": "RelWithDebInfo" + }, { "name": "x64-windows-clang", "configurePreset": "x64-windows-clang", @@ -275,6 +408,16 @@ "inherits": "x64-windows-clang", "configuration": "RelWithDebInfo" }, + { + "name": "x64-windows-clang-ci", + "configurePreset": "x64-windows-clang-ci", + "configuration": "Debug" + }, + { + "name": "x64-windows-clang-ci-release", + "inherits": "x64-windows-clang-ci", + "configuration": "RelWithDebInfo" + }, { "name": "x64-linux-clang", "configurePreset": "x64-linux-clang", @@ -285,6 +428,16 @@ "inherits": "x64-linux-clang", "configuration": "RelWithDebInfo" }, + { + "name": "x64-linux-clang-ci", + "configurePreset": "x64-linux-clang-ci", + "configuration": "Debug" + }, + { + "name": "x64-linux-clang-ci-release", + "inherits": "x64-linux-clang-ci", + "configuration": "RelWithDebInfo" + }, { "name": "x64-linux-gcc", "inherits": "sanitizer_env", @@ -297,13 +450,34 @@ "configuration": "RelWithDebInfo" }, { - "name": "x64-macos-clang", - "configurePreset": "x64-macos-clang", + "name": "x64-linux-gcc-ci", + "inherits": "sanitizer_env", + "configurePreset": "x64-linux-gcc-ci", "configuration": "Debug" }, { - "name": "x64-macos-clang-release", - "inherits": "x64-macos-clang", + "name": "x64-linux-gcc-ci-release", + "inherits": "x64-linux-gcc-ci", + "configuration": "RelWithDebInfo" + }, + { + "name": "arm64-macos-clang", + "configurePreset": "arm64-macos-clang", + "configuration": "Debug" + }, + { + "name": "arm64-macos-clang-release", + "inherits": "arm64-macos-clang", + "configuration": "RelWithDebInfo" + }, + { + "name": "arm64-macos-clang-ci", + "configurePreset": "arm64-macos-clang-ci", + "configuration": "Debug" + }, + { + "name": "arm64-macos-clang-ci-release", + "inherits": "arm64-macos-clang-ci", "configuration": "RelWithDebInfo" }, { @@ -316,6 +490,16 @@ "name": "x64-macos-gcc-release", "inherits": "x64-macos-gcc", "configuration": "RelWithDebInfo" + }, + { + "name": "x64-macos-gcc-ci", + "configurePreset": "x64-macos-gcc-ci", + "configuration": "Debug" + }, + { + "name": "x64-macos-gcc-ci-release", + "inherits": "x64-macos-gcc-ci", + "configuration": "RelWithDebInfo" } ] } \ No newline at end of file diff --git a/sources.cmake b/sources.cmake index 658e6a9..4c9be40 100644 --- a/sources.cmake +++ b/sources.cmake @@ -24,8 +24,8 @@ dplx_target_sources(concrete scope_guard ) -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/generated/src/dplx/cncr/detail) -configure_file(tools/config.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/generated/src/dplx/cncr/detail/config.hpp @ONLY) +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/generated/src/dplx/cncr/detail") +configure_file(tools/config.hpp.in "${CMAKE_CURRENT_BINARY_DIR}/generated/src/dplx/cncr/detail/config.hpp" @ONLY) target_sources(concrete PUBLIC $) dplx_target_sources(concrete diff --git a/src/dplx/cncr/bit.hpp b/src/dplx/cncr/bit.hpp index 6467ca7..48c0e92 100644 --- a/src/dplx/cncr/bit.hpp +++ b/src/dplx/cncr/bit.hpp @@ -55,7 +55,7 @@ namespace dplx::cncr { -static_assert(__cpp_lib_byteswap >= 202110L, +static_assert(__cpp_lib_byteswap >= 202'110L, "USE_STD_BYTESWAP has been configured, but this TU isn't " "compiled with a sufficiently C++23 compliant compiler/mode"); using std::byteswap; @@ -109,8 +109,8 @@ constexpr auto byteswap(T value) noexcept -> T // NOLINTNEXTLINE(bugprone-signed-char-misuse) auto const x = static_cast(value); auto const step16 = x << 16 | x >> 16; - return static_cast(((step16 << 8) & 0xff00ff00U) - | ((step16 >> 8) & 0x00ff00ffU)); + return static_cast(((step16 << 8) & 0xff00'ff00U) + | ((step16 >> 8) & 0x00ff'00ffU)); } else if constexpr (sizeof(T) == sizeof(std::uint64_t)) { @@ -122,10 +122,10 @@ constexpr auto byteswap(T value) noexcept -> T #endif auto const x = static_cast(value); auto const step32 = x << 32 | x >> 32; - auto const step16 = (step32 & 0x0000ffff0000ffffU) << 16 - | (step32 & 0xffff0000ffff0000U) >> 16; - return static_cast((step16 & 0x00ff00ff00ff00ffU) << 8 - | (step16 & 0xff00ff00ff00ff00U) >> 8); + auto const step16 = (step32 & 0x0000'ffff'0000'ffffU) << 16 + | (step32 & 0xffff'0000'ffff'0000U) >> 16; + return static_cast((step16 & 0x00ff'00ff'00ff'00ffU) << 8 + | (step16 & 0xff00'ff00'ff00'ff00U) >> 8); } else { diff --git a/src/dplx/cncr/bit.test.cpp b/src/dplx/cncr/bit.test.cpp index 382b217..88878eb 100644 --- a/src/dplx/cncr/bit.test.cpp +++ b/src/dplx/cncr/bit.test.cpp @@ -49,10 +49,9 @@ auto endian_samples(endian_sample const (&samples)[N]) return cncr_tests::from_range(std::move(values)); #else return cncr_tests::from_range( - samples - | std::views::transform( - [](endian_sample const &sample) - { return std::bit_cast>(sample); })); + samples | std::views::transform([](endian_sample const &sample) { + return std::bit_cast>(sample); + })); #endif } @@ -80,16 +79,16 @@ constexpr endian_sample byteswap_samples[] = { template requires(sizeof(T) == sizeof(std::uint32_t)) constexpr endian_sample byteswap_samples[] = { - {0x1f2e3d4c, 0x4c3d2e1f}, - {0xf1e2d3c4, 0xc4d3e2f1}, - {0x1234abcd, 0xcdab3412}, + {0x1f2e'3d4c, 0x4c3d'2e1f}, + {0xf1e2'd3c4, 0xc4d3'e2f1}, + {0x1234'abcd, 0xcdab'3412}, }; template requires(sizeof(T) == sizeof(std::uint64_t)) constexpr endian_sample byteswap_samples[] = { - {0x1f2e3d4c5b6a7988, 0x88796a5b4c3d2e1f}, - {0xf1e2d3c4b5a69788, 0x8897a6b5c4d3e2f1}, - {0x1234567890abcdef, 0xefcdab9078563412}, + {0x1f2e'3d4c'5b6a'7988, 0x8879'6a5b'4c3d'2e1f}, + {0xf1e2'd3c4'b5a6'9788, 0x8897'a6b5'c4d3'e2f1}, + {0x1234'5678'90ab'cdef, 0xefcd'ab90'7856'3412}, }; } // namespace @@ -132,34 +131,34 @@ TEST_CASE("endian_load correctly loads a big endian value from bytes") using enum std::endian; auto const bytes = cncr::make_byte_array<4>({0x1f, 0x2e, 0x3d, 0x4c}); auto const loaded = cncr::endian_load(bytes.data()); - CHECK(loaded == 0x1f2e3d4c); + CHECK(loaded == 0x1f2e'3d4c); } TEST_CASE("endian_load correctly loads a little endian value from bytes") { using enum std::endian; auto const bytes = cncr::make_byte_array<4>({0x4c, 0x3d, 0x2e, 0x1f}); auto const loaded = cncr::endian_load(bytes.data()); - CHECK(loaded == 0x1f2e3d4c); + CHECK(loaded == 0x1f2e'3d4c); } TEST_CASE("endian_load correctly loads a big endian value from uint8s") { using enum std::endian; std::array const bytes{0x1f, 0x2e, 0x3d, 0x4c}; auto const loaded = cncr::endian_load(bytes.data()); - CHECK(loaded == 0x1f2e3d4c); + CHECK(loaded == 0x1f2e'3d4c); } TEST_CASE("endian_load correctly loads a little endian value from uint8s") { using enum std::endian; std::array const bytes{0x4c, 0x3d, 0x2e, 0x1f}; auto const loaded = cncr::endian_load(bytes.data()); - CHECK(loaded == 0x1f2e3d4c); + CHECK(loaded == 0x1f2e'3d4c); } TEST_CASE("endian_store correctly stores a big endian value to bytes") { using enum std::endian; - constexpr unsigned value = 0x1f2e3d4c; + constexpr unsigned value = 0x1f2e'3d4c; auto const expected = cncr::make_byte_array<4>({0x1f, 0x2e, 0x3d, 0x4c}); std::array stored{}; @@ -169,7 +168,7 @@ TEST_CASE("endian_store correctly stores a big endian value to bytes") TEST_CASE("endian_store correctly stores a little endian value to bytes") { using enum std::endian; - constexpr unsigned value = 0x1f2e3d4c; + constexpr unsigned value = 0x1f2e'3d4c; auto const expected = cncr::make_byte_array<4>({0x4c, 0x3d, 0x2e, 0x1f}); std::array stored{}; @@ -179,7 +178,7 @@ TEST_CASE("endian_store correctly stores a little endian value to bytes") TEST_CASE("endian_store correctly stores a big endian value to uint8s") { using enum std::endian; - constexpr unsigned value = 0x1f2e3d4c; + constexpr unsigned value = 0x1f2e'3d4c; std::array const expected{0x1f, 0x2e, 0x3d, 0x4c}; std::array stored{}; @@ -189,7 +188,7 @@ TEST_CASE("endian_store correctly stores a big endian value to uint8s") TEST_CASE("endian_store correctly stores a little endian value to uint8s") { using enum std::endian; - constexpr unsigned value = 0x1f2e3d4c; + constexpr unsigned value = 0x1f2e'3d4c; std::array const expected{0x4c, 0x3d, 0x2e, 0x1f}; std::array stored{}; diff --git a/src/dplx/cncr/data_defined_status_domain.hpp b/src/dplx/cncr/data_defined_status_domain.hpp index 2171914..25ef98e 100644 --- a/src/dplx/cncr/data_defined_status_domain.hpp +++ b/src/dplx/cncr/data_defined_status_domain.hpp @@ -8,7 +8,6 @@ #pragma once #include -#include #include #include @@ -97,6 +96,7 @@ consteval auto validate_status_enum_definition_data() noexcept -> bool // is sorted for (value_descriptor const *it = begin, *next = begin + 1; next != end; + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) it = next++) { if (it->value > next->value) @@ -166,6 +166,7 @@ class data_defined_status_domain_type : public system_error::status_code_domain } protected: +// NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) #if 1 [[nodiscard]] static constexpr auto count_success_codes() noexcept -> std::size_t @@ -217,6 +218,7 @@ class data_defined_status_domain_type : public system_error::status_code_domain = static_cast const &>(code); auto &&value = typedCode.value(); +// NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) #if 1 if constexpr (num_success_codes > 0U) { @@ -358,6 +360,7 @@ inline constexpr auto data_defined_status_domain_type::get() noexcept return data_defined_status_domain; } +// NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) #if 0 template constexpr auto make_status_code(Enum c) noexcept diff --git a/src/dplx/cncr/disappointment.hpp b/src/dplx/cncr/disappointment.hpp index bf291c7..fe2f206 100644 --- a/src/dplx/cncr/disappointment.hpp +++ b/src/dplx/cncr/disappointment.hpp @@ -95,11 +95,11 @@ using result_value_t template concept tryable_result = tryable - && (std::is_same_v> // this handles R=void - || requires(T rx) { - detail::check_copy_initializable( - outcome::try_operation_extract_value( - static_cast(rx))); - }); + && (std::is_same_v> // this handles R=void + || requires(T rx) { + detail::check_copy_initializable( + outcome::try_operation_extract_value( + static_cast(rx))); + }); } // namespace dplx::cncr diff --git a/src/dplx/cncr/intrusive_ptr.hpp b/src/dplx/cncr/intrusive_ptr.hpp index 9943a8a..5407374 100644 --- a/src/dplx/cncr/intrusive_ptr.hpp +++ b/src/dplx/cncr/intrusive_ptr.hpp @@ -580,12 +580,12 @@ class [[nodiscard]] intrusive_ptr { return mPtr; } - [[nodiscard]] constexpr auto get_handle() &&noexcept -> intrusive_ptr + [[nodiscard]] constexpr auto get_handle() && noexcept -> intrusive_ptr { mPtr = nullptr; return std::move(mHandle); } - [[nodiscard]] constexpr auto get_handle() const &noexcept + [[nodiscard]] constexpr auto get_handle() const & noexcept -> intrusive_ptr const & { return mHandle; diff --git a/src/dplx/cncr/math_supplement.hpp b/src/dplx/cncr/math_supplement.hpp index 9db0a5c..388da37 100644 --- a/src/dplx/cncr/math_supplement.hpp +++ b/src/dplx/cncr/math_supplement.hpp @@ -18,13 +18,13 @@ namespace dplx::cncr template concept integer = std::integral - && none_of, - bool, - char, - wchar_t, - char8_t, - char16_t, - char32_t>; + && none_of, + bool, + char, + wchar_t, + char8_t, + char16_t, + char32_t>; template concept signed_integer = integer && std::signed_integral; @@ -58,14 +58,14 @@ constexpr auto div_ceil(T const dividend, U const divisor) noexcept ^ static_cast(static_cast(divisor))); return static_cast( - dividend / divisor + (signComp >= 0 && dividend % divisor != 0)); + (dividend / divisor) + (signComp >= 0 && dividend % divisor != 0)); } template constexpr auto div_ceil(T const dividend, U const divisor) noexcept -> std::common_type_t { using common_type = std::common_type_t; - return static_cast(dividend / divisor + return static_cast((dividend / divisor) + (dividend % divisor != 0U)); } diff --git a/src/dplx/cncr/math_supplement.test.cpp b/src/dplx/cncr/math_supplement.test.cpp index 8d643d9..1b93e44 100644 --- a/src/dplx/cncr/math_supplement.test.cpp +++ b/src/dplx/cncr/math_supplement.test.cpp @@ -41,13 +41,13 @@ TEST_CASE("div_ceil/signed") CHECK(cncr::div_ceil(-8, -7) == 2); CHECK(cncr::div_ceil(19 * -1, 19) == -1); - CHECK(cncr::div_ceil(19 * -1 + 1, 19) == 0); + CHECK(cncr::div_ceil((19 * -1) + 1, 19) == 0); CHECK(cncr::div_ceil(19 * 0, 19) == 0); - CHECK(cncr::div_ceil(19 * 0 + 1, 19) == 1); + CHECK(cncr::div_ceil((19 * 0) + 1, 19) == 1); CHECK(cncr::div_ceil(19 * 1, 19) == 1); - CHECK(cncr::div_ceil(19 * 1 + 1, 19) == 2); + CHECK(cncr::div_ceil((19 * 1) + 1, 19) == 2); CHECK(cncr::div_ceil(19 * 2, 19) == 2); - CHECK(cncr::div_ceil(19 * 2 + 1, 19) == 3); + CHECK(cncr::div_ceil((19 * 2) + 1, 19) == 3); } TEST_CASE("div_ceil/unsigned") diff --git a/src/dplx/cncr/mp_lite.hpp b/src/dplx/cncr/mp_lite.hpp index fee34ba..ce18402 100644 --- a/src/dplx/cncr/mp_lite.hpp +++ b/src/dplx/cncr/mp_lite.hpp @@ -23,8 +23,7 @@ struct mp_rename { }; template