Skip to content

Enable & Address -Wtype-limits diagnostics in raspberrypi port #10187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ static uint8_t *_allocate_memory(safe_mode_t safe_mode, const char *env_key, siz
*final_size = default_size;
#if CIRCUITPY_OS_GETENV
if (safe_mode == SAFE_MODE_NONE) {
(void)common_hal_os_getenv_int(env_key, (mp_int_t *)final_size);
if (*final_size < 0) {
*final_size = default_size;
mp_int_t size;
if (common_hal_os_getenv_int(env_key, &size) == GETENV_OK && size > 0) {
*final_size = size;
}
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion ports/raspberrypi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ endif

DISABLE_WARNINGS = -Wno-cast-align

CFLAGS += $(INC) -Wall -Werror -std=gnu11 -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) $(DISABLE_WARNINGS) -Werror=missing-prototypes
CFLAGS += $(INC) -Wtype-limits -Wall -Werror -std=gnu11 -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) $(DISABLE_WARNINGS) -Werror=missing-prototypes
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this submodule has a harmless -Wtype-limits diagnostic that I didn't want to go through the trouble of fixing.


PICO_LDFLAGS = --specs=nosys.specs --specs=nano.specs

Expand Down
5 changes: 3 additions & 2 deletions ports/raspberrypi/common-hal/usb_host/Port.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,11 @@ usb_host_port_obj_t *common_hal_usb_host_port_construct(const mcu_pin_obj_t *dp,
}
pio_cfg.pio_tx_num = get_usb_pio();
pio_cfg.pio_rx_num = pio_cfg.pio_tx_num;
pio_cfg.tx_ch = dma_claim_unused_channel(false); // DMA channel
if (pio_cfg.tx_ch < 0) {
int dma_ch = dma_claim_unused_channel(false);
if (dma_ch < 0) {
mp_raise_RuntimeError(MP_ERROR_TEXT("All dma channels in use"));
}
pio_cfg.tx_ch = dma_ch;

self->base.type = &usb_host_port_type;
self->dp = dp;
Expand Down
2 changes: 1 addition & 1 deletion py/circuitpy_defns.mk
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ SRC_CIRCUITPY_COMMON = \

ifeq ($(CIRCUITPY_QRIO),1)
SRC_CIRCUITPY_COMMON += lib/quirc/lib/decode.c lib/quirc/lib/identify.c lib/quirc/lib/quirc.c lib/quirc/lib/version_db.c
$(BUILD)/lib/quirc/lib/%.o: CFLAGS += -Wno-shadow -Wno-sign-compare -include shared-module/qrio/quirc_alloc.h
$(BUILD)/lib/quirc/lib/%.o: CFLAGS += -Wno-type-limits -Wno-shadow -Wno-sign-compare -include shared-module/qrio/quirc_alloc.h
endif

ifdef LD_TEMPLATE_FILE
Expand Down
4 changes: 0 additions & 4 deletions shared-bindings/socketpool/SocketPool.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,6 @@ static mp_obj_t socketpool_socketpool_socket(size_t n_args, const mp_obj_t *pos_
socketpool_socketpool_sock_t type = args[ARG_type].u_int;
socketpool_socketpool_ipproto_t proto = args[ARG_proto].u_int;

if (proto < 0) {
proto = 0;
}

return common_hal_socketpool_socket(self, family, type, proto);
}
MP_DEFINE_CONST_FUN_OBJ_KW(socketpool_socketpool_socket_obj, 1, socketpool_socketpool_socket);
Expand Down
2 changes: 1 addition & 1 deletion supervisor/shared/serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ char serial_read(void) {

#if CIRCUITPY_WEB_WORKFLOW
if (websocket_available()) {
char c = websocket_read_char();
int c = websocket_read_char();
if (c != -1) {
return c;
}
Expand Down
Loading