File tree Expand file tree Collapse file tree 5 files changed +28
-24
lines changed
examples/qualcomm/oss_scripts/llama2/runner Expand file tree Collapse file tree 5 files changed +28
-24
lines changed Original file line number Diff line number Diff line change @@ -654,7 +654,7 @@ Error Runner::mem_alloc(size_t alignment, size_t seq_len) {
654654 // Reset and re-init again to trigger registered function
655655 module_.reset ();
656656 module_ = std::make_unique<Module>(
657- model_path_, Module::LoadMode::MmapUseMlockIgnoreErrors),
657+ model_path_, Module::LoadMode::MmapUseMlockIgnoreErrors);
658658 ET_CHECK_MSG (load () == Error::Ok, " Runner failed to load method" );
659659
660660 return Error::Ok;
Original file line number Diff line number Diff line change 3434 * @param[in] ... Format string arguments.
3535 */
3636#define ET_CHECK_MSG (_cond , _format , ...) \
37- ({ \
37+ do { \
3838 if ET_UNLIKELY (!(_cond)) { \
3939 ET_ASSERT_MESSAGE_EMIT(" (%s): " _format, #_cond, ##__VA_ARGS__); \
4040 ::executorch::runtime::runtime_abort(); \
4141 } \
42- })
42+ } while (0 )
4343
4444/**
4545 * Abort the runtime if the condition is not true.
4848 * @param[in] _cond Condition asserted as true.
4949 */
5050#define ET_CHECK (_cond ) \
51- ({ \
51+ do { \
5252 if ET_UNLIKELY (!(_cond)) { \
5353 ET_ASSERT_MESSAGE_EMIT(": %s", #_cond); \
5454 ::executorch::runtime::runtime_abort(); \
5555 } \
56- })
56+ } while (0 )
5757
5858#ifdef NDEBUG
5959
102102 * Assert that this code location is unreachable during execution.
103103 */
104104#define ET_ASSERT_UNREACHABLE () \
105- ({ \
105+ do { \
106106 ET_CHECK_MSG(false, "Execution should not reach this point"); \
107107 ET_UNREACHABLE(); \
108- })
108+ } while (0 )
109109
110110/**
111111 * Assert that this code location is unreachable during execution.
Original file line number Diff line number Diff line change 5050 * Assert that the PAL has been initialized.
5151 */
5252#define _ASSERT_PAL_INITIALIZED () \
53- ({ \
53+ do { \
5454 if (!initialized) { \
5555 fprintf ( \
5656 ET_LOG_OUTPUT_FILE, \
5959 fflush (ET_LOG_OUTPUT_FILE); \
6060 et_pal_abort (); \
6161 } \
62- })
62+ } while ( 0 )
6363
6464#endif // NDEBUG
6565
Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ using ::executorch::runtime::LogLevel;
155155 * @param[in] _format Log message format string.
156156 */
157157#define ET_LOG (_level, _format, ...) \
158- ({ \
158+ do { \
159159 const auto _log_level = ::executorch::runtime::LogLevel::_level; \
160160 if (static_cast <uint32_t >(_log_level) >= \
161161 static_cast <uint32_t >( \
@@ -171,8 +171,7 @@ using ::executorch::runtime::LogLevel;
171171 _format, \
172172 ##__VA_ARGS__); \
173173 } \
174- })
175-
174+ } while (0 )
176175#else // ET_LOG_ENABLED
177176
178177/* *
Original file line number Diff line number Diff line change @@ -248,37 +248,42 @@ using ::executorch::runtime::track_allocator;
248248
249249#else
250250
251- #define EXECUTORCH_PROFILE_CREATE_BLOCK (name ) ({ (void )(name); })
251+ #define EXECUTORCH_PROFILE_CREATE_BLOCK (name ) \
252+ do { \
253+ (void )(name); \
254+ } while (0 )
252255
253256#define EXECUTORCH_BEGIN_PROF (name ) \
254257 {}
255258
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 )
257263
258- #define EXECUTORCH_SCOPE_PROF (name ) ({ (void )(name); })
264+ #define EXECUTORCH_SCOPE_PROF (name ) \
265+ do { \
266+ (void )(name); \
267+ } while (0 )
259268
260269#define EXECUTORCH_PROFILE_INSTRUCTION_SCOPE (chain_idx, instruction_idx ) \
261- ({ \
270+ do { \
262271 (void )(chain_idx); \
263272 (void )(instruction_idx); \
264- })
273+ } while ( 0 )
265274
266275#define EXECUTORCH_DUMP_PROFILE_RESULTS (prof_result_test ) \
267276 memset (prof_result_test, 0 , sizeof (::executorch::runtime::prof_result_t ));
268277
269278#define EXECUTORCH_RESET_PROFILE_RESULTS () \
270279 {}
271280
272- #define EXECUTORCH_TRACK_ALLOCATOR (name ) \
273- ({ \
274- (void )(name); \
275- -1 ; \
276- })
281+ #define EXECUTORCH_TRACK_ALLOCATOR (name ) ((void )(name), -1 )
277282
278283#define EXECUTORCH_TRACK_ALLOCATION (id, size ) \
279- ({ \
284+ do { \
280285 (void )(id); \
281286 (void )(size); \
282- })
287+ } while ( 0 )
283288
284289#endif
You can’t perform that action at this time.
0 commit comments