!39703 Fix error log when null-check failed.

Merge pull request !39703 from TronZhang/fix_error_log_for_nullcheck
This commit is contained in:
i-robot 2022-08-05 01:56:04 +00:00 committed by Gitee
commit ae19b79f00
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 15 additions and 15 deletions

View File

@ -311,25 +311,25 @@ inline bool IS_OUTPUT_ON(enum MsLogLevel level) noexcept(true) {
#define MS_EXCEPTION(type) MSLOG_THROW(type)
} // namespace mindspore
#define MS_EXCEPTION_IF_NULL(ptr) \
#define MS_EXCEPTION_IF_NULL(ptr) \
do { \
if ((ptr) == nullptr) { \
MS_LOG(EXCEPTION) << "The pointer[" << #ptr << "] is null."; \
} \
} while (0)
#define MS_EXCEPTION_IF_CHECK_FAIL(condition, error_info) \
do { \
if ((ptr) == nullptr) { \
MS_LOG(EXCEPTION) << ": The pointer[" << #ptr << "] is null."; \
if (!(condition)) { \
MS_LOG(EXCEPTION) << "Failure info [" << (error_info) << "]."; \
} \
} while (0)
#define MS_EXCEPTION_IF_CHECK_FAIL(condition, error_info) \
do { \
if (!(condition)) { \
MS_LOG(EXCEPTION) << ": Failure info [" << (error_info) << "]."; \
} \
} while (0)
#define MS_EXCEPTION_IF_ZERO(name, value) \
do { \
if ((value) == 0) { \
MS_LOG(EXCEPTION) << ": The " << (name) << " is zero."; \
} \
#define MS_EXCEPTION_IF_ZERO(name, value) \
do { \
if ((value) == 0) { \
MS_LOG(EXCEPTION) << "The " << (name) << " is zero."; \
} \
} while (0)
#define MS_ERROR_IF_NULL(ptr) \