espressif / esp-dsp

DSP library for ESP-IDF
Apache License 2.0
442 stars 87 forks source link

Add missing stdlib includes (DSP-76) #43

Closed Barabas5532 closed 1 year ago

Barabas5532 commented 2 years ago

Some files use malloc without including stdlib.h. It works on esp32 by some transitive include, but breaks when trying to compile for Linux with a customized CMakeLists.txt.

dmitry1945 commented 1 year ago

@Barabas5532 the esp_log.h includes definition for the stdlib.h. And, we not include stdlib.h if we not use functions from them.

Barabas5532 commented 1 year ago

Relying on that transitive include is bad practice. If esp_log.h is changed to no longer include stdlib.h then the esp-dsp project will break too. This is exactly what happened for me by replacing esp_log.h with a stub version.

I only added the stdlib include to files that were causing compiler errors due to missing declaration of malloc.

dmitry1945 commented 1 year ago

@Barabas5532 agree about mallock, now, in master we have inside both, because we use memalign, and for printing using , that's why is not included. But, is still missing inside dsps_fft4r_fc32_ansi.c . I will add it. Thank you, Barabas.