]> granicus.if.org Git - esp-idf/commitdiff
Fixes for stdlib.h inclusion
authorAngus Gratton <angus@espressif.com>
Wed, 23 Nov 2016 21:08:09 +0000 (08:08 +1100)
committerAngus Gratton <angus@espressif.com>
Wed, 23 Nov 2016 21:20:21 +0000 (08:20 +1100)
Refs:
http://esp32.com/viewtopic.php?f=13&t=550
http://esp32.com/viewtopic.php?f=13&t=551

rmt.c should include stdlib.h for malloc, esp_bignum,c &
https_request_main.c for abort().

FreeRTOSConfig.h is only including stdlib if
CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION is set. However, it is
included for abort() so needs to be included whenever
CONFIG_FREERTOS_ASSERT_FAIL_ABORT is set.

This change includes unconditionally in FreeRTOSConfig.h. This is to
avoid this kind of bug where compiler errors are dependent on config. I
suggest we don't change this to be more selective until we have 'make
randomconfig' style tests in CI.

components/driver/rmt.c
components/freertos/include/freertos/FreeRTOSConfig.h
components/mbedtls/port/esp_bignum.c
examples/04_https_request/main/https_request_main.c

index 21bc8696b0ba55e4856fbbf70aa6cf96fa35b12e..9fc36d49c2e35cc5e5a61b4a3d87a6f04dd26a4f 100644 (file)
@@ -13,6 +13,7 @@
 // limitations under the License.
 #include <esp_types.h>
 #include <string.h>
+#include <stdlib.h>
 #include "freertos/FreeRTOS.h"
 #include "freertos/semphr.h"
 #include "freertos/xtensa_api.h"
index 13ce73e0a8109ab6c8795775098493ae04a43e07..4f1012657a0ed7178cc846f9ee60b27056fa99c0 100644 (file)
 
 /* configASSERT behaviour */
 #ifndef __ASSEMBLER__
+#include <stdlib.h> /* for abort() */
 #include "rom/ets_sys.h"
 
 #if defined(CONFIG_FREERTOS_ASSERT_DISABLE)
 #endif
 
 #if CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION
-#include <stdlib.h>
-#include "rom/ets_sys.h"
 #define UNTESTED_FUNCTION() { ets_printf("Untested FreeRTOS function %s\r\n", __FUNCTION__); configASSERT(false); } while(0)
 #else
 #define UNTESTED_FUNCTION()
index 7570820e3ba523b4b0bf367d9dc8b2cc476530b1..ec2e420398d59bdb95c881efad89ad0ca0c72e31 100644 (file)
@@ -25,6 +25,7 @@
 #include <malloc.h>
 #include <limits.h>
 #include <assert.h>
+#include <stdlib.h>
 #include "mbedtls/bignum.h"
 #include "rom/bigint.h"
 #include "soc/hwcrypto_reg.h"
index 2ad56681d098433c004d47e711cc93eec42392f0..1f7112bc86c6dae6570665b420e34e61aef1060f 100644 (file)
@@ -22,6 +22,7 @@
  * limitations under the License.
  */
 #include <string.h>
+#include <stdlib.h>
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
 #include "freertos/event_groups.h"