mbedtls icon indicating copy to clipboard operation
mbedtls copied to clipboard

Default to stricter warning flags in CMakeLists.txt and all.sh

Open gilles-peskine-arm opened this issue 7 months ago • 0 comments

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.

gilles-peskine-arm avatar Jun 27 '24 11:06 gilles-peskine-arm