File tree Expand file tree Collapse file tree 4 files changed +28
-23
lines changed Expand file tree Collapse file tree 4 files changed +28
-23
lines changed Original file line number Diff line number Diff line change 34
34
* @param[in] ... Format string arguments.
35
35
*/
36
36
#define ET_CHECK_MSG (_cond , _format , ...) \
37
- ( { \
37
+ do { \
38
38
if ET_UNLIKELY (!(_cond)) { \
39
39
ET_ASSERT_MESSAGE_EMIT(" (%s): " _format, #_cond, ##__VA_ARGS__); \
40
40
::executorch::runtime::runtime_abort(); \
41
41
} \
42
- })
42
+ } while (0)
43
+
43
44
44
45
/**
45
46
* Abort the runtime if the condition is not true.
48
49
* @param[in] _cond Condition asserted as true.
49
50
*/
50
51
#define ET_CHECK (_cond ) \
51
- ( { \
52
+ do { \
52
53
if ET_UNLIKELY (!(_cond)) { \
53
54
ET_ASSERT_MESSAGE_EMIT(": %s", #_cond); \
54
55
::executorch::runtime::runtime_abort(); \
55
56
} \
56
- })
57
+ } while (0 )
57
58
58
59
#ifdef NDEBUG
59
60
102
103
* Assert that this code location is unreachable during execution.
103
104
*/
104
105
#define ET_ASSERT_UNREACHABLE () \
105
- ({ \
106
+ do { \
106
107
ET_CHECK_MSG(false, "Execution should not reach this point"); \
107
108
ET_UNREACHABLE(); \
108
- })
109
+ } while (0 )
109
110
110
111
/**
111
112
* Assert that this code location is unreachable during execution.
Original file line number Diff line number Diff line change 50
50
* Assert that the PAL has been initialized.
51
51
*/
52
52
#define _ASSERT_PAL_INITIALIZED () \
53
- ({ \
53
+ do { \
54
54
if (!initialized) { \
55
55
fprintf ( \
56
56
ET_LOG_OUTPUT_FILE, \
59
59
fflush (ET_LOG_OUTPUT_FILE); \
60
60
et_pal_abort (); \
61
61
} \
62
- })
62
+ } while ( 0 )
63
63
64
64
#endif // NDEBUG
65
65
Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ using ::executorch::runtime::LogLevel;
155
155
* @param[in] _format Log message format string.
156
156
*/
157
157
#define ET_LOG (_level, _format, ...) \
158
- ( { \
158
+ do { \
159
159
const auto _log_level = ::executorch::runtime::LogLevel::_level; \
160
160
if (static_cast <uint32_t >(_log_level) >= \
161
161
static_cast <uint32_t >( \
@@ -171,8 +171,7 @@ using ::executorch::runtime::LogLevel;
171
171
_format, \
172
172
##__VA_ARGS__); \
173
173
} \
174
- })
175
-
174
+ } while (0 )
176
175
#else // ET_LOG_ENABLED
177
176
178
177
/* *
Original file line number Diff line number Diff line change @@ -248,37 +248,42 @@ using ::executorch::runtime::track_allocator;
248
248
249
249
#else
250
250
251
- #define EXECUTORCH_PROFILE_CREATE_BLOCK (name ) ({ (void )(name); })
251
+ #define EXECUTORCH_PROFILE_CREATE_BLOCK (name ) \
252
+ do { \
253
+ (void )(name); \
254
+ } while (0 )
252
255
253
256
#define EXECUTORCH_BEGIN_PROF (name ) \
254
257
{}
255
258
256
- #define EXECUTORCH_END_PROF (token_id ) ({ (void )(token_id); })
259
+ #define EXECUTORCH_END_PROF (token_id ) \
260
+ do { \
261
+ (void )(token_id); \
262
+ } while (0 )
257
263
258
- #define EXECUTORCH_SCOPE_PROF (name ) ({ (void )(name); })
264
+ #define EXECUTORCH_SCOPE_PROF (name ) \
265
+ do { \
266
+ (void )(name); \
267
+ } while (0 )
259
268
260
269
#define EXECUTORCH_PROFILE_INSTRUCTION_SCOPE (chain_idx, instruction_idx ) \
261
- ({ \
270
+ do { \
262
271
(void )(chain_idx); \
263
272
(void )(instruction_idx); \
264
- })
273
+ } while ( 0 )
265
274
266
275
#define EXECUTORCH_DUMP_PROFILE_RESULTS (prof_result_test ) \
267
276
memset (prof_result_test, 0 , sizeof (::executorch::runtime::prof_result_t ));
268
277
269
278
#define EXECUTORCH_RESET_PROFILE_RESULTS () \
270
279
{}
271
280
272
- #define EXECUTORCH_TRACK_ALLOCATOR (name ) \
273
- ({ \
274
- (void )(name); \
275
- -1 ; \
276
- })
281
+ #define EXECUTORCH_TRACK_ALLOCATOR (name ) ((void )(name), -1 )
277
282
278
283
#define EXECUTORCH_TRACK_ALLOCATION (id, size ) \
279
- ({ \
284
+ do { \
280
285
(void )(id); \
281
286
(void )(size); \
282
- })
287
+ } while ( 0 )
283
288
284
289
#endif
You can’t perform that action at this time.
0 commit comments