trezor-firmware
trezor-firmware copied to clipboard
Conform to -Wstrict-prototypes on New Compilers
The codebase contains a number of C functions that do not take any parameters but are not marked with void. This style is deprecated, and compilers warn for it with -Wstrict-prototypes:
zkp_context.c:54:21: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
int zkp_context_init() {
^
void
With the upcoming clang-15 compiler, -Wstrict-prototypes is now enabled by default, leading to build failures due to treating warnings as errors via -Werror. The relevant change discussion also gives some context why the explicit void definition is better.
I propose switching all zero-parameter functions to the explicit void definition, and explicitly enabling -Wstrict-prototypes on gcc builds as well to ensure that no regressions are introduced. There are about a dozen cases in zkp_context.c, oled.c, common.c, config.c, fsm_msg_common.h, stellar.c and other places.
This may help the compiler to produce better code but should otherwise introduce no functional changes.