|
332 | 332 | }) |
333 | 333 |
|
334 | 334 | /** |
| 335 | + * DEPRECATED: Please use ET_CHECK_OR_RETURN_FALSE instead and provide |
| 336 | + * an informative message. (For example, the values of any variables used in |
| 337 | + * `cond` would not be reported automatically by this macro.) |
| 338 | + * |
335 | 339 | * A convenience macro to be used in utility functions that check whether input |
336 | 340 | * tensor(s) are valid, which are expected to return a boolean. Checks whether |
337 | 341 | * `cond` is true; if not, log the failed check and return false. |
338 | 342 | * |
339 | 343 | * @param[in] cond the condition to check |
340 | 344 | */ |
341 | | -#define ET_LOG_AND_RETURN_IF_FALSE(cond) \ |
342 | | - do { \ |
343 | | - if (!(cond)) { \ |
344 | | - ET_LOG(Error, "Check failed (%s): ", #cond); \ |
345 | | - return false; \ |
346 | | - } \ |
347 | | - } while (false) |
| 345 | +#define ET_LOG_AND_RETURN_IF_FALSE(cond) ET_CHECK_OR_RETURN_FALSE(cond, "") |
348 | 346 |
|
349 | 347 | /** |
350 | | - * A convenience macro to be used in utility functions that check whether input |
351 | | - * tensor(s) are valid, which are expected to return a boolean. Checks whether |
352 | | - * `cond` is true; if not, log the failed check with `message` and return false. |
353 | | - * |
354 | | - * @param[in] cond the condition to check |
355 | | - * @param[in] message an additional message to log with `cond` |
| 348 | + * DEPRECATED: Please use ET_CHECK_OR_RETURN_FALSE instead. |
356 | 349 | */ |
357 | | -#define ET_LOG_MSG_AND_RETURN_IF_FALSE(cond, message, ...) \ |
358 | | - do { \ |
359 | | - if (!(cond)) { \ |
360 | | - ET_LOG(Error, "Check failed (%s): " message, #cond, ##__VA_ARGS__); \ |
361 | | - return false; \ |
362 | | - } \ |
363 | | - } while (false) |
| 350 | +#define ET_LOG_MSG_AND_RETURN_IF_FALSE ET_CHECK_OR_RETURN_FALSE |
364 | 351 |
|
365 | 352 | /** |
366 | 353 | * If `cond` is false, log `cond` and return from the kernel with a failure |
|
0 commit comments