mbedtls
mbedtls copied to clipboard
Default to stricter warning flags in CMakeLists.txt and all.sh
In all.sh
, we do most builds with gcc -Wall -Wextra
or clang -Wall -Wextra
, sometimes a few more flags from CMakeLists.txt
when doing a CMake build (depending on the build type — IIRC Check
is stricter than Asan
). We should enable more flags, to catch buggy or non-portable code. In particular:
-
-std=c99 -pedantic
-
-Wwrite-strings
-
-Wlogical-op
-
-Wshadow
-
-Wformat-signedness -Wformat-overflow=2 -Wformat-truncation
, maybe other printf flags
This would haved allowed us to catch bugs such as https://github.com/Mbed-TLS/mbedtls/issues/9311 (discussion).
We should also use newer compilers, but that's out of scope here.