Skip to content

Commit 48a7b99

Browse files
committed
Remove some glitches to prepare nice pull request
Some changes got into this branch by accident. This patch undos them in order to have a pull request which cares only about the experimental/non-experimental namespace/include problem.
1 parent 75fbc10 commit 48a7b99

7 files changed

+8
-91
lines changed

Diff for: README.md

+2-66
Original file line numberDiff line numberDiff line change
@@ -2859,20 +2859,18 @@ Given a type, `S`, that implements the `DelayedScheduler` and an instance, `s` o
28592859

28602860
The cppcoro library supports building under Windows with Visual Studio 2017 and Linux with Clang 5.0+.
28612861

2862-
This library makes use of either the [Cake build system](https://github.com/lewissbaker/cake) (no, not the [C# one](http://cakebuild.net/)) or CMake.
2862+
This library makes use of the [Cake build system](https://github.com/lewissbaker/cake) (no, not the [C# one](http://cakebuild.net/)).
28632863

28642864
The cake build system is checked out automatically as a git submodule so you don't need to download or install it separately.
28652865

28662866
## Building on Windows
28672867

28682868
This library currently requires Visual Studio 2017 or later and the Windows 10 SDK.
28692869

2870-
Support for Linux ([#15](https://github.com/lewissbaker/cppcoro/issues/15)) is planned.
2870+
Support for Clang ([#3](https://github.com/lewissbaker/cppcoro/issues/3)) and Linux ([#15](https://github.com/lewissbaker/cppcoro/issues/15)) is planned.
28712871

28722872
### Prerequisites
28732873

2874-
The CMakeLists requires version 3.13 or later.
2875-
28762874
The Cake build-system is implemented in Python and requires Python 2.7 to be installed.
28772875

28782876
Ensure Python 2.7 interpreter is in your PATH and available as 'python'.
@@ -2905,68 +2903,6 @@ c:\Code\cppcoro> git submodule update --init --recursive
29052903

29062904
### Building from the command-line
29072905

2908-
#### With CMake
2909-
2910-
Cppcoro follows the usual CMake workflow with no custom options added. Notable [standard CMake options](https://cmake.org/cmake/help/latest/manual/cmake-variables.7.html):
2911-
2912-
| Flag | Description | Default Value |
2913-
|----------------------|------------------------------|------------------------|
2914-
| BUILD_TESTING | Build the unit tests | ON |
2915-
| BUILD_SHARED_LIBS | Build as a shared library | OFF |
2916-
| CMAKE_BUILD_TYPE | Build as `Debug`/`Release` | <empty> |
2917-
| CMAKE_INSTALL_PREFIX | Where to install the library | `/usr/local` (on Unix) |
2918-
2919-
CMake also respects the [conventional environment variables](https://cmake.org/cmake/help/latest/manual/cmake-env-variables.7.html):
2920-
2921-
| Environment Variable | Description |
2922-
|----------------------|-------------------------------|
2923-
| CXX | Path to the C++ compiler |
2924-
| CXXFLAGS | C++ compiler flags to prepend |
2925-
| LDFLAGS | Linker flags to prepend |
2926-
2927-
Example:
2928-
2929-
```bash
2930-
cd <this/repo>
2931-
mkdir build
2932-
cd build
2933-
export CXX=clang++
2934-
export CXXFLAGS="-stdlib=libc++ -march=native"
2935-
export LDFLAGS="-stdlib=libc++ -fuse-ld=lld -Wl,--gdb-index"
2936-
cmake .. [-GNinja] -DCMAKE_INSTALL_PREFIX=$HOME/.local -DBUILD_SHARED_LIBS=ON
2937-
ninja # or make -jN
2938-
ninja test # Run the tests
2939-
ninja install
2940-
```
2941-
2942-
The CMake build scripts will also install a `cppcoroConfig.cmake` file for consumers to use.
2943-
It will check at the consumer site that coroutines are indeed supported by the system and enable the appropriate compiler flag for Clang or MSVC, respectively.
2944-
Assuming cppcoro has been installed to `$HOME/.local` like in the example above it can be consumed like this:
2945-
2946-
```cmake
2947-
find_package(cppcoro REQUIRED)
2948-
add_executable(app main.cpp)
2949-
target_link_libraries(app PRIVATE cppcoro::cppcoro)
2950-
```
2951-
2952-
```bash
2953-
$ cmake . -Dcppcoro_ROOT=$HOME/.local
2954-
# ...
2955-
-- Performing Test Coroutines_SUPPORTS_MS_FLAG
2956-
-- Performing Test Coroutines_SUPPORTS_MS_FLAG - Failed
2957-
-- Performing Test Coroutines_SUPPORTS_GNU_FLAG
2958-
-- Performing Test Coroutines_SUPPORTS_GNU_FLAG - Success
2959-
-- Looking for C++ include coroutine
2960-
-- Looking for C++ include coroutine - not found
2961-
-- Looking for C++ include experimental/coroutine
2962-
-- Looking for C++ include experimental/coroutine - found
2963-
-- Configuring done
2964-
-- Generating done
2965-
# ...
2966-
```
2967-
2968-
#### With Cake
2969-
29702906
To build from the command-line just run 'cake.bat' in the workspace root.
29712907

29722908
eg.

Diff for: test/async_generator_tests.cpp

-6
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,6 @@ TEST_CASE("exception thrown after first yield is rethrown from increment operato
256256
}());
257257
}
258258

259-
#if (defined(__GNUC__) && !defined(__clang__))
260-
#define GCC_COMPILER 1
261-
#endif
262-
// GCC 10.1 doesn't support "for co_await"
263-
#ifndef GCC_COMPILER
264259
TEST_CASE("large number of synchronous completions doesn't result in stack-overflow")
265260
{
266261

@@ -303,7 +298,6 @@ TEST_CASE("large number of synchronous completions doesn't result in stack-overf
303298
consumer(makeSequence(event)),
304299
unblocker(event)));
305300
}
306-
#endif // GCC_COMPILER
307301

308302
TEST_CASE("fmap")
309303
{

Diff for: test/counted.hpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
#ifndef CPPCORO_TESTS_COUNTED_HPP_INCLUDED
66
#define CPPCORO_TESTS_COUNTED_HPP_INCLUDED
77

8-
#include <iostream>
9-
108
struct counted
119
{
1210
static int default_construction_count;
@@ -34,10 +32,10 @@ struct counted
3432
return construction_count() - destruction_count;
3533
}
3634

37-
counted() : id(default_construction_count++) { std::cout << "constructed" << std::endl; }
38-
counted(const counted& other) : id(other.id) { ++copy_construction_count; std::cout << "copied" << std::endl; }
39-
counted(counted&& other) : id(other.id) { ++move_construction_count; other.id = -1; std::cout << "moved" << std::endl; }
40-
~counted() { ++destruction_count; std::cout <<"destructed" << std::endl; }
35+
counted() : id(default_construction_count++) {}
36+
counted(const counted& other) : id(other.id) { ++copy_construction_count; }
37+
counted(counted&& other) : id(other.id) { ++move_construction_count; other.id = -1; }
38+
~counted() { ++destruction_count; }
4139

4240
};
4341

Diff for: test/recursive_generator_tests.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -382,10 +382,7 @@ namespace
382382
{
383383
while (start < end)
384384
{
385-
// GCC 10.1 workaround: "co_yield start++ always returns the same value, resulting in an infinite loop
386-
// ((++start)-1) seems to have the same issue, while ++start works, but breaks the test
387-
start++;
388-
co_yield start-1;
385+
co_yield start++;
389386
}
390387
}
391388

Diff for: test/shared_task_tests.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,6 @@ TEST_CASE("waiting on shared_task in loop doesn't cause stack-overflow")
120120
int result = 0;
121121
for (int i = 0; i < 1'000'000; ++i)
122122
{
123-
// GCC 10.1 workaround: GCC doesn't generate any code for a for loop with only a co_await in it
124-
[](){}();
125123
result += co_await completesSynchronously();
126124
}
127125
CHECK(result == 1'000'000);

Diff for: test/task_tests.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,7 @@ TEST_CASE("passing parameter by value to task coroutine calls move-constructor e
177177
auto t = f(c);
178178

179179
// Should have called copy-constructor to pass a copy of 'c' into f by value.
180-
// GCC 10.1 performs 2 copies
181-
CHECK(counted::copy_construction_count >= 1);
180+
CHECK(counted::copy_construction_count == 1);
182181

183182
// Inside f it should have move-constructed parameter into coroutine frame variable
184183
//WARN_MESSAGE(counted::move_construction_count == 1,
@@ -339,8 +338,6 @@ TEST_CASE("lots of synchronous completions doesn't result in stack-overflow")
339338
int sum = 0;
340339
for (int i = 0; i < 1'000'000; ++i)
341340
{
342-
// GCC 10.1 workaround: GCC doesn't generate any code for a for loop with only a co_await in it
343-
[](){}();
344341
sum += co_await completesSynchronously();
345342
}
346343
CHECK(sum == 1'000'000);

Diff for: test/when_all_tests.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,6 @@ TEST_CASE("when_all() with all task types")
112112

113113
CHECK(a == "foo");
114114
CHECK(b.id == 0);
115-
// GCC 10.1 fails this check: at this point there are 3 objects alive
116-
// * One will be destructed later
117-
// * One object is completely leaked
118115
CHECK(counted::active_count() == 1);
119116
};
120117

0 commit comments

Comments
 (0)