未验证 提交 674355a0 编写于 作者: Z Zeng Jinle 提交者: GitHub

fix GET_DATA_SAFELY ptr, test=develop (#23679)

上级 37fcf03a
...@@ -394,8 +394,8 @@ struct EnforceNotMet : public std::exception { ...@@ -394,8 +394,8 @@ struct EnforceNotMet : public std::exception {
*/ */
#define GET_DATA_SAFELY(__PTR, __ROLE, __NAME, __OP_TYPE) \ #define GET_DATA_SAFELY(__PTR, __ROLE, __NAME, __OP_TYPE) \
(([&]() -> std::add_lvalue_reference<decltype(*(__PTR))>::type { \ (([&]() -> std::add_lvalue_reference<decltype(*(__PTR))>::type { \
auto* ptr = (__PTR); \ auto* __ptr = (__PTR); \
if (UNLIKELY(nullptr == ptr)) { \ if (UNLIKELY(nullptr == __ptr)) { \
__THROW_ERROR_INTERNAL__( \ __THROW_ERROR_INTERNAL__( \
"%s\n [Hint: pointer " #__PTR " should not be null.]", \ "%s\n [Hint: pointer " #__PTR " should not be null.]", \
paddle::platform::errors::NotFound( \ paddle::platform::errors::NotFound( \
...@@ -405,13 +405,13 @@ struct EnforceNotMet : public std::exception { ...@@ -405,13 +405,13 @@ struct EnforceNotMet : public std::exception {
" 2. The %s has no corresponding variable passed in;\n" \ " 2. The %s has no corresponding variable passed in;\n" \
" 3. The %s corresponding variable is not initialized.", \ " 3. The %s corresponding variable is not initialized.", \
paddle::platform::demangle( \ paddle::platform::demangle( \
typeid(std::add_lvalue_reference<decltype(*ptr)>::type) \ typeid(std::add_lvalue_reference<decltype(*__ptr)>::type) \
.name()), \ .name()), \
__ROLE, __NAME, __OP_TYPE, __NAME, __ROLE, __OP_TYPE, __NAME, \ __ROLE, __NAME, __OP_TYPE, __NAME, __ROLE, __OP_TYPE, __NAME, \
__NAME) \ __NAME) \
.ToString()); \ .ToString()); \
} \ } \
return *ptr; \ return *__ptr; \
})()) })())
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册