Skip to content

Commit 6b9848e

Browse files
committed
s/IF_FALSE/UNLESS/ in ET_LOG macro names
"do something unless X" reads much better than "do something if false X". ghstack-source-id: 99fe45c ghstack-comment-id: 2644043544 Pull Request resolved: #8317
1 parent 2e2cf23 commit 6b9848e

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

runtime/core/exec_aten/util/tensor_util.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,14 +338,19 @@
338338
*
339339
* @param[in] cond the condition to check
340340
*/
341-
#define ET_LOG_AND_RETURN_IF_FALSE(cond) \
341+
#define ET_LOG_AND_RETURN_UNLESS(cond) \
342342
do { \
343343
if (!(cond)) { \
344344
ET_LOG(Error, "Check failed (%s): ", #cond); \
345345
return false; \
346346
} \
347347
} while (false)
348348

349+
/**
350+
* DEPRECATED: please use ET_LOG_AND_RETURN_UNLESS instead.
351+
*/
352+
#define ET_LOG_AND_RETURN_IF_FALSE ET_LOG_AND_RETURN_UNLESS
353+
349354
/**
350355
* A convenience macro to be used in utility functions that check whether input
351356
* tensor(s) are valid, which are expected to return a boolean. Checks whether
@@ -354,14 +359,19 @@
354359
* @param[in] cond the condition to check
355360
* @param[in] message an additional message to log with `cond`
356361
*/
357-
#define ET_LOG_MSG_AND_RETURN_IF_FALSE(cond, message, ...) \
362+
#define ET_LOG_MSG_AND_RETURN_UNLESS(cond, message, ...) \
358363
do { \
359364
if (!(cond)) { \
360365
ET_LOG(Error, "Check failed (%s): " message, #cond, ##__VA_ARGS__); \
361366
return false; \
362367
} \
363368
} while (false)
364369

370+
/**
371+
* DEPRECATED: please use ET_LOG_AND_RETURN_UNLESS instead.
372+
*/
373+
#define ET_LOG_MSG_AND_RETURN_IF_FALSE ET_LOG_MSG_AND_RETURN_UNLESS
374+
365375
/**
366376
* If `cond` is false, log `cond` and return from the kernel with a failure
367377
* state set.

0 commit comments

Comments
 (0)