Skip to content

Commit 397fafd

Browse files
committed
Prune AM_ASYNC_LABEL as redundant
1 parent 5e325b7 commit 397fafd

File tree

3 files changed

+4
-23
lines changed

3 files changed

+4
-23
lines changed

docs/api.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,6 @@ The source code of the corresponding header file is in `async.h <https://github.
341341

342342
.. doxygendefine:: AM_ASYNC_END
343343

344-
.. doxygendefine:: AM_ASYNC_LABEL
345-
346344
.. doxygendefine:: AM_ASYNC_AWAIT
347345

348346
.. doxygendefine:: AM_ASYNC_YIELD

libs/async/async.h

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct am_async {
5151
/* clang-format off */
5252

5353
/**
54-
* Mark the beginning of async function block.
54+
* Mark the beginning of async function.
5555
*
5656
* Should be called at the beginning of async function.
5757
*
@@ -66,7 +66,7 @@ struct am_async {
6666
case __LINE__:
6767

6868
/**
69-
* Mark the end of async function and return completion.
69+
* Mark the end of async function.
7070
*
7171
* Resets the async state to the initial state
7272
* indicating that the async operation has completed.
@@ -78,31 +78,16 @@ struct am_async {
7878
return;
7979

8080
/**
81-
* Mark the end of async function block and handle any unexpected states.
81+
* Mark the end of async function block.
8282
*
83-
* Calls AM_ASYNC_EXIT() internally to reset the async state to
84-
* the initial state.
83+
* Resets the async state.
8584
*/
8685
#define AM_ASYNC_END() \
8786
AM_ASYNC_EXIT(); \
8887
default: \
8988
AM_ASSERT(0); \
9089
}}
9190

92-
/**
93-
* Set label in async function.
94-
*
95-
* Stores the current line number in the `struct am_async``::state` field,
96-
* enabling the async function to resume from this point.
97-
*/
98-
#define AM_ASYNC_LABEL() \
99-
/* to suppress cppcheck warnings */ \
100-
(void)am_async_->state; \
101-
am_async_->state = __LINE__; \
102-
/* FALLTHROUGH */ \
103-
case __LINE__:
104-
105-
10691
/**
10792
* Await a condition before proceeding.
10893
*

libs/async/test.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,10 @@
3333
static void am_async_reentrant(struct am_async *me, int *reent, int *state) {
3434
++(*reent);
3535
AM_ASYNC_BEGIN(me);
36-
AM_ASYNC_LABEL();
3736
if (*state == 0) {
3837
*state = 1;
3938
AM_ASYNC_EXIT();
4039
}
41-
AM_ASYNC_LABEL();
4240
if (*state == 1) {
4341
*state = 2;
4442
AM_ASYNC_EXIT();

0 commit comments

Comments
 (0)