boarchuz / HULP

ESP32 ULP Coprocessor Helper
MIT License
180 stars 18 forks source link

Appease GCC's 'return-type' warning #20

Closed johnboiles closed 2 years ago

johnboiles commented 2 years ago

GCC isn't smart enough that if we get to the assert the return value doesn't matter anyways and raises a control reaches end of non-void function warning. This is especially a bummer when treating warnings as errors (which I think is the ESP-IDF 4.4 default)

embedded-app/components/HULP/src/hulp.c: In function 'print_insn':
embedded-app/components/HULP/src/hulp.c:663:1: error: control reaches end of non-void function [-Werror=return-type]
 }
 ^
cc1: some warnings being treated as errors
boarchuz commented 2 years ago

Thanks @johnboiles, I think abort() might be better here as this is a fatal error (should never return and should be clear that it never returns)? assert(0) is definitely incorrect as its behaviour depends on the build configuration, thanks for pointing that out.

johnboiles commented 2 years ago

Just confirmed that also compiles fine. Works for me!