diff --git a/ports/raspberrypi/Makefile b/ports/raspberrypi/Makefile index 455672d617..55093eaeea 100644 --- a/ports/raspberrypi/Makefile +++ b/ports/raspberrypi/Makefile @@ -198,7 +198,7 @@ else endif # Remove -Wno-stringop-overflow after we can test with CI's GCC 10. Mac's looks weird. -DISABLE_WARNINGS = -Wno-stringop-overflow -Wno-unused-variable -Wno-strict-overflow -Wno-cast-align -Wno-strict-prototypes -Wno-nested-externs -Wno-double-promotion -Wno-sign-compare +DISABLE_WARNINGS = -Wno-stringop-overflow -Wno-unused-variable -Wno-strict-overflow -Wno-cast-align CFLAGS += $(INC) -Wall -Werror -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) $(DISABLE_WARNINGS) -Werror=missing-prototypes @@ -256,7 +256,7 @@ SRC_SDK := \ $(SRC_SDK_CYW43) \ SRC_SDK := $(addprefix sdk/, $(SRC_SDK)) -$(patsubst %.c,$(BUILD)/%.o,$(SRC_SDK) $(SRC_CYW43)): CFLAGS += -Wno-missing-prototypes -Wno-undef -Wno-unused-function +$(patsubst %.c,$(BUILD)/%.o,$(SRC_SDK) $(SRC_CYW43)): CFLAGS += -Wno-missing-prototypes -Wno-undef -Wno-unused-function -Wno-nested-externs -Wno-strict-prototypes -Wno-double-promotion -Wno-sign-compare SRC_C += \ boards/$(BOARD)/board.c \ diff --git a/ports/raspberrypi/common-hal/busio/I2C.c b/ports/raspberrypi/common-hal/busio/I2C.c index 6b15bee512..c68499591c 100644 --- a/ports/raspberrypi/common-hal/busio/I2C.c +++ b/ports/raspberrypi/common-hal/busio/I2C.c @@ -190,7 +190,7 @@ STATIC uint8_t _common_hal_busio_i2c_write(busio_i2c_obj_t *self, uint16_t addr, return status; } - int result = i2c_write_timeout_us(self->peripheral, addr, data, len, !transmit_stop_bit, BUS_TIMEOUT_US); + size_t result = i2c_write_timeout_us(self->peripheral, addr, data, len, !transmit_stop_bit, BUS_TIMEOUT_US); if (result == len) { return 0; } @@ -211,7 +211,7 @@ uint8_t common_hal_busio_i2c_write(busio_i2c_obj_t *self, uint16_t addr, uint8_t common_hal_busio_i2c_read(busio_i2c_obj_t *self, uint16_t addr, uint8_t *data, size_t len) { - int result = i2c_read_timeout_us(self->peripheral, addr, data, len, false, BUS_TIMEOUT_US); + size_t result = i2c_read_timeout_us(self->peripheral, addr, data, len, false, BUS_TIMEOUT_US); if (result == len) { return 0; } diff --git a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c index 78703351d7..d24e9b2b7c 100644 --- a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c +++ b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c @@ -71,7 +71,7 @@ STATIC void *_interrupt_arg[NUM_PIOS][NUM_PIO_STATE_MACHINES]; STATIC void rp2pio_statemachine_interrupt_handler(void); static void rp2pio_statemachine_set_pull(uint32_t pull_pin_up, uint32_t pull_pin_down, uint32_t pins_we_use) { - for (int i = 0; i < TOTAL_GPIO_COUNT; i++) { + for (size_t i = 0; i < TOTAL_GPIO_COUNT; i++) { bool used = pins_we_use & (1 << i); if (used) { bool pull_up = pull_pin_up & (1 << i); @@ -231,7 +231,7 @@ bool rp2pio_statemachine_construct(rp2pio_statemachine_obj_t *self, program_offset = 32; } - int state_machine = -1; + size_t state_machine = NUM_PIO_STATE_MACHINES; if (pio_index < NUM_PIOS) { PIO pio = pio_instances[pio_index]; for (size_t i = 0; i < NUM_PIOS; i++) { diff --git a/ports/raspberrypi/common-hal/rp2pio/__init__.c b/ports/raspberrypi/common-hal/rp2pio/__init__.c index 8b8101fbe5..61a77e021c 100644 --- a/ports/raspberrypi/common-hal/rp2pio/__init__.c +++ b/ports/raspberrypi/common-hal/rp2pio/__init__.c @@ -33,7 +33,7 @@ bool common_hal_rp2pio_pins_are_sequential(size_t len, mp_obj_t *items) { return true; } const mcu_pin_obj_t *last_pin = validate_obj_is_pin(items[0]); - for (int i = 1; i < len; i++) { + for (size_t i = 1; i < len; i++) { const mcu_pin_obj_t *pin = validate_obj_is_pin(items[i]); if (pin->number != last_pin->number + 1) { return false; diff --git a/ports/raspberrypi/common-hal/socketpool/Socket.c b/ports/raspberrypi/common-hal/socketpool/Socket.c index fb777a3f04..6ea2dc2c3c 100644 --- a/ports/raspberrypi/common-hal/socketpool/Socket.c +++ b/ports/raspberrypi/common-hal/socketpool/Socket.c @@ -409,7 +409,7 @@ STATIC mp_uint_t lwip_raw_udp_receive(socketpool_socket_obj_t *socket, byte *buf // Wait for data to arrive on UDP socket. mp_uint_t start = mp_hal_ticks_ms(); while (socket->incoming.pbuf == NULL) { - if (socket->timeout != -1 && mp_hal_ticks_ms() - start > socket->timeout) { + if (socket->timeout != (unsigned)-1 && mp_hal_ticks_ms() - start > socket->timeout) { *_errno = MP_ETIMEDOUT; return -1; } @@ -479,7 +479,7 @@ STATIC mp_uint_t lwip_tcp_send(socketpool_socket_obj_t *socket, const byte *buf, // Avoid sending too small packets, so wait until at least 16 bytes available while (socket->state >= STATE_CONNECTED && (available = tcp_sndbuf(socket->pcb.tcp)) < 16) { MICROPY_PY_LWIP_EXIT - if (socket->timeout != -1 && mp_hal_ticks_ms() - start > socket->timeout) { + if (socket->timeout != (unsigned)-1 && mp_hal_ticks_ms() - start > socket->timeout) { *_errno = MP_ETIMEDOUT; return MP_STREAM_ERROR; } @@ -546,7 +546,7 @@ STATIC mp_uint_t lwip_tcp_receive(socketpool_socket_obj_t *socket, byte *buf, mp mp_uint_t start = mp_hal_ticks_ms(); while (socket->state == STATE_CONNECTED && socket->incoming.pbuf == NULL) { - if (socket->timeout != -1 && mp_hal_ticks_ms() - start > socket->timeout) { + if (socket->timeout != (unsigned)-1 && mp_hal_ticks_ms() - start > socket->timeout) { *_errno = MP_ETIMEDOUT; return -1; } @@ -778,7 +778,7 @@ socketpool_socket_obj_t *common_hal_socketpool_socket_accept(socketpool_socket_o MICROPY_PY_LWIP_EXIT m_del_obj(socketpool_socket_obj_t, socket2); mp_raise_OSError(MP_EAGAIN); - } else if (socket->timeout != -1) { + } else if (socket->timeout != (unsigned)-1) { mp_uint_t retries = socket->timeout / 100; while (*incoming_connection == NULL) { MICROPY_PY_LWIP_EXIT @@ -952,7 +952,7 @@ void common_hal_socketpool_socket_connect(socketpool_socket_obj_t *socket, MICROPY_PY_LWIP_EXIT // And now we wait... - if (socket->timeout != -1) { + if (socket->timeout != (unsigned)-1) { for (mp_uint_t retries = socket->timeout / 100; retries--;) { mp_hal_delay_ms(100); if (socket->state != STATE_CONNECTING) { @@ -1048,7 +1048,7 @@ mp_uint_t common_hal_socketpool_socket_recvfrom_into(socketpool_socket_obj_t *so ret = lwip_raw_udp_receive(socket, (byte *)buf, len, ip, port, &_errno); break; } - if (ret == -1) { + if (ret == (unsigned)-1) { mp_raise_OSError(_errno); } @@ -1097,7 +1097,7 @@ int socketpool_socket_send(socketpool_socket_obj_t *socket, const uint8_t *buf, ret = lwip_raw_udp_send(socket, buf, len, NULL, 0, &_errno); break; } - if (ret == -1) { + if (ret == (unsigned)-1) { return -_errno; } return ret; @@ -1134,7 +1134,7 @@ mp_uint_t common_hal_socketpool_socket_sendto(socketpool_socket_obj_t *socket, ret = lwip_raw_udp_send(socket, buf, len, &ip, port, &_errno); break; } - if (ret == -1) { + if (ret == (unsigned)-1) { mp_raise_OSError(_errno); } diff --git a/ports/raspberrypi/common-hal/wifi/ScannedNetworks.c b/ports/raspberrypi/common-hal/wifi/ScannedNetworks.c index 3488fc0eb5..97299e2f74 100644 --- a/ports/raspberrypi/common-hal/wifi/ScannedNetworks.c +++ b/ports/raspberrypi/common-hal/wifi/ScannedNetworks.c @@ -52,7 +52,7 @@ static void scan_result_put(const cyw43_ev_scan_result_t *result) { } } -static bool scan_result_available() { +static bool scan_result_available(void) { return scan_full || (scan_get != scan_put); } @@ -83,7 +83,7 @@ static int scan_result(void *env, const cyw43_ev_scan_result_t *result) { mp_obj_t common_hal_wifi_scannednetworks_next(wifi_scannednetworks_obj_t *self) { // no results available, wait for some - while (!scan_result_available(self) && cyw43_wifi_scan_active(&cyw43_state)) { + while (!scan_result_available() && cyw43_wifi_scan_active(&cyw43_state)) { RUN_BACKGROUND_TASKS; if (mp_hal_is_interrupted()) { return mp_const_none; @@ -91,7 +91,7 @@ mp_obj_t common_hal_wifi_scannednetworks_next(wifi_scannednetworks_obj_t *self) cyw43_arch_poll(); } - if (!scan_result_available(self)) { + if (!scan_result_available()) { common_hal_wifi_radio_obj.current_scan = NULL; return mp_const_none; }