]> granicus.if.org Git - esp-idf/commitdiff
esp_err: add NDEBUG guard, comment about flash cache
authorAngus Gratton <angus@espressif.com>
Thu, 2 Mar 2017 04:40:49 +0000 (15:40 +1100)
committerAngus Gratton <angus@espressif.com>
Fri, 3 Mar 2017 03:59:15 +0000 (14:59 +1100)
Follow-up to 316b040

components/esp32/include/esp_err.h

index 059b5973512d5969e6ec35003f50321b9328077b..fe8c004face18dc20e11cdce89b25bf55f40b778 100644 (file)
@@ -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
 }