Fixed unique symbol name for result inside macro
This commit is contained in:
@ -3,19 +3,19 @@
|
|||||||
namespace espcpputils {
|
namespace espcpputils {
|
||||||
|
|
||||||
#define CALL_AND_EXIT_ON_ERROR(METHOD, ...) \
|
#define CALL_AND_EXIT_ON_ERROR(METHOD, ...) \
|
||||||
if (const auto result = METHOD(__VA_ARGS__); result != ESP_OK) \
|
if (const auto result##__LINE__ = METHOD(__VA_ARGS__); result##__LINE__ != ESP_OK) \
|
||||||
{ \
|
{ \
|
||||||
ESP_LOGE(TAG, "%s() failed with %s", #METHOD, esp_err_to_name(result)); \
|
ESP_LOGE(TAG, "%s() failed with %s", #METHOD, esp_err_to_name(result##__LINE__)); \
|
||||||
return result; \
|
return result##__LINE__; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CALL_AND_EXIT(METHOD, ...) \
|
#define CALL_AND_EXIT(METHOD, ...) \
|
||||||
if (const auto result = METHOD(__VA_ARGS__); result != ESP_OK) \
|
if (const auto result##__LINE__ = METHOD(__VA_ARGS__); result##__LINE__ != ESP_OK) \
|
||||||
{ \
|
{ \
|
||||||
ESP_LOGE(TAG, "%s() failed with %s", #METHOD, esp_err_to_name(result)); \
|
ESP_LOGE(TAG, "%s() failed with %s", #METHOD, esp_err_to_name(result##__LINE__)); \
|
||||||
return result; \
|
return result##__LINE__; \
|
||||||
} \
|
} \
|
||||||
else \
|
else \
|
||||||
return result;
|
return result##__LINE__;
|
||||||
|
|
||||||
} // namespace espcpputils
|
} // namespace espcpputils
|
||||||
|
Reference in New Issue
Block a user