EC: Compile with -Wstrict-prototypes -Wmissing-prototypes |
||
Issue description
When compiling with these warnings:
iff --git a/Makefile.toolchain b/Makefile.toolchain
index 20a01ebb4..15997403b 100644
--- a/Makefile.toolchain
+++ b/Makefile.toolchain
@@ -47,7 +47,8 @@ PROTOC?=protoc
C_WARN = -Wstrict-prototypes -Wdeclaration-after-statement -Wno-pointer-sign
COMMON_WARN = -Wall -Werror -Wundef -Wno-trigraphs -fno-strict-aliasing \
-fno-common -Werror-implicit-function-declaration \
- -Wno-format-security -fno-strict-overflow
+ -Wno-format-security -fno-strict-overflow \
+ -Wstrict-prototypes -Wmissing-prototypes
ifeq ($(cc-name),clang)
# clang is pickier when it comes to packed struct members alignment.
C_WARN+= -Wno-address-of-packed-member
Several functions have no prototypes:
make -j buildall > /tmp/err 2>&1
grep "no previous prototype" /tmp/err | sort | uniq
baseboard/octopus/baseboard.c:156:6: error: no previous prototype for ‘chipset_do_shutdown’ [-Werror=missing-prototypes]
baseboard/octopus/baseboard.c:176:6: error: no previous prototype for ‘baseboard_tcpc_init’ [-Werror=missing-prototypes]
board/minimuffin/usb_pd_policy.c:422:6: error: no previous prototype for ‘pd_adc_interrupt’ [-Werror=missing-prototypes]
board/pdeval-stm32f072/usb_pd_policy.c:126:6: error: no previous prototype for ‘button_event’ [-Werror=missing-prototypes]
board/plankton/usb_pd_policy.c:58:5: error: no previous prototype for ‘charge_manager_get_source_pdo’ [-Werror=missing-prototypes]
board/rainier/usb_pd_policy.c:59:5: error: no previous prototype for ‘board_vbus_source_enabled’ [-Werror=missing-prototypes]
board/servo_v4/usb_pd_policy.c:428:5: error: no previous prototype for ‘board_select_rp_value’ [-Werror=missing-prototypes]
TpmFail.c:136:1: error: no previous prototype for ‘SetForceFailureMode’ [-Werror=missing-prototypes]
util/ecst.c:1241:6: error: no previous prototype for ‘update_calculation’ [-Werror=missing-prototypes]
util/export_taskinfo.c:38:10: error: no previous prototype for ‘get_ro_taskinfos’ [-Werror=missing-prototypes]
util/export_taskinfo.c:38:10: error: no previous prototype for ‘get_rw_taskinfos’ [-Werror=missing-prototypes]
util/gen_emmc_transfer_data.c:22:10: error: no previous prototype for ‘crc16_arg’ [-Werror=missing-prototypes]
util/gen_emmc_transfer_data.c:37:6: error: no previous prototype for ‘header_format’ [-Werror=missing-prototypes]
util/genvif.c:40:7: error: no previous prototype for ‘yes_no’ [-Werror=missing-prototypes]
util/iteflash.c:1058:5: error: no previous prototype for ‘command_write_unprotect’ [-Werror=missing-prototypes]
util/iteflash.c:1064:5: error: no previous prototype for ‘command_erase’ [-Werror=missing-prototypes]
util/iteflash.c:1143:5: error: no previous prototype for ‘command_erase2’ [-Werror=missing-prototypes]
util/iteflash.c:1218:5: error: no previous prototype for ‘read_flash’ [-Werror=missing-prototypes]
util/iteflash.c:1253:5: error: no previous prototype for ‘write_flash’ [-Werror=missing-prototypes]
util/iteflash.c:1300:5: error: no previous prototype for ‘write_flash2’ [-Werror=missing-prototypes]
util/iteflash.c:1358:5: error: no previous prototype for ‘verify_flash’ [-Werror=missing-prototypes]
util/iteflash.c:1447:6: error: no previous prototype for ‘display_usage’ [-Werror=missing-prototypes]
util/iteflash.c:1467:5: error: no previous prototype for ‘parse_parameters’ [-Werror=missing-prototypes]
util/iteflash.c:828:5: error: no previous prototype for ‘command_read_pages’ [-Werror=missing-prototypes]
util/iteflash.c:881:5: error: no previous prototype for ‘command_write_pages’ [-Werror=missing-prototypes]
util/iteflash.c:980:5: error: no previous prototype for ‘command_write_pages2’ [-Werror=missing-prototypes]
,
Oct 3
Yes, I'll take a look
,
Oct 3
From an initial glance, most of these seem to be functions which are only used within their own file and should probably be static.
,
Oct 4
Ya. It should be relatively straight forward to fix. My guess is it'd take an hour or so to sort out.
,
Oct 4
After sorting out some of the initial issues, the build is able to progress further. However, this yields even more warnings so getting a full build working will probably take a little while. My current warning count for a full build after addressing the octopus baseboard, ecst.c, export_taskinfo.c, iteflash.c, and genvif.c: $ grep "no previous prototype" /tmp/err | sort | uniq |wc -l 502
,
Jan 11
This issue has an owner, a component and a priority, but is still listed as untriaged or unconfirmed. By definition, this bug is triaged. Changing status to "assigned". Please reach out to me if you disagree with how I've done this. |
||
►
Sign in to add a comment |
||
Comment 1 by adurbin@chromium.org
, Oct 3Owner: dzigterman@chromium.org