diff options
author | Julius Werner <jwerner@chromium.org> | 2019-05-07 12:59:47 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-05-14 20:13:04 -0700 |
commit | 52fa8c11f8e5217e17da74c04e8ad1e5aee9ff40 (patch) | |
tree | a4894fe06a3f1c9fcbbfe728955f75a8de59ed93 /utility/tpmc.c | |
parent | 88a47ff99952bb4f270a4e80c80c578e39fb9477 (diff) | |
download | vboot-52fa8c11f8e5217e17da74c04e8ad1e5aee9ff40.tar.gz |
Makefile: Enable more warnings for host utilities / tests
This patch adds a bunch of more warnings that are already enabled in
coreboot and thus already enabled for firmware builds anyway (because
coreboot just passes its CFLAGS through). Enabling it in the vboot
Makefile means they also apply to host utilities and tests, which sounds
desirable for consistency.
Fix enough of the cruft and bad coding practices that accumulated over
the years of not having warnings enabled to get it to build again (this
includes making functions static, removing dead code, cleaning up
prototypes, etc.).
Also remove -fno-strict-aliasing from the x86 firmware build options,
because it's not clear why it's there (coreboot isn't doing this, so
presumably it's not needed).
BRANCH=None
BUG=None
TEST=make runtests
Change-Id: Ie4a42083c4770a4eca133b22725be9ba85b24184
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1598721
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Diffstat (limited to 'utility/tpmc.c')
-rw-r--r-- | utility/tpmc.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/utility/tpmc.c b/utility/tpmc.c index 2e1e5180..f5012eaf 100644 --- a/utility/tpmc.c +++ b/utility/tpmc.c @@ -65,10 +65,10 @@ char** args; /* Converts a string in the form 0x[0-9a-f]+ to a 32-bit value. Returns 0 for * success, non-zero for failure. */ -int HexStringToUint32(const char* string, uint32_t* value) { +static int HexStringToUint32(const char* string, uint32_t* value) { char tail[1]; /* strtoul is not as good because it overflows silently */ - char* format = strncmp(string, "0x", 2) ? "%8x%s" : "0x%8x%s"; + const char* format = strncmp(string, "0x", 2) ? "%8x%s" : "0x%8x%s"; int n = sscanf(string, format, value, tail); return n != 1; } @@ -76,7 +76,7 @@ int HexStringToUint32(const char* string, uint32_t* value) { /* Converts a string in the form [0-9a-f]+ to an 8-bit value. Returns 0 for * success, non-zero for failure. */ -int HexStringToUint8(const char* string, uint8_t* value) { +static int HexStringToUint8(const char* string, uint8_t* value) { char* end; uint32_t large_value = strtoul(string, &end, 16); if (*end != '\0' || large_value > 0xff) { @@ -86,7 +86,7 @@ int HexStringToUint8(const char* string, uint8_t* value) { return 0; } -int HexStringToArray(const char* string, uint8_t* value, int num_bytes) { +static int HexStringToArray(const char* string, uint8_t* value, int num_bytes) { int len = strlen(string); if (!strncmp(string, "0x", 2)) { string += 2; @@ -108,7 +108,7 @@ int HexStringToArray(const char* string, uint8_t* value, int num_bytes) { * found. Then returns min(result, OTHER_ERROR) since some error codes, such * as TPM_E_RETRY, do not fit in a byte. */ -uint8_t ErrorCheck(uint32_t result, const char* cmd) { +static uint8_t ErrorCheck(uint32_t result, const char* cmd) { uint8_t exit_code = result > OTHER_ERROR ? OTHER_ERROR : result; if (result == 0) { return 0; |