diff options
author | Paul Selkirk <paul@psgd.org> | 2017-10-11 17:32:33 -0400 |
---|---|---|
committer | Paul Selkirk <paul@psgd.org> | 2017-10-11 17:36:00 -0400 |
commit | 4026cce22d330d3b9c4b218dd2e19d4f60412e05 (patch) | |
tree | 7f04989c6905f6b80b4d5d3cfe65a430f6b6ed2c | |
parent | c746ed393aff2a86a1f53e636d2530559be53d6f (diff) |
Cleanup: signed/unsigned mismatches, mostly in loop counters
-rw-r--r-- | libraries/libcli/Makefile | 1 | ||||
-rw-r--r-- | libraries/libhal/Makefile | 2 | ||||
-rw-r--r-- | libraries/libtfm/Makefile | 2 | ||||
-rw-r--r-- | libraries/mbed/Makefile | 2 | ||||
-rw-r--r-- | projects/cli-test/mgmt-cli.c | 6 | ||||
-rw-r--r-- | projects/cli-test/mgmt-keystore.c | 2 | ||||
-rw-r--r-- | projects/cli-test/test-fmc.c | 4 | ||||
-rw-r--r-- | projects/hsm/hsm.c | 2 | ||||
-rw-r--r-- | projects/hsm/mgmt-cli.c | 6 | ||||
-rw-r--r-- | projects/hsm/mgmt-keystore.c | 2 | ||||
-rw-r--r-- | projects/libhal-test/printf.c | 4 | ||||
-rw-r--r-- | stm-keystore.c | 2 |
12 files changed, 20 insertions, 15 deletions
diff --git a/libraries/libcli/Makefile b/libraries/libcli/Makefile index ec79b37..cd1d3b6 100644 --- a/libraries/libcli/Makefile +++ b/libraries/libcli/Makefile @@ -12,6 +12,7 @@ CFLAGS += \ -DDO_SOCKET=0 \ -DDO_TAB_COMPLETION=1 \ -DDO_TELNET=0 +CFLAGS += -Wno-unused-parameter all: libcli.a diff --git a/libraries/libhal/Makefile b/libraries/libhal/Makefile index bf870b9..72225e1 100644 --- a/libraries/libhal/Makefile +++ b/libraries/libhal/Makefile @@ -1,4 +1,6 @@ vpath %.c ${LIBHAL_SRC} vpath %.h ${LIBHAL_SRC} +CFLAGS += -Wno-missing-field-initializers -Wno-unused-parameter -Wno-sign-compare + include ${LIBHAL_SRC}/Makefile diff --git a/libraries/libtfm/Makefile b/libraries/libtfm/Makefile index ceb8541..57c76a5 100644 --- a/libraries/libtfm/Makefile +++ b/libraries/libtfm/Makefile @@ -36,7 +36,7 @@ CFLAGS := $(subst ${STM32_CFLAGS_OPTIMIZATION},${STM32_LIBTFM_CFLAGS_OPTIMIZATIO CFLAGS += -DTFM_ARM -Dasm=__asm__ -Wa,-mimplicit-it=thumb CFLAGS += -I${LIBTFM_SRC}/tomsfastmath/src/headers CFLAGS += -DFP_MAX_SIZE="(${BITS}*2+(8*DIGIT_BIT))" -CFLAGS += -Wall -W -Wshadow +CFLAGS += -Wall -W -Wshadow -Wno-uninitialized TARGETS := $(notdir ${HDR} ${LIB}) diff --git a/libraries/mbed/Makefile b/libraries/mbed/Makefile index 9d68e92..873359d 100644 --- a/libraries/mbed/Makefile +++ b/libraries/mbed/Makefile @@ -1,6 +1,8 @@ CC=arm-none-eabi-gcc AR=arm-none-eabi-ar +CFLAGS += -Wno-unused-parameter + ########################################### vpath %.c targets/cmsis/TARGET_STM/TARGET_STM32F4 targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_CRYPTECH_DEV_BRIDGE diff --git a/projects/cli-test/mgmt-cli.c b/projects/cli-test/mgmt-cli.c index eacb944..b3dbabf 100644 --- a/projects/cli-test/mgmt-cli.c +++ b/projects/cli-test/mgmt-cli.c @@ -58,8 +58,8 @@ #endif typedef struct { - int ridx; - volatile int widx; + unsigned ridx; + unsigned widx; mgmt_cli_dma_state_t rx_state; uint8_t buf[CLI_UART_RECVBUF_SIZE]; } ringbuf_t; @@ -109,7 +109,7 @@ static void uart_cli_print(struct cli_def *cli __attribute__ ((unused)), const c static ssize_t uart_cli_read(struct cli_def *cli __attribute__ ((unused)), void *buf, size_t count) { - for (int i = 0; i < count; ++i) { + for (size_t i = 0; i < count; ++i) { while (ringbuf_read_char(&uart_ringbuf, (uint8_t *)(buf + i)) == 0) { } } diff --git a/projects/cli-test/mgmt-keystore.c b/projects/cli-test/mgmt-keystore.c index 18447c8..bc2bc0c 100644 --- a/projects/cli-test/mgmt-keystore.c +++ b/projects/cli-test/mgmt-keystore.c @@ -263,7 +263,7 @@ static int show_keys(struct cli_def *cli, const char *title) if (!done) previous_uuid = uuids[sizeof(uuids)/sizeof(*uuids) - 1]; - for (int i = 0; i < n; i++) { + for (unsigned i = 0; i < n; i++) { if ((status = hal_uuid_format(&uuids[i], key_name, sizeof(key_name))) != LIBHAL_OK) { cli_print(cli, "Could not convert key name: %s", diff --git a/projects/cli-test/test-fmc.c b/projects/cli-test/test-fmc.c index b393dac..a1d6eea 100644 --- a/projects/cli-test/test-fmc.c +++ b/projects/cli-test/test-fmc.c @@ -105,7 +105,7 @@ int test_fpga_data_bus(struct cli_def *cli, uint32_t test_rounds) HAL_RNG_Init(&rng_inst); /* run some rounds of data bus test */ - for (c = 0; c < test_rounds; c++) { + for (c = 0; c < (int)test_rounds; c++) { data_diff = 0; /* try to generate "random" number */ hal_result = HAL_RNG_GenerateRandomNumber(&rng_inst, &rnd); @@ -163,7 +163,7 @@ int test_fpga_address_bus(struct cli_def *cli, uint32_t test_rounds) HAL_RNG_Init(&rng_inst); /* run some rounds of address bus test */ - for (c = 0; c < test_rounds; c++) { + for (c = 0; c < (int)test_rounds; c++) { addr_diff = 0; /* try to generate "random" number */ hal_result = HAL_RNG_GenerateRandomNumber(&rng_inst, &addr); diff --git a/projects/hsm/hsm.c b/projects/hsm/hsm.c index 800edcc..a36c64b 100644 --- a/projects/hsm/hsm.c +++ b/projects/hsm/hsm.c @@ -418,7 +418,7 @@ int main(void) /* Initialize the ibuf queues. */ memset(&ibuf_waiting, 0, sizeof(ibuf_waiting)); memset(&ibuf_ready, 0, sizeof(ibuf_ready)); - for (int i = 0; i < sizeof(ibufs)/sizeof(ibufs[0]); ++i) + for (size_t i = 0; i < sizeof(ibufs)/sizeof(ibufs[0]); ++i) ibuf_put(&ibuf_waiting, &ibufs[i]); /* Create the rpc dispatch worker tasks. */ diff --git a/projects/hsm/mgmt-cli.c b/projects/hsm/mgmt-cli.c index ec9bf8f..ab9cf44 100644 --- a/projects/hsm/mgmt-cli.c +++ b/projects/hsm/mgmt-cli.c @@ -64,8 +64,8 @@ static tcb_t *cli_task; #endif typedef struct { - int ridx; - volatile int widx; + unsigned ridx; + unsigned widx; mgmt_cli_dma_state_t rx_state; uint8_t buf[CLI_UART_RECVBUF_SIZE]; } ringbuf_t; @@ -116,7 +116,7 @@ static void uart_cli_print(struct cli_def *cli __attribute__ ((unused)), const c static ssize_t uart_cli_read(struct cli_def *cli __attribute__ ((unused)), void *buf, size_t count) { - for (int i = 0; i < count; ++i) { + for (size_t i = 0; i < count; ++i) { while (ringbuf_read_char(&uart_ringbuf, (uint8_t *)(buf + i)) == 0) task_sleep(); } diff --git a/projects/hsm/mgmt-keystore.c b/projects/hsm/mgmt-keystore.c index 0104265..9bd9dbf 100644 --- a/projects/hsm/mgmt-keystore.c +++ b/projects/hsm/mgmt-keystore.c @@ -205,7 +205,7 @@ static int show_keys(struct cli_def *cli, const char *title) if (!done) previous_uuid = uuids[sizeof(uuids)/sizeof(*uuids) - 1]; - for (int i = 0; i < n; i++) { + for (unsigned i = 0; i < n; i++) { if ((status = hal_uuid_format(&uuids[i], key_name, sizeof(key_name))) != LIBHAL_OK) { cli_print(cli, "Could not convert key name, skipping: %s", diff --git a/projects/libhal-test/printf.c b/projects/libhal-test/printf.c index 5a15d12..18feb8d 100644 --- a/projects/libhal-test/printf.c +++ b/projects/libhal-test/printf.c @@ -244,7 +244,7 @@ OK, I found my mistake. The math here is _always_ unsigned */ if (precision != 0)
{
width = max(width, precision);
- if (precision > strlen(where))
+ if (precision > strlen((const char *)where))
flags |= PR_LZ;
precision = 0;
}
@@ -295,7 +295,7 @@ EMIT2: if((flags & PR_LJ) == 0) count++;
}
/* emit string/char/converted number */
- for(int i = (flags & PR_WS) ? 1 : 0;
+ for(unsigned i = (flags & PR_WS) ? 1 : 0;
i < length; ++i)
{
fn(*where++, &ptr);
diff --git a/stm-keystore.c b/stm-keystore.c index 6bec008..2596373 100644 --- a/stm-keystore.c +++ b/stm-keystore.c @@ -99,7 +99,7 @@ int keystore_erase_bulk(void) int keystore_erase_subsectors(uint32_t start, uint32_t stop) { - for (int i = start; i <= stop; ++i) { + for (uint32_t i = start; i <= stop; ++i) { if (keystore_erase_subsector(i) != 1) return 0; } |