diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 00000000..11f26a30 --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,56 @@ +Checks: +'-*, + boost-*, + bugprone-*, + cert-*, + -cert-dcl58-cpp, + clang-analyzer-*, + concurrency-*, + -cppcoreguidelines-*, + -google-*, + hicpp-*, + misc-*, + -misc-const-correctness, + -misc-include-cleaner, + -misc-non-private-member-variables-in-classes, + -modernize-*, + -modernize-use-nodiscard, + performance-*, + portability-*, + -readability-*, + -readability-identifier-*, + -readability-implicit-bool-conversion, + -readability-magic-numbers, + -*-named-parameter, + -*-uppercase-literal-suffix, + -*-use-equals-default, + -*-braces-around-statements +' +HeaderFilterRegex: '.*/execution26/(include|src|example|tests)/.*\.(hpp)$' +WarningsAsErrors: 'clang*' +FormatStyle: file + +CheckOptions: + - { key: readability-identifier-naming.NamespaceCase, value: CamelCase } + - { key: readability-identifier-naming.ClassCase, value: CamelCase } + - { key: readability-identifier-naming.EnumCase, value: CamelCase } + - { key: readability-identifier-naming.MemberCase, value: camelBack } + - { key: readability-identifier-naming.MemberPrefix, value: m_ } + - { key: readability-identifier-naming.StructCase, value: lower_case } + - { key: readability-identifier-naming.UnionCase, value: lower_case } + - { key: readability-identifier-naming.TypedefCase, value: lower_case } + - { key: readability-identifier-naming.TypedefSuffix, value: _type } + - { key: readability-identifier-naming.FunctionCase, value: camelBack } + - { key: readability-identifier-naming.VariableCase, value: camelBack } + - { key: readability-identifier-naming.ParameterCase, value: camelBack } + - { key: readability-identifier-naming.LocalVariableCase, value: camelBack } + - { key: readability-identifier-naming.ConstexprFunctionCase, value: camelBack } + - { key: readability-identifier-naming.ConstexprMethodCase, value: camelBack } + - { key: readability-identifier-naming.ConstexprVariableCase, value: UPPER_CASE } + - { key: readability-identifier-naming.ClassConstantCase, value: UPPER_CASE } + - { key: readability-identifier-naming.EnumConstantCase, value: UPPER_CASE } + - { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE } + - { key: readability-identifier-naming.GlobalConstantPointerCase, value: UPPER_CASE } + - { key: readability-identifier-naming.LocalConstantPointerCase, value: UPPER_CASE } + - { key: readability-identifier-naming.ScopedEnumConstantCase, value: UPPER_CASE } + - { key: readability-identifier-naming.StaticConstantCase, value: UPPER_CASE } diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 00000000..7d233d00 --- /dev/null +++ b/.codespellrc @@ -0,0 +1,6 @@ +[codespell] +builtin = clear,rare,en-GB_to_en-US,names,informal,code +check-hidden = +skip = ./.git,./build/*,./stagedir/*,./docs/html/*,./docs/latex/*,*.log,.*.swp,*~,*.bak,Makefile +quiet-level = 2 +# ignore-words = .ignore-words diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index c4400449..8c6af125 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -5,7 +5,7 @@ name: Linux Build on: push: - # branches: [ "main" ] + branches: ["main"] paths: - "include/**" - "src/**" @@ -13,7 +13,7 @@ on: - "CMakeLists.txt" - ".github/workflows/linux.yml" pull_request: - branches: [ "main" ] + branches: ["main"] paths: - "include/**" - "src/**" @@ -30,19 +30,17 @@ jobs: matrix: # TODO: sanitizer: [debug, release, asan, usan, tsan] sanitizer: [debug, release] - # TODO: compiler: [g++-14, clang++-18] - compiler: [g++-14] + compiler: [g++-14, clang++-19] steps: - uses: actions/checkout@v4 - - name: Install static analyzers - run: >- - sudo apt-get install clang-tidy-18 ninja-build -y -q - - sudo update-alternatives --install - /usr/bin/clang-tidy clang-tidy - /usr/bin/clang-tidy-18 140 + - name: Install build tools + run: | + sudo apt-get install ninja-build -y -q + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo ./llvm.sh 19 all - name: Linux ${{ matrix.compiler }} ${{ matrix.sanitizer }} run: CXX=${{ matrix.compiler }} make ${{ matrix.sanitizer }} diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 4aaf4a6c..5d0ed779 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -5,7 +5,7 @@ name: Macos Build on: push: - # branches: [ "main" ] + branches: ["main"] paths: - "include/**" - "src/**" @@ -13,7 +13,7 @@ on: - "CMakeLists.txt" - ".github/workflows/macos.yml" pull_request: - branches: [ "main" ] + branches: ["main"] paths: - "include/**" - "src/**" @@ -29,8 +29,8 @@ jobs: matrix: sanitizer: [debug, release] - # TODO: compiler: [g++-14, clang++-19] - compiler: [clang++-18] + # TODO: compiler: [g++, clang++-19] + compiler: [g++, clang++-18] steps: - uses: actions/checkout@v4 @@ -39,11 +39,20 @@ jobs: # if: startsWith(matrix.compiler, 'clang') uses: aminya/setup-cpp@v1 with: - # compiler: llvm-19 + # TODO: compiler: llvm-19 # clangtidy: true # cmake: true ninja: true - - name: macos ${{ matrix.compiler }} ${{ matrix.sanitizer }} + - name: Install llvm-19 + if: startsWith(matrix.compiler, 'clang') + run: | + brew install llvm@19 || echo ignored + + - name: macos clang++-18 ${{ matrix.sanitizer }} if: startsWith(matrix.compiler, 'clang') run: CXX=$(brew --prefix llvm@18)/bin/clang++ make ${{ matrix.sanitizer }} + + - name: macos g++ ${{ matrix.sanitizer }} + if: startsWith(matrix.compiler, 'g++') + run: CXX=${{ matrix.compiler }} make ${{ matrix.sanitizer }} diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 9f5f003d..3e003a0a 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -5,7 +5,7 @@ name: Windows Build on: push: - # branches: [ "main" ] + branches: ["main"] paths: - "include/**" - "src/**" @@ -13,7 +13,7 @@ on: - "CMakeLists.txt" - ".github/workflows/windows.yml" pull_request: - branches: [ "main" ] + branches: ["main"] paths: - "include/**" - "src/**" @@ -24,20 +24,38 @@ on: jobs: build: runs-on: windows-latest + strategy: + fail-fast: false + + matrix: + # TODO: sanitizer: [debug, release] + sanitizer: [release] + # TODO: compiler: [cl, clang-cl] + compiler: [cl] + steps: - uses: actions/checkout@v4 - - name: environment - run: cmake -E make_directory ${{github.workspace}}/build + # see https://github.com/marketplace/actions/enable-developer-command-prompt + - uses: ilammy/msvc-dev-cmd@v1 + with: + vsversion: 2022 + + # - name: build environment + # run: pip install -r requirements.txt + + - name: cmake workflow ${{ matrix.sanitizer }} + shell: bash + run: | + cmake --version + ninja --version + CXX=${{ matrix.compiler }} cmake --workflow --preset ${{ matrix.sanitizer }} - - name: configure - working-directory: ${{github.workspace}}/build - run: cmake ${{github.workspace}} + # - name: configure + # run: CXX=${{ matrix.compiler }} cmake --preset ${{ matrix.sanitizer }} - - name: build - working-directory: ${{github.workspace}}/build - run: cmake --build . --config Release --target all_verify_interface_header_sets install + # - name: build + # run: cmake --build --preset ${{ matrix.sanitizer }} - - name: ctest - working-directory: ${{github.workspace}}/build - run: ctest --build-config Release --output-on-failure + # - name: ctest + # run: ctest --preset ${{ matrix.sanitizer }} diff --git a/.gitignore b/.gitignore index 3db97411..c586a9b9 100644 --- a/.gitignore +++ b/.gitignore @@ -36,5 +36,10 @@ build .vs .vscode stagedir + +# In-source builds are not allowed +CMakeCache.txt +CMakeFiles/ + docs/html -docs/latex +docs/latex \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index efb11e81..235b3dc3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,16 +15,12 @@ set(TARGET_ALIAS ${TARGET_LIBRARY}::${TARGET_LIBRARY}) set(TARGET_PACKAGE_NAME ${PROJECT_NAME}-config) set(TARGETS_EXPORT_NAME ${PROJECT_NAME}-targets) -include(GNUInstallDirs) -set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) - -if(NOT DEFINED CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 23) +if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + message(FATAL_ERROR "In-source builds are not allowed!") endif() -if(NOT DEFINED CMAKE_PREFIX_PATH) - set(CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}) -endif() +include(GNUInstallDirs) +set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) add_subdirectory(src/beman/execution26) @@ -53,3 +49,5 @@ install( ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_PACKAGE_NAME}-version.cmake DESTINATION ${INSTALL_CONFIGDIR} ) + +include(CPack) diff --git a/CMakePresets.json b/CMakePresets.json index bb89f325..2fd4ebdc 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -1,80 +1,27 @@ { - "version": 6, - "configurePresets": [ - { - "name": "root-config", - "hidden": true, - "generator": "Ninja", - "binaryDir": "${sourceDir}/build/${presetName}", - "installDir": "${sourceDir}/stagedir", - "cacheVariables": { - "CMAKE_PREFIX_PATH": { - "type": "path", - "value": "${sourceDir}/stagedir" - }, - "CMAKE_CXX_EXTENSIONS": false, - "CMAKE_CXX_STANDARD": "23", - "CMAKE_CXX_STANDARD_REQUIRED": true, - "CMAKE_EXPORT_COMPILE_COMMANDS": true - } - }, - { - "name": "debug-base-unix", - "hidden": true, - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug", - "CMAKE_CXX_FLAGS": "-fsanitize=address -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=leak -fsanitize=undefined" - }, - "condition": { - "type": "notEquals", - "lhs": "${hostSystemName}", - "rhs": "Windows" - } - }, - { - "name": "release-base-unix", - "hidden": true, - "cacheVariables": { - "CMAKE_BUILD_TYPE": "RelWithDebInfo", - "CMAKE_CXX_FLAGS": "-Wall -Wextra -Wpedantic -Wno-shadow -Wconversion -Wsign-conversion -Wcast-align -Wcast-qual -Woverloaded-virtual -Wformat=2 -Wno-error" - }, - "condition": { - "type": "notEquals", - "lhs": "${hostSystemName}", - "rhs": "Windows" - } - }, - { - "name": "debug", - "displayName": "Debug Build", - "inherits": [ - "root-config", - "debug-base-unix" - ] - }, - { - "name": "release", - "displayName": "Release Build", - "inherits": [ - "root-config", - "release-base-unix" - ] - } + "version": 9, + "cmakeMinimumRequired": { + "major": 3, + "minor": 30, + "patch": 0 + }, + "include": [ + "cmake/CMake${hostSystemName}Presets.json" ], "buildPresets": [ { "name": "debug", "configurePreset": "debug", + "configuration": "Debug", "targets": [ - "all", "install" ] }, { "name": "release", "configurePreset": "release", + "configuration": "Release", "targets": [ - "all", "all_verify_interface_header_sets", "install" ] @@ -95,14 +42,28 @@ { "name": "debug", "inherits": "test_base", + "configuration": "Debug", "configurePreset": "debug" }, { "name": "release", "inherits": "test_base", + "configuration": "Release", "configurePreset": "release" } ], + "packagePresets": [ + { + "name": "release", + "configurePreset": "release", + "configurations": [ + "Release" + ], + "generators": [ + "TGZ" + ] + } + ], "workflowPresets": [ { "name": "debug", @@ -135,6 +96,10 @@ { "type": "test", "name": "release" + }, + { + "type": "package", + "name": "release" } ] } diff --git a/Makefile b/Makefile index 731b31a2..58e00b00 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,8 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception SANITIZERS = release debug msan asan usan tsan -.PHONY: default doc run update check ce todo distclean clean build test all format $(SANITIZERS) + +.PHONY: default doc run update check ce todo distclean clean codespell clang-tidy build test all format $(SANITIZERS) COMPILER=system CXX_BASE=$(CXX:$(dir $(CXX))%=%) @@ -15,7 +16,7 @@ endif CXX_FLAGS = -g SANITIZER = release -SOURCEDIR = $(shell pwd) +SOURCEDIR = $(CURDIR) BUILDROOT = build BUILD = $(BUILDROOT)/$(SANITIZER) EXAMPLE = beman.execution26.examples.stop_token @@ -82,8 +83,15 @@ check: < $$h sed -n "/^ *# *include .*@$$from \1@p"; \ done | tsort > /dev/null +clang-tidy: build/$(SANITIZER)/compile_commands.json + run-clang-tidy -p build/$(SANITIZER) tests + +codespell: + codespell -L statics,snd,copyable,cancelled + format: - clang-format -i `git diff --name-only main | egrep '\.[ch]pp'` + cmake-format -i `git diff --name-only main | egrep '(CMakeLists.txt|\.cmake)'` + git clang-format main todo: bin/mk-todo.py diff --git a/README.md b/README.md index 1e3e93ba..aa2f6b11 100644 --- a/README.md +++ b/README.md @@ -55,8 +55,13 @@ for contributing to the library. The following instructions build the library and the examples: - cmake -B build - cmake --build build + cmake --workflow --list-presets + Available workflow presets: + + "debug" + "release" + + cmake --workflow --preset release The implementation compiles and passes tests using [clang](https://clang.llvm.org/), [gcc](http://gcc.gnu.org), and [MSVC++](https://visualstudio.microsoft.com/vs/features/cplusplus/). diff --git a/bin/mk-compiler-explorer.py b/bin/mk-compiler-explorer.py index 0e670740..eec61807 100755 --- a/bin/mk-compiler-explorer.py +++ b/bin/mk-compiler-explorer.py @@ -8,42 +8,47 @@ import sys head_re = re.compile("include/(?P.*)\.hpp") + + def clean_name(file): match = head_re.match(file) return match.group("name") + top = [] -for toplevel in glob.glob('include/?eman/*/*.hpp'): +for toplevel in glob.glob("include/?eman/*/*.hpp"): top.append(clean_name(toplevel)) all = top.copy() -for detail in glob.glob('include/?eman/*/?etail/*.hpp'): +for detail in glob.glob("include/?eman/*/?etail/*.hpp"): all.append(clean_name(detail)) headers = {} beman_re = re.compile('#include ["<](?P[bB]eman/.*)\.hpp[">]') other_re = re.compile('#include ["<](?P.*)[">]') + def get_dependencies(component): deps = [] with open("include/" + component + ".hpp") as file: for line in file.readlines(): if beman_re.match(line): deps.append(beman_re.match(line).group("name")) - elif (other_re.match(line)): + elif other_re.match(line): header = other_re.match(line).group("name") if header not in headers: headers[header] = 1 return deps + dependencies = {} for component in all: dependencies[component] = get_dependencies(component) if len(sys.argv) != 2: - print(f'usage: {sys.argv[0]} ') + print(f"usage: {sys.argv[0]} ") sys.exit(1) dir = sys.argv[1] @@ -51,16 +56,18 @@ def get_dependencies(component): project_re = re.compile("(?P(?P[bB]eman)/.*)/") define_re = re.compile("#define") + def write_header(to, header): - with open(f'include/{header}.hpp') as file: + with open(f"include/{header}.hpp") as file: for line in file.readlines(): if not beman_re.match(line) and not other_re.match(line): to.write(line) + def build_header(file, to, header): includes = list(headers.keys()) for include in includes: - to.write(f'#include <{include}>\n') + to.write(f"#include <{include}>\n") deps = {} todo = dependencies[header].copy() @@ -70,7 +77,7 @@ def build_header(file, to, header): for new in dependencies[todo[0]]: todo.append(new) todo = todo[1:] - + while 0 < len(deps): empty = [item for item in deps.keys() if 0 == len(deps[item])] for e in empty: @@ -79,17 +86,18 @@ def build_header(file, to, header): for d in deps.keys(): deps[d] = [item for item in deps[d] if e != item] + for header in top: beman = project_re.match(header).group("beman") - if not os.path.exists(f'{dir}/{beman}'): - os.mkdir(f'{dir}/{beman}') + if not os.path.exists(f"{dir}/{beman}"): + os.mkdir(f"{dir}/{beman}") project = project_re.match(header).group("project") - if not os.path.exists(f'{dir}/{project}'): - os.mkdir(f'{dir}/{project}') + if not os.path.exists(f"{dir}/{project}"): + os.mkdir(f"{dir}/{project}") prolog_done = False - with open(f'include/{header}.hpp') as file: - with open(f'{dir}/{header}.hpp', 'w') as to: + with open(f"include/{header}.hpp") as file: + with open(f"{dir}/{header}.hpp", "w") as to: for line in file.readlines(): if not beman_re.match(line) and not other_re.match(line): to.write(line) @@ -97,4 +105,4 @@ def build_header(file, to, header): prolog_done = True to.write("\n") build_header(file, to, header) - to.write("\n") \ No newline at end of file + to.write("\n") diff --git a/bin/mk-deps.py b/bin/mk-deps.py index 0d026162..44e962ac 100755 --- a/bin/mk-deps.py +++ b/bin/mk-deps.py @@ -5,14 +5,16 @@ deps = {} -done_re = re.compile('^(?P.) (?P.*)') +done_re = re.compile("^(?P.) (?P.*)") with open("deps") as file: for line in file.readlines(): match = done_re.match(line) if match: deps[match.group("name")] = match.group("state") -result = subprocess.run(["/usr/bin/tsort", "docs/dependency.txt"], capture_output=True, encoding="utf-8") +result = subprocess.run( + ["/usr/bin/tsort", "docs/dependency.txt"], capture_output=True, encoding="utf-8" +) for line in result.stdout.split("\n"): if line != "": - print(f'{deps[line] if line in deps else "-"} {line}') \ No newline at end of file + print(f'{deps[line] if line in deps else "-"} {line}') diff --git a/bin/mk-todo.py b/bin/mk-todo.py index 322928ba..f84d8a13 100755 --- a/bin/mk-todo.py +++ b/bin/mk-todo.py @@ -6,11 +6,11 @@ import re import urllib.request -#-dk:TODO get from http://wg21.link/ +# -dk:TODO get from http://wg21.link/ url = "https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2300r10.html" with urllib.request.urlopen(url) as f: - html = f.read().decode('utf-8') + html = f.read().decode("utf-8") json = json.loads(open("docs/TODO.json").read()) @@ -19,7 +19,7 @@ list.append("exec.awaitables") fail = "✅" # "☐" -ok = "🔴" # "☑" +ok = "🔴" # "☑" with open("docs/TODO.md", "w") as todo: print(f"# ToDo ", file=todo) @@ -31,6 +31,9 @@ if not node.get("removed", False): code = fail if node.get("code", False) else ok test = fail if node.get("test", False) else ok - doc = fail if node.get("doc", False) else ok + doc = fail if node.get("doc", False) else ok comment = node.get("comment", "") - print(f"| [[{name}]({url}#{name})] | {code} | {test} | {doc} | {comment} |", file=todo) + print( + f"| [[{name}]({url}#{name})] | {code} | {test} | {doc} | {comment} |", + file=todo, + ) diff --git a/bin/update-cmake-headers.py b/bin/update-cmake-headers.py index 3db9a8a2..69e0095a 100755 --- a/bin/update-cmake-headers.py +++ b/bin/update-cmake-headers.py @@ -8,40 +8,44 @@ import sys head_re = re.compile("include/(?P.*)\.hpp") + + def clean_name(file): match = head_re.match(file) return match.group("name") + def get_headers(dir): result = [] - for header in glob.glob(dir + '/*.hpp'): + for header in glob.glob(dir + "/*.hpp"): result.append(clean_name(header)) result.sort() return result + sections = { - 'public': get_headers('include/beman/*'), - 'detail': get_headers('include/beman/*/detail'), + "public": get_headers("include/beman/*"), + "detail": get_headers("include/beman/*/detail"), } file_set_re = re.compile(" *FILE_SET.*") -section_re = re.compile(" *\${TARGET_LIBRARY}_(?P
.*)_headers$") -header_re = re.compile(" *\${PROJECT_SOURCE_DIR}/include/beman/.*/.*\.hpp") +section_re = re.compile(" *\${TARGET_LIBRARY}_(?P
.*)_headers$") +header_re = re.compile(" *\${PROJECT_SOURCE_DIR}/include/beman/.*/.*\.hpp") if len(sys.argv) != 2: - print(f'usage: {sys.argv[0]} /CMakeLists.txt') + print(f"usage: {sys.argv[0]} /CMakeLists.txt") sys.exit(1) cmake = sys.argv[1] -print(f'updating {cmake}') +print(f"updating {cmake}") section = "" section_done = False -with open(cmake, 'r') as input: +with open(cmake, "r") as input: lines = input.readlines() -with open(f'{cmake}', 'w') as output: +with open(f"{cmake}", "w") as output: for line in lines: if None != file_set_re.match(line): section = "" @@ -54,7 +58,7 @@ def get_headers(dir): section_done = True project = "${PROJECT_SOURCE_DIR}" for header in sections[section]: - output.write(f' {project}/include/{header}.hpp\n') + output.write(f" {project}/include/{header}.hpp\n") else: output.write(line) pass diff --git a/cmake/CMakeDarwinPresets.json b/cmake/CMakeDarwinPresets.json new file mode 100644 index 00000000..c7ded969 --- /dev/null +++ b/cmake/CMakeDarwinPresets.json @@ -0,0 +1,50 @@ +{ + "version": 6, + "include": [ + "CMakeGenericPresets.json" + ], + "configurePresets": [ + { + "name": "debug-base-Darwin", + "hidden": true, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_CXX_FLAGS": "-fsanitize=address -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=undefined" + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + } + }, + { + "name": "release-base-Darwin", + "hidden": true, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "RelWithDebInfo", + "CMAKE_CXX_FLAGS": "-Wall -Wextra -Wpedantic -Wno-shadow -Wconversion -Wsign-conversion -Wcast-align -Wcast-qual -Woverloaded-virtual -Wformat=2 -Wno-error" + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + } + }, + { + "name": "debug", + "displayName": "Debug Build", + "inherits": [ + "root-config", + "debug-base-Darwin" + ] + }, + { + "name": "release", + "displayName": "Release Build", + "inherits": [ + "root-config", + "release-base-Darwin" + ] + } + ] +} diff --git a/cmake/CMakeGenericPresets.json b/cmake/CMakeGenericPresets.json new file mode 100644 index 00000000..7014512d --- /dev/null +++ b/cmake/CMakeGenericPresets.json @@ -0,0 +1,23 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "root-config", + "hidden": true, + "generator": "Ninja", + "binaryDir": "${sourceDir}/build/${presetName}", + "installDir": "${sourceDir}/stagedir", + "cacheVariables": { + "CMAKE_PREFIX_PATH": { + "type": "path", + "value": "${sourceDir}/stagedir" + }, + "CMAKE_CXX_EXTENSIONS": false, + "CMAKE_CXX_STANDARD": "23", + "CMAKE_CXX_STANDARD_REQUIRED": true, + "CMAKE_EXPORT_COMPILE_COMMANDS": true, + "CMAKE_SKIP_TEST_ALL_DEPENDENCY": false + } + } + ] +} diff --git a/cmake/CMakeLinuxPresets.json b/cmake/CMakeLinuxPresets.json new file mode 100644 index 00000000..3e186643 --- /dev/null +++ b/cmake/CMakeLinuxPresets.json @@ -0,0 +1,50 @@ +{ + "version": 6, + "include": [ + "CMakeGenericPresets.json" + ], + "configurePresets": [ + { + "name": "debug-base-Linux", + "hidden": true, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_CXX_FLAGS": "-fsanitize=address -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=leak -fsanitize=undefined" + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "release-base-Linux", + "hidden": true, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "RelWithDebInfo", + "CMAKE_CXX_FLAGS": "-Wall -Wextra -Wpedantic -Wno-shadow -Wconversion -Wsign-conversion -Wcast-align -Wcast-qual -Woverloaded-virtual -Wformat=2 -Wno-error" + }, + "condition": { + "type": "notEquals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "debug", + "displayName": "Debug Build", + "inherits": [ + "root-config", + "debug-base-Linux" + ] + }, + { + "name": "release", + "displayName": "Release Build", + "inherits": [ + "root-config", + "release-base-Linux" + ] + } + ] +} diff --git a/cmake/CMakeWindowsPresets.json b/cmake/CMakeWindowsPresets.json new file mode 100644 index 00000000..f565f614 --- /dev/null +++ b/cmake/CMakeWindowsPresets.json @@ -0,0 +1,33 @@ +{ + "version": 6, + "include": [ + "CMakeGenericPresets.json" + ], + "configurePresets": [ + { + "name": "release", + "description": "Windows preset for library developers", + "generator": "Ninja Multi-Config", + "binaryDir": "${sourceDir}/build", + "inherits": [ + "root-config" + ], + "cacheVariables": { + "CMAKE_CXX_COMPILER": "cl", + "CMAKE_CXX_FLAGS": "/W3 /EHsc /w14242 /w14254 /w14263 /w14265 /w14287 /w14289 /w14296 /w14311 /w14545 /w14546 /w14547 /w14549 /w14555 /w14640 /w14826 /w14928 /WX" + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "debug", + "description": "Windows preset for library developers", + "inherits": [ + "release" + ] + } + ] +} diff --git a/docs/Doxyfile b/docs/Doxyfile index 9b9a0a47..c988dd29 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -68,7 +68,7 @@ PROJECT_LOGO = docs/beman-logo.png # entered, it will be relative to the location where doxygen was started. If # left blank the current directory will be used. -OUTPUT_DIRECTORY = +OUTPUT_DIRECTORY = docs # If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096 # sub-directories (in 2 levels) under the output directory of each output format @@ -86,7 +86,7 @@ CREATE_SUBDIRS = NO # level increment doubles the number of directories, resulting in 4096 # directories at level 8 which is the default and also the maximum value. The # sub-directories are organized in 2 levels, the first level always has a fixed -# numer of 16 directories. +# number of 16 directories. # Minimum value: 0, maximum value: 8, default value: 8. # This tag requires that the tag CREATE_SUBDIRS is set to YES. diff --git a/docs/overview.md b/docs/overview.md index 3a8313c2..99d4384d 100644 --- a/docs/overview.md +++ b/docs/overview.md @@ -19,7 +19,7 @@ When an asynchronous operation completes it _signals_ its completion by calling
environment -The term _enviroment_ refers to the bag of properties associated with an _object_ by the call std::execution::get_env(_object_). By default the environment for objects is empty (std::execution::empty_env). In particular, enviroments associated with receivers are used to provide access to properties like the stop token, scheduler, or allocator associated with the receiver. The various properties associated with an object are accessed via queries. +The term _enviroment_ refers to the bag of properties associated with an _object_ by the call std::execution::get_env(_object_). By default the environment for objects is empty (std::execution::empty_env). In particular, environments associated with receivers are used to provide access to properties like the stop token, scheduler, or allocator associated with the receiver. The various properties associated with an object are accessed via queries.
## Concepts diff --git a/docs/questions.md b/docs/questions.md index 73a709f1..fd070514 100644 --- a/docs/questions.md +++ b/docs/questions.md @@ -26,7 +26,7 @@ likely observable. - [exec.run.loop.types] p9.2: "get_stop_token(REC(o))": REC is a receiver, any environment would be attached to get_env(REC(o)). - [exec.into.variant] p2: the sender argument to into_variant really needs to - have completion_signatures defined - should the constaint be sender_in + have completion_signatures defined - should the constraint be sender_in instead of sender? oh, actually, only the result of transform_sender needs to be a sender_in! - [exec.sync.wait] p4.2: what is "e"? probably apply_sender(...) @@ -43,7 +43,7 @@ likely observable. supposed to work? I don't see a reason why a value completion is necessarily required. As is, they are not because type_idenity_t ends up being used without argument. -- [exec.then] p5 seems to miss a space betweend sendr and out_sndr +- [exec.then] p5 seems to miss a space between sendr and out_sndr - [exec.let] p9: Env is not defined; it is probably meant to be env_t - [exec.schedule.from] p6: the Rcvr in state-type shouldn't be a reference - [exec.when.all] uses on-stop-request without saying what it actually does. diff --git a/etc/ci-clang-toolchain.cmake b/etc/ci-clang-toolchain.cmake index 75531eee..e3d42ee3 100755 --- a/etc/ci-clang-toolchain.cmake +++ b/etc/ci-clang-toolchain.cmake @@ -4,13 +4,16 @@ set(CMAKE_C_COMPILER clang) set(CMAKE_CXX_COMPILER clang++) set(CMAKE_CXX_FLAGS - "-std=c++20 \ + "-std=c++20 \ -Wall -Wextra \ -stdlib=libc++ -fexperimental-library" -CACHE STRING "CXX_FLAGS" FORCE) + CACHE STRING "CXX_FLAGS" FORCE +) set(CMAKE_CXX_FLAGS_DEBUG "-O0 -fno-inline -g3" CACHE STRING "C++ DEBUG Flags" FORCE) set(CMAKE_CXX_FLAGS_RELEASE "-Ofast -g0 -DNDEBUG" CACHE STRING "C++ Release Flags" FORCE) set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG" CACHE STRING "C++ RelWithDebInfo Flags" FORCE) set(CMAKE_CXX_FLAGS_TSAN "-O3 -g -DNDEBUG -fsanitize=thread" CACHE STRING "C++ TSAN Flags" FORCE) -set(CMAKE_CXX_FLAGS_ASAN "-O3 -g -DNDEBUG -fsanitize=address -fsanitize=undefined -fsanitize=leak" CACHE STRING "C++ ASAN Flags" FORCE) +set(CMAKE_CXX_FLAGS_ASAN "-O3 -g -DNDEBUG -fsanitize=address -fsanitize=undefined -fsanitize=leak" + CACHE STRING "C++ ASAN Flags" FORCE +) diff --git a/etc/clang-flags.cmake b/etc/clang-flags.cmake index fdb64dc5..80f9f458 100644 --- a/etc/clang-flags.cmake +++ b/etc/clang-flags.cmake @@ -2,9 +2,7 @@ include_guard(GLOBAL) set(CMAKE_CXX_STANDARD 23) -set(CMAKE_CXX_FLAGS - "-stdlib=libc++ -Wall -Wextra " -CACHE STRING "CXX_FLAGS" FORCE) +set(CMAKE_CXX_FLAGS "-stdlib=libc++ -Wall -Wextra" CACHE STRING "CXX_FLAGS" FORCE) set(CMAKE_CXX_FLAGS_DEBUG "-O0 -fno-inline -g3" CACHE STRING "C++ DEBUG Flags" FORCE) set(CMAKE_CXX_FLAGS_RELEASE "-Ofast -g0 -DNDEBUG" CACHE STRING "C++ Release Flags" FORCE) diff --git a/etc/gcc-flags.cmake b/etc/gcc-flags.cmake index 60d6f634..80744580 100644 --- a/etc/gcc-flags.cmake +++ b/etc/gcc-flags.cmake @@ -2,9 +2,7 @@ include_guard(GLOBAL) set(CMAKE_CXX_STANDARD 23) -set(CMAKE_CXX_FLAGS - "-std=c++23 -Wall -Wextra " -CACHE STRING "CXX_FLAGS" FORCE) +set(CMAKE_CXX_FLAGS "-std=c++23 -Wall -Wextra" CACHE STRING "CXX_FLAGS" FORCE) set(CMAKE_CXX_FLAGS_DEBUG "-O0 -fno-inline -g3" CACHE STRING "C++ DEBUG Flags" FORCE) set(CMAKE_CXX_FLAGS_RELEASE "-Ofast -g0 -DNDEBUG" CACHE STRING "C++ Release Flags" FORCE) diff --git a/etc/gcc-toolchain.cmake b/etc/gcc-toolchain.cmake index ab7ec45a..8177e2bb 100755 --- a/etc/gcc-toolchain.cmake +++ b/etc/gcc-toolchain.cmake @@ -3,10 +3,9 @@ include_guard(GLOBAL) set(CMAKE_C_COMPILER gcc) set(CMAKE_CXX_COMPILER g++) -set(CMAKE_CXX_FLAGS - "-std=c++20 \ - -Wall -Wextra " -CACHE STRING "CXX_FLAGS" FORCE) +set(CMAKE_CXX_FLAGS "-std=c++20 \ + -Wall -Wextra" CACHE STRING "CXX_FLAGS" FORCE +) set(CMAKE_CXX_FLAGS_DEBUG "-O0 -fno-inline -g3" CACHE STRING "C++ DEBUG Flags" FORCE) set(CMAKE_CXX_FLAGS_RELEASE "-Ofast -g0 -DNDEBUG" CACHE STRING "C++ Release Flags" FORCE) diff --git a/etc/llvm-16-toolchain.cmake b/etc/llvm-16-toolchain.cmake index ce7beeb8..200b8436 100755 --- a/etc/llvm-16-toolchain.cmake +++ b/etc/llvm-16-toolchain.cmake @@ -4,13 +4,16 @@ set(CMAKE_C_COMPILER clang-16) set(CMAKE_CXX_COMPILER clang++-16) set(CMAKE_CXX_FLAGS - "-std=c++20 \ + "-std=c++20 \ -Wall -Wextra \ -stdlib=libc++ -fexperimental-library" -CACHE STRING "CXX_FLAGS" FORCE) + CACHE STRING "CXX_FLAGS" FORCE +) set(CMAKE_CXX_FLAGS_DEBUG "-O0 -fno-inline -g3" CACHE STRING "C++ DEBUG Flags" FORCE) set(CMAKE_CXX_FLAGS_RELEASE "-Ofast -g0 -DNDEBUG" CACHE STRING "C++ Release Flags" FORCE) set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG" CACHE STRING "C++ RelWithDebInfo Flags" FORCE) set(CMAKE_CXX_FLAGS_TSAN "-O3 -g -DNDEBUG -fsanitize=thread" CACHE STRING "C++ TSAN Flags" FORCE) -set(CMAKE_CXX_FLAGS_ASAN "-O3 -g -DNDEBUG -fsanitize=address -fsanitize=undefined -fsanitize=leak" CACHE STRING "C++ ASAN Flags" FORCE) +set(CMAKE_CXX_FLAGS_ASAN "-O3 -g -DNDEBUG -fsanitize=address -fsanitize=undefined -fsanitize=leak" + CACHE STRING "C++ ASAN Flags" FORCE +) diff --git a/etc/llvm-master-toolchain.cmake b/etc/llvm-master-toolchain.cmake index cc09e505..c38100b3 100644 --- a/etc/llvm-master-toolchain.cmake +++ b/etc/llvm-master-toolchain.cmake @@ -4,17 +4,18 @@ set(CMAKE_C_COMPILER ${LLVM_ROOT}/bin/clang) set(CMAKE_CXX_COMPILER ${LLVM_ROOT}/bin/clang++) set(CMAKE_CXX_FLAGS - "-std=c++2a \ + "-std=c++2a \ -Wall -Wextra \ - -stdlib=libc++ " -CACHE STRING "CXX_FLAGS" FORCE) + -stdlib=libc++" + CACHE STRING "CXX_FLAGS" FORCE +) -set(CMAKE_EXE_LINKER_FLAGS - "-Wl,-rpath,${LLVM_ROOT}/lib" -CACHE STRING "CMAKE_EXE_LINKER_FLAGS" FORCE) +set(CMAKE_EXE_LINKER_FLAGS "-Wl,-rpath,${LLVM_ROOT}/lib" CACHE STRING "CMAKE_EXE_LINKER_FLAGS" FORCE) set(CMAKE_CXX_FLAGS_DEBUG "-O0 -fno-inline -g3" CACHE STRING "C++ DEBUG Flags" FORCE) set(CMAKE_CXX_FLAGS_RELEASE "-Ofast -g0 -DNDEBUG" CACHE STRING "C++ Release Flags" FORCE) set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG" CACHE STRING "C++ Release Flags" FORCE) set(CMAKE_CXX_FLAGS_TSAN "-O3 -g -DNDEBUG -fsanitize=thread" CACHE STRING "C++ TSAN Flags" FORCE) -set(CMAKE_CXX_FLAGS_ASAN "-O3 -g -DNDEBUG -fsanitize=address -fsanitize=undefined -fsanitize=leak" CACHE STRING "C++ ASAN Flags" FORCE) +set(CMAKE_CXX_FLAGS_ASAN "-O3 -g -DNDEBUG -fsanitize=address -fsanitize=undefined -fsanitize=leak" + CACHE STRING "C++ ASAN Flags" FORCE +) diff --git a/etc/llvm-toolchain.cmake b/etc/llvm-toolchain.cmake index 5bd9225e..907007dd 100755 --- a/etc/llvm-toolchain.cmake +++ b/etc/llvm-toolchain.cmake @@ -4,13 +4,16 @@ set(CMAKE_C_COMPILER clang-14) set(CMAKE_CXX_COMPILER clang++-14) set(CMAKE_CXX_FLAGS - "-std=c++20 \ + "-std=c++20 \ -Wall -Wextra \ -stdlib=libstdc++ " -CACHE STRING "CXX_FLAGS" FORCE) + CACHE STRING "CXX_FLAGS" FORCE +) set(CMAKE_CXX_FLAGS_DEBUG "-O0 -fno-inline -g3" CACHE STRING "C++ DEBUG Flags" FORCE) set(CMAKE_CXX_FLAGS_RELEASE "-Ofast -g0 -DNDEBUG" CACHE STRING "C++ Release Flags" FORCE) set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG" CACHE STRING "C++ RelWithDebInfo Flags" FORCE) set(CMAKE_CXX_FLAGS_TSAN "-O3 -g -DNDEBUG -fsanitize=thread" CACHE STRING "C++ TSAN Flags" FORCE) -set(CMAKE_CXX_FLAGS_ASAN "-O3 -g -DNDEBUG -fsanitize=address -fsanitize=undefined -fsanitize=leak" CACHE STRING "C++ ASAN Flags" FORCE) +set(CMAKE_CXX_FLAGS_ASAN "-O3 -g -DNDEBUG -fsanitize=address -fsanitize=undefined -fsanitize=leak" + CACHE STRING "C++ ASAN Flags" FORCE +) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index a97c26eb..becc56ce 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -3,7 +3,15 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # cmake-format: on -list(APPEND EXAMPLES sender-demo when_all-cancel stop_token stopping allocator) +list( + APPEND + EXAMPLES + sender-demo + when_all-cancel + stop_token + stopping + allocator +) foreach(EXAMPLE ${EXAMPLES}) set(EXAMPLE_TARGET ${TARGET_PREFIX}.examples.${EXAMPLE}) diff --git a/examples/stop_token.cpp b/examples/stop_token.cpp index b7c88be9..1a1cf73d 100644 --- a/examples/stop_token.cpp +++ b/examples/stop_token.cpp @@ -19,7 +19,7 @@ namespace exec = beman::execution26; // There are two different needs on how the cancallation is // indicated: // - Active work, e.g., doing a lengthy computation, -// would occassionally check the results are still needed +// would occasionally check the results are still needed // and abort the computation if it is not. To do so, the // function would use token.stop_requested() which yields // true once stopping was requested. diff --git a/include/beman/execution26/detail/allocator_aware_move.hpp b/include/beman/execution26/detail/allocator_aware_move.hpp index a1eeb3e7..d333880f 100644 --- a/include/beman/execution26/detail/allocator_aware_move.hpp +++ b/include/beman/execution26/detail/allocator_aware_move.hpp @@ -15,7 +15,7 @@ namespace beman::execution26::detail { template /*! - * \brief Utilitiy function use to move a possibly allocator aware object with an allocator from an environment. + * \brief Utility function use to move a possibly allocator aware object with an allocator from an environment. * \headerfile beman/execution26/execution.hpp * \internal */ diff --git a/include/beman/execution26/detail/basic_sender.hpp b/include/beman/execution26/detail/basic_sender.hpp index 4445b5e1..a05a5ce4 100644 --- a/include/beman/execution26/detail/basic_sender.hpp +++ b/include/beman/execution26/detail/basic_sender.hpp @@ -39,7 +39,7 @@ struct basic_sender : ::beman::execution26::detail::product_type - requires(not ::beman::execution26::receiver) + requires(not::beman::execution26::receiver) auto connect(Receiver receiver) = BEMAN_EXECUTION26_DELETE("the passed receiver doesn't model receiver"); #if __cpp_explicit_this_parameter < 202110L template <::beman::execution26::receiver Receiver> diff --git a/include/beman/execution26/detail/common.hpp b/include/beman/execution26/detail/common.hpp index e52a2755..ea4ff09b 100644 --- a/include/beman/execution26/detail/common.hpp +++ b/include/beman/execution26/detail/common.hpp @@ -6,7 +6,7 @@ // ---------------------------------------------------------------------------- -#if defined(__cpp_deleted_function) +#if defined(disabled__cpp_deleted_function) #define BEMAN_EXECUTION26_DELETE(msg) delete (msg) #else #define BEMAN_EXECUTION26_DELETE(msg) delete diff --git a/include/beman/execution26/detail/default_domain.hpp b/include/beman/execution26/detail/default_domain.hpp index 1e9c497b..57ed730f 100644 --- a/include/beman/execution26/detail/default_domain.hpp +++ b/include/beman/execution26/detail/default_domain.hpp @@ -25,9 +25,9 @@ struct default_domain { ::std::forward(env)...); } static constexpr auto transform_sender(Sender&& sender, Env&&... env) noexcept( - noexcept(::beman::execution26::tag_of_t().transform_sender( - ::std::forward(sender), ::std::forward(env)...))) -> ::beman::execution26::sender - decltype(auto) { + noexcept(::beman::execution26::tag_of_t().transform_sender(::std::forward(sender), + ::std::forward(env)...))) + -> ::beman::execution26::sender decltype(auto) { return ::beman::execution26::tag_of_t().transform_sender(::std::forward(sender), ::std::forward(env)...); } @@ -37,8 +37,9 @@ struct default_domain { ::beman::execution26::tag_of_t().transform_sender(::std::forward(sender), ::std::forward(env)...); }) - static constexpr auto transform_sender(Sender&& sender, Env&&...) noexcept( - noexcept(::std::forward(sender))) -> ::beman::execution26::sender decltype(auto) { + static constexpr auto transform_sender(Sender&& sender, + Env&&...) noexcept(noexcept(::std::forward(sender))) + -> ::beman::execution26::sender decltype(auto) { return ::std::forward(sender); } @@ -55,9 +56,9 @@ struct default_domain { template <::beman::execution26::sender Sender, ::beman::execution26::detail::queryable Env> requires(not requires(Sender&& sender, Env&& env) { - ::beman::execution26::tag_of_t().transform_env(::std::forward(sender), - ::std::forward(env)); - }) + ::beman::execution26::tag_of_t().transform_env(::std::forward(sender), + ::std::forward(env)); + }) static constexpr auto transform_env(Sender&&, Env&& env) noexcept -> ::beman::execution26::detail::queryable decltype(auto) { return static_cast(::std::forward(env)); diff --git a/include/beman/execution26/detail/forward_like.hpp b/include/beman/execution26/detail/forward_like.hpp index 55986d37..b3297b6b 100644 --- a/include/beman/execution26/detail/forward_like.hpp +++ b/include/beman/execution26/detail/forward_like.hpp @@ -60,7 +60,7 @@ auto own_forward_like(U&& u) noexcept -> decltype(auto) { template auto forward_like(U&& u) noexcept -> decltype(auto) { -#if 202207 <= __cpp_lib_forward_like +#if 202207 <= disabled__cpp_lib_forward_like return ::std::forward_like(::std::forward(u)); #else return ::beman::execution26::detail::forward_like_helper::forward(::std::forward(u)); diff --git a/include/beman/execution26/detail/get_domain.hpp b/include/beman/execution26/detail/get_domain.hpp index b1a13d8f..3e8fd4d0 100644 --- a/include/beman/execution26/detail/get_domain.hpp +++ b/include/beman/execution26/detail/get_domain.hpp @@ -16,8 +16,7 @@ struct get_domain_t { requires(not requires(Object&& object, const get_domain_t& tag) { ::std::forward(object).query(tag); }) && (not requires(Object&& object, const get_domain_t& tag) { ::std::as_const(object).query(tag); }) - auto - operator()(Object&&) const noexcept = BEMAN_EXECUTION26_DELETE("object neeeds a query(get_domain_t) overload"); + auto operator()(Object&&) const noexcept = BEMAN_EXECUTION26_DELETE("object needs a query(get_domain_t) overload"); template requires(not requires(Object&& object, const get_domain_t& tag) { ::std::as_const(object).query(tag); }) auto diff --git a/include/beman/execution26/detail/schedule_from.hpp b/include/beman/execution26/detail/schedule_from.hpp index c4a17d01..16f3a22c 100644 --- a/include/beman/execution26/detail/schedule_from.hpp +++ b/include/beman/execution26/detail/schedule_from.hpp @@ -80,7 +80,7 @@ struct impls_for<::beman::execution26::detail::schedule_from_t> : ::beman::execu auto set_value() && noexcept -> void { ::std::visit( [this](Tuple& result) noexcept -> void { - if constexpr (not ::std::same_as<::std::monostate, Tuple>) { + if constexpr (not::std::same_as<::std::monostate, Tuple>) { ::std::apply([this](auto&& tag, auto&&... args) { tag(std::move(state->receiver), std::move(args)...); }, result); diff --git a/include/beman/execution26/detail/set_error.hpp b/include/beman/execution26/detail/set_error.hpp index 9dc584f8..8e2a023f 100644 --- a/include/beman/execution26/detail/set_error.hpp +++ b/include/beman/execution26/detail/set_error.hpp @@ -1,4 +1,4 @@ -// inclue/beman/execution26/detail/set_error.hpp -*-C++-*- +// include/beman/execution26/detail/set_error.hpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #ifndef INCLUDED_BEMAN_EXECUTION26_DETAIL_SET_ERROR diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..ce10eedf --- /dev/null +++ b/requirements.txt @@ -0,0 +1,23 @@ +# ============================================================================= +# PYTHON PACKAGES (PIP) +# ============================================================================= +# USE (python3): pip3 install -U -r +# ============================================================================= + +### python tools +isort +black +pip-tools +pylint +pyaml + +### cmake build context +bump2version>=1.0.1 +check-jsonschema>=0.29.4 +cmake-format>=0.6.13 +cmake>=3.30 +codespell>=2.3.0 +# conan>=2.7.0 +gcovr>=7.2 +ninja>=1.12 +yamllint>=1.35 diff --git a/tests/beman/execution26/CMakeLists.txt b/tests/beman/execution26/CMakeLists.txt index 098f0438..664c34da 100644 --- a/tests/beman/execution26/CMakeLists.txt +++ b/tests/beman/execution26/CMakeLists.txt @@ -4,6 +4,10 @@ cmake_minimum_required(VERSION 3.25...3.31) project(beman_execution26_tests LANGUAGES CXX) +if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + message(FATAL_ERROR "In-source builds are not allowed!") +endif() + list( APPEND execution_tests @@ -92,25 +96,33 @@ list( include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) +if(NOT DEFINED CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 23) +endif() + +if(NOT DEFINED CMAKE_PREFIX_PATH) + set(CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}) +endif() + if(PROJECT_IS_TOP_LEVEL) - set(TARGET_ALIAS beman_execution26::beman_execution26) enable_testing() find_package(beman_execution26 0.0.1 EXACT QUIET) if(beman_execution26_FOUND) set(execution_tests exec-awaitable.test) # only one sample to save time! CK else() - add_subdirectory(../../../.. beman_execution26) - include_directories(${PROJECT_SOURCE_DIR}/include) + add_subdirectory(../../.. beman_execution26) include(CMakePrintHelpers) cmake_print_variables(TARGET_ALIAS TARGET_LIBRARY TARGET_PREFIX PROJECT_SOURCE_DIR) endif() endif() +remove_definitions(-DNDEBUG) # NOTE: we want ASSERT statements in Release too! CK + foreach(test ${execution_tests}) set(TEST_EXE ${TARGET_PREFIX}.${test}) add_executable(${TEST_EXE} ${test}.cpp) - target_link_libraries(${TEST_EXE} PRIVATE ${TARGET_ALIAS}) + target_link_libraries(${TEST_EXE} PRIVATE beman_execution26::beman_execution26) add_test(NAME ${TEST_EXE} COMMAND $) endforeach() diff --git a/tests/beman/execution26/stopcallback-cons.test.cpp b/tests/beman/execution26/stopcallback-cons.test.cpp index 395ea748..b95108ba 100644 --- a/tests/beman/execution26/stopcallback-cons.test.cpp +++ b/tests/beman/execution26/stopcallback-cons.test.cpp @@ -31,7 +31,7 @@ TEST(stopcallback_cons) { // done is to verify that construction and destruction works even if the // callback is the only owner of the state. // - Given a stop_callback constructed from an engaged stop_token. - // - When the corresponding stop_source and stop_token are destoryed. + // - When the corresponding stop_source and stop_token are destroyed. // - Then the callback can still be destroyed without issues. auto source = ::std::make_unique<::test_std::stop_source>(); diff --git a/tests/beman/execution26/stopsource-mem.test.cpp b/tests/beman/execution26/stopsource-mem.test.cpp index e1233978..2ef94641 100644 --- a/tests/beman/execution26/stopsource-mem.test.cpp +++ b/tests/beman/execution26/stopsource-mem.test.cpp @@ -54,7 +54,7 @@ auto test_stopsource_stop_possible() -> void { // - Given an engaged and a disengaged stop sources. // - When using stop_possible() // - Then the result is true for the engaged stop source (both - // before request_stop() was calle and after) while + // before request_stop() was called and after) while // the result is false for the disengaged stop source. // Reference: [stopsource.mem] p3