From 834fc949655d783759c03c24e650cda6b2a6cbbb Mon Sep 17 00:00:00 2001 From: Sylvain Garcia Date: Mon, 12 Oct 2020 09:44:46 +0200 Subject: [PATCH 1/3] fix: clang requires initial/final_suspend noexcept - removing libc++ workaround (should be qualified correctly) --- cmake/FindCppcoroCoroutines.cmake | 15 --------------- include/cppcoro/generator.hpp | 4 ++-- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/cmake/FindCppcoroCoroutines.cmake b/cmake/FindCppcoroCoroutines.cmake index 85d38259..950d9575 100644 --- a/cmake/FindCppcoroCoroutines.cmake +++ b/cmake/FindCppcoroCoroutines.cmake @@ -15,21 +15,6 @@ if(Coroutines_SUPPORTS_MS_FLAG) elseif(Coroutines_ts_SUPPORTS_GNU_FLAG) check_include_file_cxx("coroutine" Coroutines_STANDARD_LIBRARY_SUPPORT "-fcoroutines-ts") check_include_file_cxx("experimental/coroutine" Coroutines_EXPERIMENTAL_LIBRARY_SUPPORT "-fcoroutines-ts") - # workaround: - # clang not find stdlibc++ headers when on ubuntu 20.04 - # So, we retry with libc++ enforcement - if(NOT Coroutines_STANDARD_LIBRARY_SUPPORT - AND NOT Coroutines_EXPERIMENTAL_LIBRARY_SUPPORT - AND CMAKE_CXX_COMPILER_ID MATCHES Clang) - set(CMAKE_REQUIRED_FLAGS "-stdlib=libc++") - check_include_file_cxx("coroutine" Coroutines_STANDARD_LIBRARY_SUPPORT_LIBCPP "-fcoroutines-ts") - check_include_file_cxx("experimental/coroutine" Coroutines_EXPERIMENTAL_LIBRARY_SUPPORT_LIBCPP "-fcoroutines-ts") - if(Coroutines_STANDARD_LIBRARY_SUPPORT_LIBCPP OR Coroutines_EXPERIMENTAL_LIBRARY_SUPPORT_LIBCPP) - list(APPEND Coroutines_EXTRA_FLAGS "-stdlib=libc++") - set(Coroutines_STANDARD_LIBRARY_SUPPORT ${Coroutines_STANDARD_LIBRARY_SUPPORT_LIBCPP}) - set(Coroutines_EXPERIMENTAL_LIBRARY_SUPPORT ${Coroutines_EXPERIMENTAL_LIBRARY_SUPPORT_LIBCPP}) - endif() - endif() elseif(Coroutines_SUPPORTS_GNU_FLAG) check_include_file_cxx("coroutine" Coroutines_STANDARD_LIBRARY_SUPPORT "-fcoroutines") check_include_file_cxx("experimental/coroutine" Coroutines_EXPERIMENTAL_LIBRARY_SUPPORT "-fcoroutines") diff --git a/include/cppcoro/generator.hpp b/include/cppcoro/generator.hpp index d0a7e84f..7b5df496 100644 --- a/include/cppcoro/generator.hpp +++ b/include/cppcoro/generator.hpp @@ -32,8 +32,8 @@ namespace cppcoro generator get_return_object() noexcept; - constexpr cppcoro::suspend_always initial_suspend() const { return {}; } - constexpr cppcoro::suspend_always final_suspend() const { return {}; } + constexpr cppcoro::suspend_always initial_suspend() const noexcept { return {}; } + constexpr cppcoro::suspend_always final_suspend() const noexcept { return {}; } template< typename U = T, From 467c5659a05a41c11e11f9323c76c5c4e7ffac44 Mon Sep 17 00:00:00 2001 From: Sylvain Garcia Date: Mon, 12 Oct 2020 09:22:38 +0200 Subject: [PATCH 2/3] update github workflow --- .github/workflows/cmake.yml | 16 ++++++++++++++-- cmake/FindCppcoroCoroutines.cmake | 2 -- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 2ab93b89..af3c50f3 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -18,6 +18,13 @@ jobs: fail-fast: false matrix: compiler: [g++-10, clang] + include: + - compiler: clang + cxx_flags: -stdlib=libc++ + # TODO figure why this is not set automatically + exe_linker_flags: -lc++ + - compiler: g++-10 + install: 'g++-10' steps: - uses: actions/checkout@v2 @@ -26,7 +33,7 @@ jobs: run: sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa - name: Install dependencies - run: sudo apt-get install g++-10 + run: sudo apt-get install ${{ matrix.install }} - name: Create Build Environment # Some projects don't allow in-source building, so create a separate build directory @@ -43,7 +50,12 @@ jobs: # Note the current convention is to use the -S and -B options here to specify source # and build directories, but this is only available with CMake 3.13 and higher. # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE + run: | + cmake $GITHUB_WORKSPACE \ + -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ + -DCMAKE_CXX_FLAGS=${{ matrix.cxx_flags }} \ + -DCMAKE_EXE_LINKER_FLAGS=${{ matrix.exe_linker_flags }} \ + -DCMAKE_VERBOSE_MAKEFILE=ON - name: Build working-directory: ${{runner.workspace}}/build diff --git a/cmake/FindCppcoroCoroutines.cmake b/cmake/FindCppcoroCoroutines.cmake index 950d9575..c957c0cb 100644 --- a/cmake/FindCppcoroCoroutines.cmake +++ b/cmake/FindCppcoroCoroutines.cmake @@ -40,5 +40,3 @@ elseif(Coroutines_ts_SUPPORTS_GNU_FLAG) elseif(Coroutines_SUPPORTS_GNU_FLAG) target_compile_options(cppcoro::coroutines INTERFACE -fcoroutines) endif() - -target_compile_options(cppcoro::coroutines INTERFACE ${Coroutines_EXTRA_FLAGS}) From b120e51453d8543426c6d93098611a575992ba4a Mon Sep 17 00:00:00 2001 From: Sylvain Garcia Date: Mon, 12 Oct 2020 11:32:26 +0200 Subject: [PATCH 3/3] add github check for PR --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index af3c50f3..6a6f6b96 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -1,6 +1,6 @@ name: CMake -on: [push] +on: [push, pull_request] env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)