Skip to content

Commit f946625

Browse files
authored
Merge pull request #56 from owent/dev
Prepare v2.3.0
2 parents a7b8ec5 + a269f41 commit f946625

File tree

194 files changed

+13890
-2165
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

194 files changed

+13890
-2165
lines changed

.clang-format

+43-12
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,47 @@ IncludeBlocks: Preserve
1616
# #endif
1717
IndentPPDirectives: AfterHash
1818

19-
IfMacros: ["COPP_LIKELY_IF", "COPP_UNLIKELY_IF"]
20-
StatementAttributeLikeMacros:
21-
[
22-
"UTIL_SYMBOL_EXPORT",
23-
"UTIL_SYMBOL_IMPORT",
24-
"UTIL_SYMBOL_VISIBLE",
25-
"UTIL_SYMBOL_LOCAL",
26-
"UTIL_FORCEINLINE",
27-
"UTIL_NOINLINE_NOCLONE",
28-
"COPP_NORETURN_ATTR",
29-
"COPP_UNREACHABLE",
30-
]
19+
IfMacros:
20+
["if LIBCOPP_UTIL_LIKELY_CONDITION", "if LIBCOPP_UTIL_UNLIKELY_CONDITION"]
21+
AttributeMacros:
22+
- LIBCOPP_COPP_API_HEAD_ONLY
23+
- LIBCOPP_UTIL_SYMBOL_LOCAL
24+
- LIBCOPP_UTIL_SYMBOL_EXPORT
25+
- LIBCOPP_UTIL_SYMBOL_IMPORT
26+
- LIBCOPP_UTIL_SYMBOL_VISIBLE
27+
- LIBCOPP_UTIL_NOINLINE_NOCLONE
28+
- LIBCOPP_UTIL_FORCEINLINE
29+
- LIBCOPP_UTIL_CONST_INIT
30+
- LIBCOPP_UTIL_ATTRIBUTE_LIFETIME_BOUND
31+
- LIBCOPP_UTIL_SANITIZER_NO_MEMORY
32+
- LIBCOPP_UTIL_SANITIZER_NO_THREAD
33+
- LIBCOPP_UTIL_SANITIZER_NO_ADDRESS
34+
- LIBCOPP_UTIL_SANITIZER_NO_UNDEFINED
35+
- LIBCOPP_UTIL_MACRO_INLINE_VARIABLE
36+
- LIBCOPP_UTIL_ATTRIBUTE_REINITIALIZES
37+
- LIBCOPP_UTIL_ATTRIBUTE_RETURNS_NONNULL
38+
- LIBCOPP_UTIL_SYMBOL_LOCAL
39+
- LIBCOPP_UTIL_SYMBOL_EXPORT
40+
- LIBCOPP_UTIL_SYMBOL_IMPORT
41+
- LIBCOPP_UTIL_SYMBOL_VISIBLE
42+
- LIBCOPP_UTIL_NOINLINE_NOCLONE
43+
- LIBCOPP_UTIL_CONST_INIT
44+
- LIBCOPP_UTIL_ATTRIBUTE_LIFETIME_BOUND
45+
- LIBCOPP_UTIL_SANITIZER_NO_MEMORY
46+
- LIBCOPP_UTIL_SANITIZER_NO_THREAD
47+
- LIBCOPP_UTIL_SANITIZER_NO_ADDRESS
48+
- LIBCOPP_UTIL_SANITIZER_NO_UNDEFINED
49+
- LIBCOPP_UTIL_MACRO_INLINE_VARIABLE
50+
- LIBCOPP_UTIL_ATTRIBUTE_REINITIALIZES
51+
- LIBCOPP_UTIL_ATTRIBUTE_RETURNS_NONNULL
52+
- LIBCOPP_UTIL_ATTRIBUTE_WARN_UNUSED
53+
- LIBCOPP_UTIL_ATTRIBUTE_UNINITIALIZED
54+
- LIBCOPP_UTIL_ATTRIBUTE_NO_UNIQUE_ADDRESS
55+
- LIBCOPP_UTIL_ATTRIBUTE_OWNER
56+
- LIBCOPP_UTIL_ATTRIBUTE_VIEW
57+
- LIBCOPP_EXPLICIT_DEPRECATED_ATTR
58+
- LIBCOPP_EXPLICIT_NODISCARD_ATTR
59+
- LIBCOPP_EXPLICIT_UNUSED_ATTR
60+
- LIBCOPP_EXPLICIT_FALLTHROUGH
61+
- LIBCOPP_EXPLICIT_NORETURN_ATTR
3162
StatementMacros: []

.github/workflows/main.yml

+30-23
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ on: # @see https://help.github.com/en/articles/events-that-trigger-workflows#web
1010
jobs:
1111
format:
1212
name: Format
13-
runs-on: ubuntu-22.04
13+
runs-on: ubuntu-latest
1414
steps:
1515
- name: Checkout
16-
uses: actions/checkout@v2
16+
uses: actions/checkout@v4
1717
- name: CI Job
1818
shell: bash
1919
run: |
@@ -24,13 +24,13 @@ jobs:
2424
strategy:
2525
matrix:
2626
include:
27-
- os: ubuntu-22.04
27+
- os: ubuntu-latest
2828
triplet: x64-linux
2929
cc: gcc
3030
runs-on: ${{ matrix.os }}
3131
steps:
3232
- name: Checkout
33-
uses: actions/checkout@v2
33+
uses: actions/checkout@v4
3434
- name: Build & Test
3535
shell: bash
3636
run: |
@@ -61,34 +61,40 @@ jobs:
6161
strategy:
6262
matrix:
6363
include:
64-
- os: ubuntu-22.04
64+
- os: ubuntu-latest
6565
triplet: x64-linux
6666
cc: gcc
6767
build_shared_libs: "ON"
68-
- os: ubuntu-22.04
68+
- os: ubuntu-latest
6969
triplet: x64-linux
7070
cc: gcc
7171
build_shared_libs: "OFF"
72-
- os: ubuntu-22.04
72+
- os: ubuntu-latest
7373
triplet: x64-linux
7474
cc: gcc-latest
7575
mode: memcheck
76-
- os: ubuntu-22.04
76+
- os: ubuntu-latest
7777
triplet: x64-linux
7878
cc: gcc-latest
7979
no_exception: 1
80-
- os: ubuntu-22.04
80+
- os: ubuntu-latest
8181
triplet: x64-linux
8282
cc: gcc-latest
8383
no_rtti: 1
84-
- os: ubuntu-22.04
84+
- os: ubuntu-latest
8585
triplet: x64-linux
8686
cc: gcc-latest
8787
thread_unsafe: 1
88+
configure: "RelWithDebInfo"
89+
- os: ubuntu-latest
90+
triplet: x64-linux
91+
cc: gcc
92+
thread_unsafe: 1
93+
configure: "Release"
8894
- os: ubuntu-20.04
8995
triplet: x64-linux
9096
cc: gcc-4.8
91-
- os: ubuntu-22.04
97+
- os: ubuntu-latest
9298
triplet: x64-linux
9399
cc: clang-latest
94100
- os: macos-latest
@@ -97,7 +103,7 @@ jobs:
97103
runs-on: ${{ matrix.os }}
98104
steps:
99105
- name: Checkout
100-
uses: actions/checkout@v2
106+
uses: actions/checkout@v4
101107
- name: Build & Test
102108
shell: bash
103109
env:
@@ -107,6 +113,7 @@ jobs:
107113
NO_RTTI: ${{ matrix.no_rtti }}
108114
THREAD_UNSAFE: ${{ matrix.thread_unsafe }}
109115
CI_MODE: ${{ matrix.mode }}
116+
CONFIGURATION: ${{ matrix.configure }}
110117
run: |
111118
if [[ "xgcc-4.8" == "x$USE_CC" ]]; then
112119
sudo apt-add-repository 'deb http://archive.ubuntu.com/ubuntu/ xenial main'
@@ -146,7 +153,7 @@ jobs:
146153
runs-on: ${{ matrix.os }}
147154
steps:
148155
- name: Checkout
149-
uses: actions/checkout@v2
156+
uses: actions/checkout@v4
150157
- name: Build & Test
151158
shell: pwsh
152159
env:
@@ -170,15 +177,15 @@ jobs:
170177
runs-on: ${{ matrix.os }}
171178
steps:
172179
- name: Checkout
173-
uses: actions/checkout@v2
180+
uses: actions/checkout@v4
174181
- name: Build & Test
175182
shell: bash
176183
env:
177184
BUILD_SHARED_LIBS: ${{ matrix.build_shared_libs }}
178185
run: |
179186
C:/msys64/msys2_shell.cmd -mingw64 -defterm -no-start -here -lc "ci/do_ci.sh msys2.mingw.test"
180187
- name: Cache packages
181-
uses: actions/cache@v2
188+
uses: actions/cache@v4
182189
with:
183190
path: |
184191
C:/msys64/var/cache/pacman/pkg
@@ -190,14 +197,14 @@ jobs:
190197
strategy:
191198
matrix:
192199
include:
193-
- os: ubuntu-22.04
200+
- os: ubuntu-latest
194201
triplet: x64-linux
195202
cc: gcc
196-
gcov_flags: "--coverage -fprofile-arcs -ftest-coverage"
203+
gcov_flags: "--coverage -fprofile-arcs -ftest-coverage -fno-omit-frame-pointer -fprofile-update=atomic"
197204
runs-on: ${{ matrix.os }}
198205
steps:
199206
- name: Checkout
200-
uses: actions/checkout@v2
207+
uses: actions/checkout@v4
201208
- name: Generate coverage
202209
shell: bash
203210
env:
@@ -214,11 +221,11 @@ jobs:
214221
fi
215222
bash ci/do_ci.sh coverage ;
216223
- name: Uploaded code coverage
217-
uses: codecov/codecov-action@v3
224+
uses: codecov/codecov-action@v5
218225
with:
219226
token: ${{secrets.CODECOV_TOKEN}} # not required for public repos
220227
fail_ci_if_error: true
221-
file: ${{ github.workspace }}/build_jobs_coverage/coverage.info
228+
files: ${{ github.workspace }}/build_jobs_coverage/coverage.info
222229
codeql:
223230
name: CodeQL
224231
# This job runs on Linux
@@ -235,7 +242,7 @@ jobs:
235242
security-events: write
236243
steps:
237244
- name: Checkout
238-
uses: actions/checkout@v2
245+
uses: actions/checkout@v4
239246
- name: Build
240247
shell: bash
241248
env:
@@ -245,7 +252,7 @@ jobs:
245252
run: |
246253
bash ci/do_ci.sh codeql.configure
247254
- name: Initialize CodeQL
248-
uses: github/codeql-action/init@v2
255+
uses: github/codeql-action/init@v3
249256
with:
250257
config-file: ./.github/codeql/codeql-config.yml
251258
- name: Build
@@ -257,6 +264,6 @@ jobs:
257264
run: |
258265
bash ci/do_ci.sh codeql.build
259266
- name: Perform CodeQL Analysis
260-
uses: github/codeql-action/analyze@v2
267+
uses: github/codeql-action/analyze@v3
261268
with:
262269
category: "/language:cpp"

.github/workflows/stale.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
stale:
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/stale@v6
10+
- uses: actions/stale@v9
1111
with:
1212
stale-issue-message: "This issue was marked as stale due to lack of activity."
1313
days-before-issue-stale: 90

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# CHANGELOG
22

3+
## 2.3.0
4+
5+
1. Rename all macros `COPP_*` to `LIBCOPP_*`
6+
2. Make all macros in compile_optimize.h and explicit_declare. standalone from atframework
7+
3. Merge boost.fcontext 1.87
8+
4. Remove `LIBCOPP_MACRO_HAS_EXCEPTION`
9+
5. Add nostd type_traits and `strong_rc_ptr` for non thread-safety smart pointer
10+
6. Remove `LIBCOPP_DISABLE_ATOMIC_LOCK`, `LIBCOPP_LOCK_DISABLE_THIS_MT` and `LIBCOPP_LOCK_DISABLE_MT`. We use the only one option `LIBCOPP_ENABLE_MULTI_THREAD` now.
11+
7. Allow to disable multi-thread support for stack pool and C++20 coroutine to reduce cache miss.
12+
8. We allow use lightweight callback or channel mode(without callback) for C++20 coroutine generator.
13+
9. Add `copp::make_channel<T>()` to create channel receiver and sender for easier usage.
14+
315
## 2.2.0
416

517
1. Merge boost.fcontext 1.81.0

CMakeLists.txt

+18-7
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,20 @@ endif()
1515
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.20.0")
1616
cmake_policy(SET CMP0117 NEW)
1717
endif()
18+
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.22.0")
19+
cmake_policy(SET CMP0128 NEW)
20+
endif()
21+
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.27.0")
22+
cmake_policy(SET CMP0144 NEW)
23+
endif()
24+
25+
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
1826

1927
enable_testing()
2028

2129
project(
2230
libcopp
23-
VERSION "2.2.0"
31+
VERSION "2.3.0"
2432
DESCRIPTION "Cross-platform coroutine library in C++ ."
2533
HOMEPAGE_URL "https://libcopp.atframe.work"
2634
LANGUAGES C CXX ASM)
@@ -97,10 +105,6 @@ unset(PROJECT_LIBCOPP_SYSLIB_LINK_NAMES)
97105
include("${CMAKE_CURRENT_LIST_DIR}/include/include.macro.cmake")
98106
include("${CMAKE_CURRENT_LIST_DIR}/src/libcopp.macro.cmake")
99107

100-
if(NOT EXISTS "${PROJECT_LIBCOPP_ROOT_INC_DIR}/libcopp/utils/config")
101-
file(MAKE_DIRECTORY "${PROJECT_LIBCOPP_ROOT_INC_DIR}/libcopp/utils/config")
102-
endif()
103-
104108
if(LIBCOTASK_ENABLE)
105109
set(LIBCOTASK_MACRO_ENABLED 1)
106110
endif()
@@ -111,8 +115,7 @@ endif()
111115

112116
unset(LIBCOPP_SPECIFY_CXX_FLAGS)
113117

114-
find_package(Threads)
115-
if(CMAKE_USE_PTHREADS_INIT)
118+
if(ATFRAMEWORK_CMAKE_TOOLSET_TEST_FLAG_PTHREAD)
116119
list(APPEND PROJECT_LIBCOPP_SYSLIB_LINK_NAMES pthread)
117120
set(THREAD_TLS_USE_PTHREAD 1)
118121
endif()
@@ -140,6 +143,10 @@ if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
140143
if(COMPILER_STRICT_CFLAGS)
141144
list(APPEND LIBCOPP_SPECIFY_CXX_FLAGS ${COMPILER_STRICT_CFLAGS})
142145
endif()
146+
147+
if(COMPILER_STRICT_RECOMMEND_EXTRA_CFLAGS)
148+
list(APPEND LIBCOPP_SPECIFY_CXX_FLAGS ${COMPILER_STRICT_RECOMMEND_EXTRA_CFLAGS})
149+
endif()
143150
endif()
144151
else()
145152
if(COMPILER_STRICT_EXTRA_CFLAGS)
@@ -149,6 +156,10 @@ else()
149156
if(COMPILER_STRICT_CFLAGS)
150157
list(APPEND LIBCOPP_SPECIFY_CXX_FLAGS ${COMPILER_STRICT_CFLAGS})
151158
endif()
159+
160+
if(COMPILER_STRICT_RECOMMEND_EXTRA_CFLAGS)
161+
list(APPEND LIBCOPP_SPECIFY_CXX_FLAGS ${COMPILER_STRICT_RECOMMEND_EXTRA_CFLAGS})
162+
endif()
152163
endif()
153164

154165
string(REPLACE ";" " " LIBCOPP_SPECIFY_CXX_FLAGS "${LIBCOPP_SPECIFY_CXX_FLAGS}")

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2023 OWenT
3+
Copyright (c) 2025 OWenT
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of
66
this software and associated documentation files (the "Software"), to deal in

README.rst

+5-9
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,7 @@ Cross-platform coroutine library in C++ .
4444
:alt: Coveralls coverage
4545
:target: https://codecov.io/gh/owent/libcopp
4646

47-
.. |lgtm-badge| image:: https://img.shields.io/lgtm/grade/cpp/g/owent/libcopp.svg?logo=lgtm&logoWidth=18
48-
:alt: Language grade: C/C++
49-
:target: https://lgtm.com/projects/g/owent/libcopp/context:cpp
50-
51-
|release-badge| |code-size-badge| |repo-size-badge| |ci-badge| |codecov-badge| |lgtm-badge| |forks-badge| |stars-badge|
47+
|release-badge| |code-size-badge| |repo-size-badge| |ci-badge| |codecov-badge| |forks-badge| |stars-badge|
5248

5349
CI Job Matrix
5450
----------------
@@ -99,7 +95,7 @@ UPGRADE FROM 1.3.X-1.4.X to 2.X
9995
+ Rename ``stack_allocator_t`` to ``stack_allocator_type`` in ``T`` when using ``cotask::task<T>``.
10096
+ Rename ``coroutine_t`` to ``coroutine_type`` in ``T`` when using ``cotask::task<T>``.
10197
+ Rename ``libcopp::util::*`` to ``copp::util::``.
102-
+ We are not allowed to use ``libcopp::util::intrusive_ptr<cotask::impl::task_impl>`` now, please use ``cotask::task<T>::ptr_type`` instead.
98+
+ We are not allowed to use ``libcopp::memory::intrusive_ptr<cotask::impl::task_impl>`` now, please use ``cotask::task<T>::ptr_type`` instead.
10399

104100
UPGRADE FROM 1.2.X to 1.3.X-1.4.X
105101
------------------------------------
@@ -209,9 +205,7 @@ Options can be cmake options. such as set compile toolchains, source directory o
209205
+------------------------------------------+------------------------------------------------------------------------------------------------------------------------------+
210206
| PROJECT_ENABLE_SAMPLE=YES|NO | [default=NO] Build samples. |
211207
+------------------------------------------+------------------------------------------------------------------------------------------------------------------------------+
212-
| LIBCOPP_LOCK_DISABLE_THIS_MT=YES|NO | [default=NO] Disable multi-thread support for ``copp::this_coroutine`` and ``cotask::this_task``. |
213-
+------------------------------------------+------------------------------------------------------------------------------------------------------------------------------+
214-
| LIBCOPP_DISABLE_ATOMIC_LOCK=YES|NO | [default=NO] Disable multi-thread support. |
208+
| LIBCOPP_ENABLE_MULTI_THREAD=YES|NO | [default=YES] Enable multi-thread support. |
215209
+------------------------------------------+------------------------------------------------------------------------------------------------------------------------------+
216210
| LIBCOTASK_ENABLE=YES|NO | [default=YES] Enable build libcotask. |
217211
+------------------------------------------+------------------------------------------------------------------------------------------------------------------------------+
@@ -310,6 +304,8 @@ There serveral samples to use ``copp::coroutine_context`` 、 ``copp::coroutine_
310304
8. Custom error (timeout for example) when using c++20 coroutine
311305
9. Let c++20 coroutine work with ``cotask::task``
312306
10. Using Windows fiber and ``SetUnhandledExceptionFilter`` on Windows with ``cotask::task``
307+
11. Using c++20 coroutine with channel receiver and sender
308+
12. Using stackful coroutine task with channel receiver and sender
313309

314310
All sample codes can be found on :ref:`EXAMPLES <examples_doc_anchor>` and `sample <https://github.com/owent/libcopp/tree/v2/sample>`_ .
315311

atframework/cmake-toolset

ci/do_ci.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ if [[ "x$NO_RTTI" != "x" ]]; then
6565
PROJECT_ADDON_OPTIONS=(${PROJECT_ADDON_OPTIONS[@]} "-DCMAKE_CXX_FLAGS=-fno-rtti")
6666
fi
6767
if [[ "x$THREAD_UNSAFE" != "x" ]]; then
68-
PROJECT_ADDON_OPTIONS=(${PROJECT_ADDON_OPTIONS[@]} "-DLIBCOPP_DISABLE_ATOMIC_LOCK=ON" "-DLIBCOPP_LOCK_DISABLE_THIS_MT=ON")
68+
PROJECT_ADDON_OPTIONS=(${PROJECT_ADDON_OPTIONS[@]} "-DLIBCOPP_ENABLE_MULTI_THREAD=OFF")
6969
fi
7070

7171
if [[ "$1" == "format" ]]; then

0 commit comments

Comments
 (0)