New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 891602 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

EC: Compile with -Wstrict-prototypes -Wmissing-prototypes

Project Member Reported by gwendal@chromium.org, Oct 3

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]


 
Cc: jettrink@chromium.org dzigterman@chromium.org
Owner: dzigterman@chromium.org
Diana, can you take a look at these failures an fix them up? My guess is a lot of them are missing #includes. 
Yes, I'll take a look
From an initial glance, most of these seem to be functions which are only used within their own file and should probably be static.  
Ya. It should be relatively straight forward to fix. My guess is it'd take an hour or so to sort out.
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

Status: Assigned (was: Untriaged)
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