Fix unused variable diagnostics, make it a fatal error

This commit is contained in:
Jeff Epler 2022-09-30 08:20:33 -05:00
parent 37620d4eb0
commit afc1c0e3bb
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE
8 changed files with 7 additions and 18 deletions

View File

@ -198,7 +198,7 @@ else
endif endif
# Remove -Wno-stringop-overflow after we can test with CI's GCC 10. Mac's looks weird. # 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 DISABLE_WARNINGS = -Wno-stringop-overflow -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 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_CYW43) \
SRC_SDK := $(addprefix sdk/, $(SRC_SDK)) SRC_SDK := $(addprefix sdk/, $(SRC_SDK))
$(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 $(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 -Wno-unused-variable
SRC_C += \ SRC_C += \
boards/$(BOARD)/board.c \ boards/$(BOARD)/board.c \

View File

@ -259,10 +259,10 @@ STATIC mp_obj_t rp2pio_statemachine_make_new(const mp_obj_type_t *type, size_t n
bufinfo.buf, bufinfo.len / 2, bufinfo.buf, bufinfo.len / 2,
args[ARG_frequency].u_int, args[ARG_frequency].u_int,
init_bufinfo.buf, init_bufinfo.len / 2, init_bufinfo.buf, init_bufinfo.len / 2,
first_out_pin, args[ARG_out_pin_count].u_int, args[ARG_initial_out_pin_state].u_int, args[ARG_initial_out_pin_direction].u_int, first_out_pin, out_pin_count, args[ARG_initial_out_pin_state].u_int, args[ARG_initial_out_pin_direction].u_int,
first_in_pin, args[ARG_in_pin_count].u_int, args[ARG_pull_in_pin_up].u_int, args[ARG_pull_in_pin_down].u_int, first_in_pin, in_pin_count, args[ARG_pull_in_pin_up].u_int, args[ARG_pull_in_pin_down].u_int,
first_set_pin, args[ARG_set_pin_count].u_int, args[ARG_initial_set_pin_state].u_int, args[ARG_initial_set_pin_direction].u_int, first_set_pin, set_pin_count, args[ARG_initial_set_pin_state].u_int, args[ARG_initial_set_pin_direction].u_int,
first_sideset_pin, args[ARG_sideset_pin_count].u_int, args[ARG_initial_sideset_pin_state].u_int, args[ARG_initial_sideset_pin_direction].u_int, first_sideset_pin, sideset_pin_count, args[ARG_initial_sideset_pin_state].u_int, args[ARG_initial_sideset_pin_direction].u_int,
args[ARG_sideset_enable].u_bool, args[ARG_sideset_enable].u_bool,
jmp_pin, jmp_pin_pull, jmp_pin, jmp_pin_pull,
0, 0,
@ -397,7 +397,6 @@ STATIC mp_obj_t rp2pio_statemachine_write(size_t n_args, const mp_obj_t *pos_arg
return mp_const_none; return mp_const_none;
} }
uint8_t *original_pointer = bufinfo.buf;
int stride_in_bytes = mp_binary_get_size('@', bufinfo.typecode, NULL); int stride_in_bytes = mp_binary_get_size('@', bufinfo.typecode, NULL);
if (stride_in_bytes > 4) { if (stride_in_bytes > 4) {
mp_raise_ValueError(translate("Buffer elements must be 4 bytes long or less")); mp_raise_ValueError(translate("Buffer elements must be 4 bytes long or less"));
@ -606,7 +605,6 @@ STATIC mp_obj_t rp2pio_statemachine_readinto(size_t n_args, const mp_obj_t *pos_
return mp_const_none; return mp_const_none;
} }
uint8_t *original_pointer = bufinfo.buf;
int stride_in_bytes = mp_binary_get_size('@', bufinfo.typecode, NULL); int stride_in_bytes = mp_binary_get_size('@', bufinfo.typecode, NULL);
if (stride_in_bytes > 4) { if (stride_in_bytes > 4) {
mp_raise_ValueError(translate("Buffer elements must be 4 bytes long or less")); mp_raise_ValueError(translate("Buffer elements must be 4 bytes long or less"));

View File

@ -31,7 +31,6 @@ void common_hal_countio_counter_construct(countio_counter_obj_t *self,
mp_raise_RuntimeError(translate("PWM slice already in use")); mp_raise_RuntimeError(translate("PWM slice already in use"));
} }
uint8_t ab_channel = pwm_gpio_to_channel(self->pin);
if (!pwmio_claim_slice_ab_channels(self->slice_num)) { if (!pwmio_claim_slice_ab_channels(self->slice_num)) {
mp_raise_RuntimeError(translate("PWM slice channel A already in use")); mp_raise_RuntimeError(translate("PWM slice channel A already in use"));
} }

View File

@ -158,7 +158,6 @@ digitalinout_result_t common_hal_digitalio_digitalinout_set_drive_mode(
} }
} }
#endif #endif
const uint8_t pin = self->pin->number;
bool value = common_hal_digitalio_digitalinout_get_value(self); bool value = common_hal_digitalio_digitalinout_get_value(self);
self->open_drain = drive_mode == DRIVE_MODE_OPEN_DRAIN; self->open_drain = drive_mode == DRIVE_MODE_OPEN_DRAIN;
// True is implemented differently between modes so reset the value to make // True is implemented differently between modes so reset the value to make

View File

@ -120,11 +120,6 @@ void common_hal_imagecapture_parallelimagecapture_construct(imagecapture_paralle
true, 32, true, // in settings true, 32, true, // in settings
false, // Not user-interruptible. false, // Not user-interruptible.
2, 5); // wrap settings 2, 5); // wrap settings
PIO pio = self->state_machine.pio;
uint8_t pio_index = pio_get_index(pio);
uint sm = self->state_machine.state_machine;
} }
void common_hal_imagecapture_parallelimagecapture_deinit(imagecapture_parallelimagecapture_obj_t *self) { void common_hal_imagecapture_parallelimagecapture_deinit(imagecapture_parallelimagecapture_obj_t *self) {

View File

@ -871,7 +871,7 @@ bool common_hal_rp2pio_statemachine_get_txstall(rp2pio_statemachine_obj_t *self)
} }
void common_hal_rp2pio_statemachine_clear_txstall(rp2pio_statemachine_obj_t *self) { void common_hal_rp2pio_statemachine_clear_txstall(rp2pio_statemachine_obj_t *self) {
uint8_t level = pio_sm_get_rx_fifo_level(self->pio, self->state_machine); (void)pio_sm_get_rx_fifo_level(self->pio, self->state_machine);
uint32_t stall_mask = 1 << (PIO_FDEBUG_TXSTALL_LSB + self->state_machine); uint32_t stall_mask = 1 << (PIO_FDEBUG_TXSTALL_LSB + self->state_machine);
self->pio->fdebug = stall_mask; self->pio->fdebug = stall_mask;
} }

View File

@ -829,7 +829,6 @@ socketpool_socket_obj_t *common_hal_socketpool_socket_accept(socketpool_socket_o
bool common_hal_socketpool_socket_bind(socketpool_socket_obj_t *socket, bool common_hal_socketpool_socket_bind(socketpool_socket_obj_t *socket,
const char *host, size_t hostlen, uint32_t port) { const char *host, size_t hostlen, uint32_t port) {
uint8_t ip[NETUTILS_IPV4ADDR_BUFSIZE];
// get address // get address
ip_addr_t bind_addr; ip_addr_t bind_addr;

View File

@ -82,7 +82,6 @@ void wifi_reset(void) {
} }
// the cyw43 wifi chip is not reset due to https://github.com/raspberrypi/pico-sdk/issues/980 // the cyw43 wifi chip is not reset due to https://github.com/raspberrypi/pico-sdk/issues/980
common_hal_wifi_monitor_deinit(MP_STATE_VM(wifi_monitor_singleton)); common_hal_wifi_monitor_deinit(MP_STATE_VM(wifi_monitor_singleton));
wifi_radio_obj_t *radio = &common_hal_wifi_radio_obj;
common_hal_wifi_radio_obj.current_scan = NULL; common_hal_wifi_radio_obj.current_scan = NULL;
// common_hal_wifi_radio_set_enabled(radio, false); // common_hal_wifi_radio_set_enabled(radio, false);
supervisor_workflow_request_background(); supervisor_workflow_request_background();