]> granicus.if.org Git - esp-idf/commitdiff
esp_err: Don't compile in error message strings in "silent assertions" mode
authorAngus Gratton <angus@espressif.com>
Mon, 1 Oct 2018 06:22:33 +0000 (16:22 +1000)
committerAngus Gratton <gus@projectgus.com>
Tue, 2 Oct 2018 07:00:57 +0000 (17:00 +1000)
Reported on forum https://esp32.com/viewtopic.php?f=13&t=7396&p=31419#p31419

components/esp32/include/esp_err.h

index 9dcb25af6e6a953f2e4c025b9d10a26e423b60c6..8000825e791c2473f475f5a98b3a59b4ae1e0387 100644 (file)
@@ -102,6 +102,13 @@ void _esp_error_check_failed(esp_err_t rc, const char *file, int line, const cha
         esp_err_t __err_rc = (x);                                       \
         (void) sizeof(__err_rc);                                        \
     } while(0);
+#elif defined(CONFIG_OPTIMIZATION_ASSERTIONS_SILENT)
+#define ESP_ERROR_CHECK(x) do {                                         \
+        esp_err_t __err_rc = (x);                                       \
+        if (__err_rc != ESP_OK) {                                       \
+            abort();                                                    \
+        }                                                               \
+    } while(0);
 #else
 #define ESP_ERROR_CHECK(x) do {                                         \
         esp_err_t __err_rc = (x);                                       \