@@ -58,8 +58,7 @@ typedef em_promise_result_t (*em_promise_callback_t)(void** result,
5858// Create a new promise that can be explicitly resolved or rejected using
5959// `emscripten_promise_resolve`. The returned promise handle must eventually be
6060// freed with `emscripten_promise_destroy`.
61- __attribute__((warn_unused_result )) em_promise_t
62- emscripten_promise_create (void );
61+ [[nodiscard ]] em_promise_t emscripten_promise_create (void );
6362
6463// Release the resources associated with this promise. This must be called on
6564// every promise handle created, whether by `emscripten_promise_create` or any
@@ -85,7 +84,7 @@ void emscripten_promise_resolve(em_promise_t promise,
8584// for documentation on how the callbacks work. `data` is arbitrary user data
8685// that will be passed to the callbacks. The returned promise handle must
8786// eventually be freed with `emscripten_promise_destroy`.
88- __attribute__(( warn_unused_result )) em_promise_t
87+ [[ nodiscard ]] em_promise_t
8988emscripten_promise_then (em_promise_t promise ,
9089 em_promise_callback_t on_fulfilled ,
9190 em_promise_callback_t on_rejected ,
@@ -98,8 +97,9 @@ emscripten_promise_then(em_promise_t promise,
9897// were resolved with will be written to the `results` array if it is non-null
9998// and the returned promise will be fulfilled with the address of that array as
10099// well.
101- __attribute__((warn_unused_result )) em_promise_t emscripten_promise_all (
102- em_promise_t * promises , void * * results , size_t num_promises );
100+ [[nodiscard ]] em_promise_t emscripten_promise_all (em_promise_t * promises ,
101+ void * * results ,
102+ size_t num_promises );
103103
104104typedef struct em_settled_result_t {
105105 em_promise_result_t result ;
@@ -113,7 +113,7 @@ typedef struct em_settled_result_t {
113113// fulfilled value or EM_PROMISE_REJECT and the rejection reason for each of the
114114// input promises if `results` is non-null. The returned promise will be
115115// fulfilled with the value of `results` as well.
116- __attribute__(( warn_unused_result )) em_promise_t emscripten_promise_all_settled (
116+ [[ nodiscard ]] em_promise_t emscripten_promise_all_settled (
117117 em_promise_t * promises , em_settled_result_t * results , size_t num_promises );
118118
119119// Call Promise.any to create and return a new promise that is fulfilled once
@@ -124,16 +124,17 @@ __attribute__((warn_unused_result)) em_promise_t emscripten_promise_all_settled(
124124// promise is rejected, the rejection reasons for each input promise will be
125125// written to the `errors` buffer if it is non-null. The rejection reason for
126126// the returned promise will also be the address of the `errors` buffer.
127- __attribute__((warn_unused_result )) em_promise_t emscripten_promise_any (
128- em_promise_t * promises , void * * errors , size_t num_promises );
127+ [[nodiscard ]] em_promise_t emscripten_promise_any (em_promise_t * promises ,
128+ void * * errors ,
129+ size_t num_promises );
129130
130131// Call Promise.race to create and return a new promise that settles once any of
131132// the `num_promises` input promises passed in `promises` has been settled. If
132133// the first input promise to settle is fulfilled, the resulting promise is
133134// fulfilled with the same value. Otherwise, if the first input promise to
134135// settle is rejected, the resulting promise is rejected with the same reason.
135- __attribute__(( warn_unused_result )) em_promise_t
136- emscripten_promise_race ( em_promise_t * promises , size_t num_promises );
136+ [[ nodiscard ]] em_promise_t emscripten_promise_race ( em_promise_t * promises ,
137+ size_t num_promises );
137138
138139// Suspend the current Wasm execution context until the given promise has been
139140// settled.
@@ -143,7 +144,7 @@ emscripten_promise_race(em_promise_t* promises, size_t num_promises);
143144// with this function.
144145//
145146// This function can only be used in programs that were built with `-sASYNCIFY`.
146- __attribute__(( warn_unused_result )) em_settled_result_t
147+ [[ nodiscard ]] em_settled_result_t
147148emscripten_promise_await (em_promise_t promise );
148149
149150#ifdef __cplusplus
0 commit comments