From e08cf27b8afd78bb9c9054edc813c964fbf67a30 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Thu, 2 Mar 2017 15:40:49 +1100 Subject: [PATCH] esp_err: add NDEBUG guard, comment about flash cache Follow-up to 316b040 --- components/esp32/include/esp_err.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/components/esp32/include/esp_err.h b/components/esp32/include/esp_err.h index 059b597351..fe8c004fac 100644 --- a/components/esp32/include/esp_err.h +++ b/components/esp32/include/esp_err.h @@ -44,8 +44,15 @@ typedef int32_t esp_err_t; * Macro which can be used to check the error code, * and terminate the program in case the code is not ESP_OK. * Prints the failed statement to serial output. + * + * Note: this macro is not safe to use if flash cache + * may be disabled. */ +#ifdef NDEBUG +#define ESP_ERROR_CHECK(x) +#else #define ESP_ERROR_CHECK(x) do { esp_err_t rc = (x); if (rc != ESP_OK) { ESP_LOGE("err", "esp_err_t = %d", rc); assert(0 && #x);} } while(0); +#endif #ifdef __cplusplus }