From 7c45940b00893e2722e1480092a3fcc39df1b5f6 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Sat, 2 Nov 2024 08:06:50 +0100 Subject: [PATCH 01/27] CMake-format cmake modules too --- etc/ci-clang-toolchain.cmake | 9 ++++++--- etc/clang-flags.cmake | 4 +--- etc/gcc-flags.cmake | 4 +--- etc/gcc-toolchain.cmake | 7 +++---- etc/llvm-16-toolchain.cmake | 9 ++++++--- etc/llvm-master-toolchain.cmake | 13 +++++++------ etc/llvm-toolchain.cmake | 9 ++++++--- 7 files changed, 30 insertions(+), 25 deletions(-) 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..76329033 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..f9f84619 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..048a7f47 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..aeafd877 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) + 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 +) From 78dc1c26a1506081189d283cd7dc440697bfe5bf Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Sat, 2 Nov 2024 08:18:31 +0100 Subject: [PATCH 02/27] Update how to build this project --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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/). From fb2500bf93aef3e2dac63e16343665465ef18c8e Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Sat, 2 Nov 2024 08:19:06 +0100 Subject: [PATCH 03/27] Fix typos with codespell --- examples/stop_token.cpp | 2 +- include/beman/execution26/detail/get_domain.hpp | 2 +- include/beman/execution26/detail/set_error.hpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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/get_domain.hpp b/include/beman/execution26/detail/get_domain.hpp index b1a13d8f..53866593 100644 --- a/include/beman/execution26/detail/get_domain.hpp +++ b/include/beman/execution26/detail/get_domain.hpp @@ -17,7 +17,7 @@ struct get_domain_t { ::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"); + 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/set_error.hpp b/include/beman/execution26/detail/set_error.hpp index 639fe0e9..7bb004f0 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 From fbe7604c353344e9c547f987978fb533f0892568 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Sat, 2 Nov 2024 08:22:58 +0100 Subject: [PATCH 04/27] Format python files witch black --- bin/mk-compiler-explorer.py | 36 ++++++++++++++++++++++-------------- bin/mk-deps.py | 8 +++++--- bin/mk-todo.py | 13 ++++++++----- bin/update-cmake-headers.py | 24 ++++++++++++++---------- 4 files changed, 49 insertions(+), 32 deletions(-) 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 From 80ce062489beb3970d86d24e65feac25647a6eb8 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Sat, 2 Nov 2024 13:16:50 +0100 Subject: [PATCH 05/27] In-source builds are not allowed now --- .gitignore | 4 ++++ CMakeLists.txt | 4 ++++ requirements.txt | 23 +++++++++++++++++++++++ tests/beman/execution26/CMakeLists.txt | 11 +++++++---- 4 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore index 8dd03455..b5c2dcd2 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,7 @@ olderr .vs .vscode stagedir + +# In-source builds are not allowed +CMakeCache.txt +CMakeFiles/ diff --git a/CMakeLists.txt b/CMakeLists.txt index efb11e81..242b5217 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,10 @@ set(TARGET_ALIAS ${TARGET_LIBRARY}::${TARGET_LIBRARY}) set(TARGET_PACKAGE_NAME ${PROJECT_NAME}-config) set(TARGETS_EXPORT_NAME ${PROJECT_NAME}-targets) +if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + message(FATAL_ERROR "In-source builds are not allowed!") +endif() + include(GNUInstallDirs) set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) 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..ff7c2aa5 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 @@ -93,24 +97,23 @@ list( include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 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) + # FIXME: include_directories(${PROJECT_SOURCE_DIR}/include) endif() endif() 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() From 74161e02a2ccfa754c565486f442afbc6bc1dd0c Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Sat, 2 Nov 2024 13:37:22 +0100 Subject: [PATCH 06/27] Add apple clang compiler to CI test --- .github/workflows/macos.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 4aaf4a6c..8fdcc452 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -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,7 +39,7 @@ 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 @@ -47,3 +47,7 @@ jobs: - name: macos ${{ matrix.compiler }} ${{ matrix.sanitizer }} if: startsWith(matrix.compiler, 'clang') run: CXX=$(brew --prefix llvm@18)/bin/clang++ make ${{ matrix.sanitizer }} + + - name: macos ${{ matrix.compiler }} ${{ matrix.sanitizer }} + if: startsWith(matrix.compiler, 'g++') + run: CXX=${{ matrix.compiler }} make ${{ matrix.sanitizer }} From a3fab155b0e348bdca7cff5c0ed97c104c6c60e0 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Sat, 2 Nov 2024 17:13:37 +0100 Subject: [PATCH 07/27] Quickfix --- CMakeLists.txt | 8 -------- CMakePresets.json | 2 +- etc/clang-flags.cmake | 2 +- etc/gcc-flags.cmake | 2 +- etc/gcc-toolchain.cmake | 2 +- etc/llvm-master-toolchain.cmake | 2 +- tests/beman/execution26/CMakeLists.txt | 9 ++++++++- 7 files changed, 13 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 242b5217..7ca69049 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,14 +22,6 @@ endif() include(GNUInstallDirs) set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) -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() - add_subdirectory(src/beman/execution26) if(PROJECT_IS_TOP_LEVEL) diff --git a/CMakePresets.json b/CMakePresets.json index bb89f325..c443304d 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -23,7 +23,7 @@ "hidden": true, "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug", - "CMAKE_CXX_FLAGS": "-fsanitize=address -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=leak -fsanitize=undefined" + "CMAKE_CXX_FLAGS": "-fsanitize=address -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=undefined" }, "condition": { "type": "notEquals", diff --git a/etc/clang-flags.cmake b/etc/clang-flags.cmake index 76329033..80f9f458 100644 --- a/etc/clang-flags.cmake +++ b/etc/clang-flags.cmake @@ -2,7 +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 f9f84619..80744580 100644 --- a/etc/gcc-flags.cmake +++ b/etc/gcc-flags.cmake @@ -2,7 +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 048a7f47..8177e2bb 100755 --- a/etc/gcc-toolchain.cmake +++ b/etc/gcc-toolchain.cmake @@ -4,7 +4,7 @@ set(CMAKE_C_COMPILER gcc) set(CMAKE_CXX_COMPILER g++) set(CMAKE_CXX_FLAGS "-std=c++20 \ - -Wall -Wextra " CACHE STRING "CXX_FLAGS" FORCE + -Wall -Wextra" CACHE STRING "CXX_FLAGS" FORCE ) set(CMAKE_CXX_FLAGS_DEBUG "-O0 -fno-inline -g3" CACHE STRING "C++ DEBUG Flags" FORCE) diff --git a/etc/llvm-master-toolchain.cmake b/etc/llvm-master-toolchain.cmake index aeafd877..c38100b3 100644 --- a/etc/llvm-master-toolchain.cmake +++ b/etc/llvm-master-toolchain.cmake @@ -6,7 +6,7 @@ set(CMAKE_CXX_COMPILER ${LLVM_ROOT}/bin/clang++) set(CMAKE_CXX_FLAGS "-std=c++2a \ -Wall -Wextra \ - -stdlib=libc++ " + -stdlib=libc++" CACHE STRING "CXX_FLAGS" FORCE ) diff --git a/tests/beman/execution26/CMakeLists.txt b/tests/beman/execution26/CMakeLists.txt index ff7c2aa5..8214f5cf 100644 --- a/tests/beman/execution26/CMakeLists.txt +++ b/tests/beman/execution26/CMakeLists.txt @@ -96,6 +96,14 @@ 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) enable_testing() find_package(beman_execution26 0.0.1 EXACT QUIET) @@ -106,7 +114,6 @@ if(PROJECT_IS_TOP_LEVEL) include(CMakePrintHelpers) cmake_print_variables(TARGET_ALIAS TARGET_LIBRARY TARGET_PREFIX PROJECT_SOURCE_DIR) - # FIXME: include_directories(${PROJECT_SOURCE_DIR}/include) endif() endif() From 270d10d77145695241b69cdb86b1b2e5edcb7fab Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Sat, 2 Nov 2024 17:52:33 +0100 Subject: [PATCH 08/27] Restructure CMake Presets --- CMakePresets.json | 69 ++++------------------------------ cmake/CMakeDarwinPresets.json | 50 ++++++++++++++++++++++++ cmake/CMakeGenericPresets.json | 22 +++++++++++ cmake/CMakeLinuxPresets.json | 50 ++++++++++++++++++++++++ 4 files changed, 130 insertions(+), 61 deletions(-) create mode 100644 cmake/CMakeDarwinPresets.json create mode 100644 cmake/CMakeGenericPresets.json create mode 100644 cmake/CMakeLinuxPresets.json diff --git a/CMakePresets.json b/CMakePresets.json index c443304d..cf703844 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -1,65 +1,12 @@ { - "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=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": [ { 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..c4c4eeb7 --- /dev/null +++ b/cmake/CMakeGenericPresets.json @@ -0,0 +1,22 @@ +{ + "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 + } + } + ] +} diff --git a/cmake/CMakeLinuxPresets.json b/cmake/CMakeLinuxPresets.json new file mode 100644 index 00000000..f8d41d5a --- /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": "notEquals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "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" + ] + } + ] +} From fc8d5106c85b03a0e3217053a7437a5bc0997f98 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Sat, 2 Nov 2024 18:04:21 +0100 Subject: [PATCH 09/27] Add codespell target to Makefile --- Makefile | 5 ++++- docs/overview.md | 2 +- docs/questions.md | 4 ++-- tests/beman/execution26/stopcallback-cons.test.cpp | 2 +- tests/beman/execution26/stopsource-mem.test.cpp | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 2d2d0bec..15317098 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception SANITIZERS = release debug msan asan usan tsan -.PHONY: default run update check ce todo distclean clean build test all $(SANITIZERS) +.PHONY: default run update check ce todo distclean clean codespell build test all $(SANITIZERS) COMPILER=system CXX_BASE=$(CXX:$(dir $(CXX))%=%) @@ -79,6 +79,9 @@ check: < $$h sed -n "/^ *# *include .*@$$from \1@p"; \ done | tsort > /dev/null +codespell: + codespell -L statics + todo: bin/mk-todo.py 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/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 From 37e9818c059adfa55017ab46e86645f704dbc2f6 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Sat, 2 Nov 2024 18:13:59 +0100 Subject: [PATCH 10/27] Add codespell ignore list and rc file --- .codespellrc | 6 ++++++ Makefile | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .codespellrc diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 00000000..d2d83cf3 --- /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/*,*.log,.*.swp,*~,*.bak,Makefile +quiet-level = 2 +# ignore-words = .ignore-words diff --git a/Makefile b/Makefile index 15317098..ae81cde9 100644 --- a/Makefile +++ b/Makefile @@ -80,7 +80,7 @@ check: done | tsort > /dev/null codespell: - codespell -L statics + codespell -L statics,snd,copyable,cancelled todo: bin/mk-todo.py From 056d687fade1e8f4c9ada921f976dea037fd97cd Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Sun, 3 Nov 2024 19:31:05 +0100 Subject: [PATCH 11/27] Add Windows preset too --- CMakeLists.txt | 2 ++ CMakePresets.json | 16 ++++++++++++++++ cmake/CMakeWindowsPresets.json | 31 +++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 cmake/CMakeWindowsPresets.json diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ca69049..235b3dc3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,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 cf703844..1cb31708 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -50,6 +50,18 @@ "configurePreset": "release" } ], + "packagePresets": [ + { + "name": "release", + "configurePreset": "release", + "configurations": [ + "Release" + ], + "generators": [ + "TGZ" + ] + } + ], "workflowPresets": [ { "name": "debug", @@ -82,6 +94,10 @@ { "type": "test", "name": "release" + }, + { + "type": "package", + "name": "release" } ] } diff --git a/cmake/CMakeWindowsPresets.json b/cmake/CMakeWindowsPresets.json new file mode 100644 index 00000000..b5c8ff39 --- /dev/null +++ b/cmake/CMakeWindowsPresets.json @@ -0,0 +1,31 @@ +{ + "version": 9, + "include": [ + "CMakeGenericPresets.json" + ], + "configurePresets": [ + { + "name": "release", + "description": "Windows preset for library developers", + "generator": "Visual Studio 17 2022", + "inherits": [ + "root-config" + ], + "cacheVariables": { + "CMAKE_CXX_FLAGS": "/W4 /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" + ] + } + ] +} From b9c89845b2816e7b9eeb7ba7f98f7cf09191872e Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Sun, 3 Nov 2024 19:43:51 +0100 Subject: [PATCH 12/27] Test clang++-18 on linux CI too --- .github/workflows/linux.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index c4400449..6b2f6049 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -30,8 +30,7 @@ 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++-18] steps: - uses: actions/checkout@v4 From 2ed4c45a96954dbd84a384fb0c4f0f5dec28444e Mon Sep 17 00:00:00 2001 From: Claus Klein Date: Mon, 4 Nov 2024 08:37:55 +0100 Subject: [PATCH 13/27] Fix Windows preset --- CMakePresets.json | 2 -- cmake/CMakeLinuxPresets.json | 4 ++-- cmake/CMakeWindowsPresets.json | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index 1cb31708..eda894a9 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -13,7 +13,6 @@ "name": "debug", "configurePreset": "debug", "targets": [ - "all", "install" ] }, @@ -21,7 +20,6 @@ "name": "release", "configurePreset": "release", "targets": [ - "all", "all_verify_interface_header_sets", "install" ] diff --git a/cmake/CMakeLinuxPresets.json b/cmake/CMakeLinuxPresets.json index f8d41d5a..3e186643 100644 --- a/cmake/CMakeLinuxPresets.json +++ b/cmake/CMakeLinuxPresets.json @@ -12,9 +12,9 @@ "CMAKE_CXX_FLAGS": "-fsanitize=address -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=leak -fsanitize=undefined" }, "condition": { - "type": "notEquals", + "type": "equals", "lhs": "${hostSystemName}", - "rhs": "Windows" + "rhs": "Linux" } }, { diff --git a/cmake/CMakeWindowsPresets.json b/cmake/CMakeWindowsPresets.json index b5c8ff39..f6508c9c 100644 --- a/cmake/CMakeWindowsPresets.json +++ b/cmake/CMakeWindowsPresets.json @@ -12,7 +12,7 @@ "root-config" ], "cacheVariables": { - "CMAKE_CXX_FLAGS": "/W4 /EHsc /w14242 /w14254 /w14263 /w14265 /w14287 /w14289 /w14296 /w14311 /w14545 /w14546 /w14547 /w14549 /w14555 /w14640 /w14826 /w14928 /WX" + "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", From ed03fd7f4da9fb8463641fc19323527a00dc4644 Mon Sep 17 00:00:00 2001 From: Claus Klein Date: Mon, 4 Nov 2024 09:00:15 +0100 Subject: [PATCH 14/27] Add missing configuration setting for VS generator --- CMakePresets.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakePresets.json b/CMakePresets.json index eda894a9..2fd4ebdc 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -12,6 +12,7 @@ { "name": "debug", "configurePreset": "debug", + "configuration": "Debug", "targets": [ "install" ] @@ -19,6 +20,7 @@ { "name": "release", "configurePreset": "release", + "configuration": "Release", "targets": [ "all_verify_interface_header_sets", "install" @@ -40,11 +42,13 @@ { "name": "debug", "inherits": "test_base", + "configuration": "Debug", "configurePreset": "debug" }, { "name": "release", "inherits": "test_base", + "configuration": "Release", "configurePreset": "release" } ], From 303cca674e777409a2cd2867b826024cda7fcdb9 Mon Sep 17 00:00:00 2001 From: Claus Klein Date: Mon, 4 Nov 2024 10:06:16 +0100 Subject: [PATCH 15/27] Set CMAKE_SKIP_TEST_ALL_DEPENDENCY too --- cmake/CMakeGenericPresets.json | 3 ++- cmake/CMakeWindowsPresets.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/CMakeGenericPresets.json b/cmake/CMakeGenericPresets.json index c4c4eeb7..7014512d 100644 --- a/cmake/CMakeGenericPresets.json +++ b/cmake/CMakeGenericPresets.json @@ -15,7 +15,8 @@ "CMAKE_CXX_EXTENSIONS": false, "CMAKE_CXX_STANDARD": "23", "CMAKE_CXX_STANDARD_REQUIRED": true, - "CMAKE_EXPORT_COMPILE_COMMANDS": true + "CMAKE_EXPORT_COMPILE_COMMANDS": true, + "CMAKE_SKIP_TEST_ALL_DEPENDENCY": false } } ] diff --git a/cmake/CMakeWindowsPresets.json b/cmake/CMakeWindowsPresets.json index f6508c9c..52fbda28 100644 --- a/cmake/CMakeWindowsPresets.json +++ b/cmake/CMakeWindowsPresets.json @@ -1,5 +1,5 @@ { - "version": 9, + "version": 6, "include": [ "CMakeGenericPresets.json" ], From 904749cca54b01a7e83c5ef3ede687d71c8c8add Mon Sep 17 00:00:00 2001 From: Claus Klein Date: Mon, 4 Nov 2024 10:59:41 +0100 Subject: [PATCH 16/27] Try to use clang-19 on CI --- .github/workflows/linux.yml | 6 +++--- .github/workflows/macos.yml | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 6b2f6049..3cf35884 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -30,18 +30,18 @@ jobs: matrix: # TODO: sanitizer: [debug, release, asan, usan, tsan] sanitizer: [debug, release] - compiler: [g++-14, clang++-18] + 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 apt-get install clang-tidy-19 ninja-build -y -q sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy - /usr/bin/clang-tidy-18 140 + /usr/bin/clang-tidy-19 140 - 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 8fdcc452..f4b7f469 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -39,15 +39,15 @@ jobs: # if: startsWith(matrix.compiler, 'clang') uses: aminya/setup-cpp@v1 with: - # TODO: compiler: llvm-19 + compiler: llvm-19 # clangtidy: true # cmake: true ninja: true - - name: macos ${{ matrix.compiler }} ${{ matrix.sanitizer }} + - name: macos clang++-19 ${{ matrix.sanitizer }} if: startsWith(matrix.compiler, 'clang') - run: CXX=$(brew --prefix llvm@18)/bin/clang++ make ${{ matrix.sanitizer }} + run: CXX=$(brew --prefix llvm@19)/bin/clang++ make ${{ matrix.sanitizer }} - - name: macos ${{ matrix.compiler }} ${{ matrix.sanitizer }} + - name: macos g++ ${{ matrix.sanitizer }} if: startsWith(matrix.compiler, 'g++') run: CXX=${{ matrix.compiler }} make ${{ matrix.sanitizer }} From 7815a35bd307d19a74c4bcffc59aafec6d5d2a02 Mon Sep 17 00:00:00 2001 From: Claus Klein Date: Mon, 4 Nov 2024 11:36:10 +0100 Subject: [PATCH 17/27] Use workarounds to install llvm-19 --- .github/workflows/linux.yml | 14 +++++++------- .github/workflows/macos.yml | 15 ++++++++++----- .github/workflows/windows.yml | 4 ++-- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 3cf35884..207b2760 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/**" @@ -35,13 +35,13 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Install static analyzers + - name: Install build tools run: >- - sudo apt-get install clang-tidy-19 ninja-build -y -q + sudo apt-get install ninja-build -y -q - sudo update-alternatives --install - /usr/bin/clang-tidy clang-tidy - /usr/bin/clang-tidy-19 140 + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo 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 f4b7f469..8e3da0b5 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/**" @@ -39,14 +39,19 @@ 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 clang++-19 ${{ matrix.sanitizer }} + - name: Install llvm-19 if: startsWith(matrix.compiler, 'clang') - run: CXX=$(brew --prefix llvm@19)/bin/clang++ make ${{ matrix.sanitizer }} + 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++') diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 9f5f003d..67841b69 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/**" From 24f66ecd3327aae1dd6ada503d8aac1b48333958 Mon Sep 17 00:00:00 2001 From: Claus Klein Date: Mon, 4 Nov 2024 11:53:16 +0100 Subject: [PATCH 18/27] Fix typos --- .github/workflows/linux.yml | 3 +-- .github/workflows/macos.yml | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 207b2760..698c2256 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -36,9 +36,8 @@ jobs: - uses: actions/checkout@v4 - name: Install build tools - run: >- + run: | sudo apt-get install ninja-build -y -q - wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh sudo sudo ./llvm.sh 19 # all diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 8e3da0b5..39605052 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -46,8 +46,8 @@ jobs: - name: Install llvm-19 if: startsWith(matrix.compiler, 'clang') - run: >- - brew install llvm-19 | echo ignored + run: | + brew install llvm@19 || echo ignored - name: macos clang++-18 ${{ matrix.sanitizer }} if: startsWith(matrix.compiler, 'clang') From a82f7af480306c311aae6e61be8b18ed703d0ad0 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Mon, 4 Nov 2024 21:35:06 +0100 Subject: [PATCH 19/27] Add cmake workflow preset for windows CI Use 'Ninja Multi-Config' with Windows preset --- .github/workflows/linux.yml | 2 +- .github/workflows/windows.yml | 28 +++++++++++-------- cmake/CMakeWindowsPresets.json | 4 ++- docs/Doxyfile | 2 +- .../detail/allocator_aware_move.hpp | 2 +- tests/beman/execution26/CMakeLists.txt | 2 ++ 6 files changed, 25 insertions(+), 15 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 698c2256..ba17fd1a 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -40,7 +40,7 @@ jobs: sudo apt-get install ninja-build -y -q wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh - sudo sudo ./llvm.sh 19 # all + sudo sudo ./llvm.sh 19 all - name: Linux ${{ matrix.compiler }} ${{ matrix.sanitizer }} run: CXX=${{ matrix.compiler }} make ${{ matrix.sanitizer }} diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 67841b69..6a16da51 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -26,18 +26,24 @@ jobs: runs-on: windows-latest steps: - uses: actions/checkout@v4 + - uses: ilammy/msvc-dev-cmd@v1 + with: "17.XX" # VS 2023 - - name: environment - run: cmake -E make_directory ${{github.workspace}}/build + - name: cmake workflow + run: | + cmake --workflow --preset debug || echo ignored - - name: configure - working-directory: ${{github.workspace}}/build - run: cmake ${{github.workspace}} + # - name: environment + # run: cmake -E make_directory ${{github.workspace}}/build/VS - - name: build - working-directory: ${{github.workspace}}/build - run: cmake --build . --config Release --target all_verify_interface_header_sets install + # - name: configure + # working-directory: ${{github.workspace}}/build/VS + # run: cmake ${{github.workspace}} - - name: ctest - working-directory: ${{github.workspace}}/build - run: ctest --build-config Release --output-on-failure + # - name: build + # working-directory: ${{github.workspace}}/build/VS + # run: cmake --build . --config Release --target all_verify_interface_header_sets install + + # - name: ctest + # working-directory: ${{github.workspace}}/build/VS + # run: ctest --build-config Release --output-on-failure diff --git a/cmake/CMakeWindowsPresets.json b/cmake/CMakeWindowsPresets.json index 52fbda28..0f466f7b 100644 --- a/cmake/CMakeWindowsPresets.json +++ b/cmake/CMakeWindowsPresets.json @@ -7,11 +7,13 @@ { "name": "release", "description": "Windows preset for library developers", - "generator": "Visual Studio 17 2022", + "generator": "Ninja Multi-Config", + "binaryDir": "${sourceDir}/build", "inherits": [ "root-config" ], "cacheVariables": { + "CMAKE_CXX_COMPILER": "C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe", "CMAKE_CXX_FLAGS": "/W3 /EHsc /w14242 /w14254 /w14263 /w14265 /w14287 /w14289 /w14296 /w14311 /w14545 /w14546 /w14547 /w14549 /w14555 /w14640 /w14826 /w14928 /WX" }, "condition": { diff --git a/docs/Doxyfile b/docs/Doxyfile index 9b9a0a47..803a020b 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -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/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/tests/beman/execution26/CMakeLists.txt b/tests/beman/execution26/CMakeLists.txt index 8214f5cf..664c34da 100644 --- a/tests/beman/execution26/CMakeLists.txt +++ b/tests/beman/execution26/CMakeLists.txt @@ -117,6 +117,8 @@ if(PROJECT_IS_TOP_LEVEL) 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) From be460001ea7f90411cd556535b6b66d5b19ee6a6 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Mon, 4 Nov 2024 22:06:45 +0100 Subject: [PATCH 20/27] Use githup action to call vcvarsall.bat Use cl without path --- .github/workflows/windows.yml | 3 +-- cmake/CMakeWindowsPresets.json | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 6a16da51..05c9a379 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -27,11 +27,10 @@ jobs: steps: - uses: actions/checkout@v4 - uses: ilammy/msvc-dev-cmd@v1 - with: "17.XX" # VS 2023 - name: cmake workflow run: | - cmake --workflow --preset debug || echo ignored + cmake --workflow --preset release || echo ignored # - name: environment # run: cmake -E make_directory ${{github.workspace}}/build/VS diff --git a/cmake/CMakeWindowsPresets.json b/cmake/CMakeWindowsPresets.json index 0f466f7b..f565f614 100644 --- a/cmake/CMakeWindowsPresets.json +++ b/cmake/CMakeWindowsPresets.json @@ -13,7 +13,7 @@ "root-config" ], "cacheVariables": { - "CMAKE_CXX_COMPILER": "C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe", + "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": { From 3e4669fbb0004751cd98c2cd18ddbf21dd9f74e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dietmar=20K=C3=BChl?= Date: Tue, 5 Nov 2024 00:55:56 +0000 Subject: [PATCH 21/27] change common.hpp to avoid warnings Changed the code to disable use of C++26 features. The way to restore that is probably adding/removing warning suppression in `suppress_push.hpp` and `suppress_pop.hpp` but I think this PR isn't the place to do that. --- include/beman/execution26/detail/common.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From abce05eea39337a372f72c2ac5c9ca281a70e898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dietmar=20K=C3=BChl?= Date: Tue, 5 Nov 2024 01:17:34 +0000 Subject: [PATCH 22/27] also disable forward_like from the compiler ... it seems to cause grief. Again, something to get restored. I tried to replicate this problem and I didn't manage to do so. --- include/beman/execution26/detail/forward_like.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)); From 64ea7c46982e204fa2726588728e27cf67631d7d Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Tue, 5 Nov 2024 08:08:36 +0100 Subject: [PATCH 23/27] Cleanup Windows CI workflow file --- .github/workflows/windows.yml | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 05c9a379..0d3de9e9 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -24,25 +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 + + # see https://github.com/marketplace/actions/enable-developer-command-prompt - uses: ilammy/msvc-dev-cmd@v1 + with: + vsversion: 2022 - - name: cmake workflow - run: | - cmake --workflow --preset release || echo ignored + # - name: build environment + # run: pip install -r requirements.txt - # - name: environment - # run: cmake -E make_directory ${{github.workspace}}/build/VS + - 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/VS - # run: cmake ${{github.workspace}} + # run: CXX=${{ matrix.compiler }} cmake --preset ${{ matrix.sanitizer }} # - name: build - # working-directory: ${{github.workspace}}/build/VS - # run: cmake --build . --config Release --target all_verify_interface_header_sets install + # run: cmake --build --preset ${{ matrix.sanitizer }} # - name: ctest - # working-directory: ${{github.workspace}}/build/VS - # run: ctest --build-config Release --output-on-failure + # run: ctest --preset ${{ matrix.sanitizer }} From e4055844664b0281008b7dea488e48894e9a0b24 Mon Sep 17 00:00:00 2001 From: Claus Klein Date: Tue, 5 Nov 2024 11:56:36 +0100 Subject: [PATCH 24/27] Add clang-tidy rules --- .clang-tidy | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 4 +++- 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 .clang-tidy 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/Makefile b/Makefile index e0c5e93b..0be30ab8 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ SANITIZERS = release debug msan asan usan tsan -.PHONY: default doc run update check ce todo distclean clean codespell 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))%=%) @@ -83,6 +83,8 @@ check: < $$h sed -n "/^ *# *include .*@$$from \1@p"; \ done | tsort > /dev/null +clang-tidy: + clang-tidy-17 -p build/debug tests/beman/execution26/exec-just.test.cpp codespell: codespell -L statics,snd,copyable,cancelled From a1ebfba7d3e0bda4fc109c583a3b4d774079e444 Mon Sep 17 00:00:00 2001 From: Claus Klein Date: Tue, 5 Nov 2024 12:02:06 +0100 Subject: [PATCH 25/27] Prepare using run-clang-tidy on all tests --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 0be30ab8..12f96f9c 100644 --- a/Makefile +++ b/Makefile @@ -83,8 +83,8 @@ check: < $$h sed -n "/^ *# *include .*@$$from \1@p"; \ done | tsort > /dev/null -clang-tidy: - clang-tidy-17 -p build/debug tests/beman/execution26/exec-just.test.cpp +clang-tidy: build/debug/compile_commands.json + run-clang-tidy-17 -p build/debug tests codespell: codespell -L statics,snd,copyable,cancelled From 005800948a300c3affac28ffb470d9124b6d8acb Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Wed, 6 Nov 2024 09:17:16 +0100 Subject: [PATCH 26/27] Fix make format and codespell --- .codespellrc | 2 +- Makefile | 9 +++++---- docs/Doxyfile | 2 +- examples/CMakeLists.txt | 10 +++++++++- .../beman/execution26/detail/basic_sender.hpp | 2 +- .../beman/execution26/detail/default_domain.hpp | 17 +++++++++-------- include/beman/execution26/detail/get_domain.hpp | 3 +-- .../beman/execution26/detail/schedule_from.hpp | 2 +- 8 files changed, 28 insertions(+), 19 deletions(-) diff --git a/.codespellrc b/.codespellrc index d2d83cf3..7d233d00 100644 --- a/.codespellrc +++ b/.codespellrc @@ -1,6 +1,6 @@ [codespell] builtin = clear,rare,en-GB_to_en-US,names,informal,code check-hidden = -skip = ./.git,./build/*,./stagedir/*,*.log,.*.swp,*~,*.bak,Makefile +skip = ./.git,./build/*,./stagedir/*,./docs/html/*,./docs/latex/*,*.log,.*.swp,*~,*.bak,Makefile quiet-level = 2 # ignore-words = .ignore-words diff --git a/Makefile b/Makefile index 12f96f9c..58e00b00 100644 --- a/Makefile +++ b/Makefile @@ -16,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 @@ -83,14 +83,15 @@ check: < $$h sed -n "/^ *# *include .*@$$from \1@p"; \ done | tsort > /dev/null -clang-tidy: build/debug/compile_commands.json - run-clang-tidy-17 -p build/debug tests +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/docs/Doxyfile b/docs/Doxyfile index 803a020b..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 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/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/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/get_domain.hpp b/include/beman/execution26/detail/get_domain.hpp index 53866593..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 needs 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); From d8fb0106644389ca3471716db08937cd44187de1 Mon Sep 17 00:00:00 2001 From: Claus Klein Date: Wed, 6 Nov 2024 10:58:53 +0100 Subject: [PATCH 27/27] Changes after review --- .github/workflows/linux.yml | 4 ++-- .github/workflows/macos.yml | 2 +- .github/workflows/windows.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index ba17fd1a..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/**" @@ -40,7 +40,7 @@ jobs: sudo apt-get install ninja-build -y -q wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh - sudo sudo ./llvm.sh 19 all + 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 39605052..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/**" diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 0d3de9e9..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/**"