Enable -Werror=old-style-definition against more ports

This commit is contained in:
Jeff Epler 2025-05-27 07:58:07 +02:00
parent 837cfa0d2c
commit 5cbecaeda8
23 changed files with 30 additions and 30 deletions

View file

@ -95,7 +95,7 @@ else
endif
CFLAGS += $(INC) -Wall -Werror -std=gnu11 $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) $(DISABLE_WARNINGS)
CFLAGS += $(INC) -Wall -Werror -std=gnu11 $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) $(DISABLE_WARNINGS) -Werror=old-style-definition
$(BUILD)/lib/tlsf/tlsf.o: CFLAGS += -Wno-cast-align

View file

@ -44,7 +44,7 @@ static const image_size_t isx019_image_size_table[] = {
{ VIDEO_HSIZE_QUADVGA, VIDEO_VSIZE_QUADVGA },
};
static const char *get_imgsensor_name() {
static const char *get_imgsensor_name(void) {
static struct v4l2_capability cap;
ioctl(camera_dev.fd, VIDIOC_QUERYCAP, (unsigned long)&cap);
@ -113,7 +113,7 @@ static void camera_start_streaming(enum v4l2_buf_type type) {
ioctl(camera_dev.fd, VIDIOC_STREAMON, (unsigned long)&type);
}
static void camera_start_preview() {
static void camera_start_preview(void) {
camera_set_format(V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_PIX_FMT_UYVY, VIDEO_HSIZE_QVGA, VIDEO_VSIZE_QVGA);
v4l2_buffer_t buf;

View file

@ -191,7 +191,7 @@ endif
# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk
CFLAGS += $(OPTIMIZATION_FLAGS)
CFLAGS += $(INC) -Werror -Wall -std=gnu11 -Wl,--gc-sections $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT) -Werror=missing-prototypes
CFLAGS += $(INC) -Werror -Wall -std=gnu11 -Wl,--gc-sections $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT) -Werror=missing-prototypes -Werror=old-style-definition
# Most current ESPs have nano versions of newlib in ROM so we use them.
ifneq ($(IDF_TARGET),esp32c6)

View file

@ -31,7 +31,7 @@ static uint64_t _timeout_start_time;
background_callback_t bleio_background_callback;
void bleio_user_reset() {
void bleio_user_reset(void) {
// Stop any user scanning or advertising.
common_hal_bleio_adapter_stop_scan(&common_hal_bleio_adapter_obj);
common_hal_bleio_adapter_stop_advertising(&common_hal_bleio_adapter_obj);
@ -43,7 +43,7 @@ void bleio_user_reset() {
}
// Turn off BLE on a reset or reload.
void bleio_reset() {
void bleio_reset(void) {
// Set this explicitly to save data.
if (!common_hal_bleio_adapter_get_enabled(&common_hal_bleio_adapter_obj)) {
return;

View file

@ -245,7 +245,7 @@ void common_hal_sdioio_sdcard_never_reset(sdioio_sdcard_obj_t *self) {
}
}
void sdioio_reset() {
void sdioio_reset(void) {
for (size_t i = 0; i < MP_ARRAY_SIZE(slot_in_use); i++) {
if (!never_reset_sdio[i]) {
slot_in_use[i] = false;

View file

@ -461,11 +461,11 @@ void port_disable_tick(void) {
esp_timer_stop(_tick_timer);
}
void port_wake_main_task() {
void port_wake_main_task(void) {
xTaskNotifyGive(circuitpython_task);
}
void port_wake_main_task_from_isr() {
void port_wake_main_task_from_isr(void) {
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
vTaskNotifyGiveFromISR(circuitpython_task, &xHigherPriorityTaskWoken);
if (xHigherPriorityTaskWoken == pdTRUE) {
@ -473,7 +473,7 @@ void port_wake_main_task_from_isr() {
}
}
void port_yield() {
void port_yield(void) {
vTaskDelay(4);
}

View file

@ -38,7 +38,7 @@ endif
# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk
CFLAGS += $(OPTIMIZATION_FLAGS)
CFLAGS += $(INC) -Werror -Wall -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT) -Werror=missing-prototypes
CFLAGS += $(INC) -Werror -Wall -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT) -Werror=missing-prototypes -Werror=old-style-definition
# TODO: check this
CFLAGS += -D__START=main -DFOMU

View file

@ -45,7 +45,7 @@ ifeq ($(DEBUG), 1)
CFLAGS += -fno-ipa-sra
endif
CFLAGS += $(INC) -ggdb -Wall -Werror -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) -Werror=missing-prototypes
CFLAGS += $(INC) -ggdb -Wall -Werror -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) -Werror=missing-prototypes -Werror=old-style-definition
# TODO: add these when -Werror is applied
# Disable some warnings, as do most ports. NXP SDK causes undef, tinyusb causes cast-align

View file

@ -439,6 +439,6 @@ void port_i2s_resume(i2s_t *self) {
self->paused = false;
}
void i2s_reset() {
void i2s_reset(void) {
// this port relies on object finalizers for reset
}

View file

@ -47,7 +47,7 @@ endif
# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk
CFLAGS += $(OPTIMIZATION_FLAGS)
CFLAGS += $(INC) -Wall -Werror -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) -Werror=missing-prototypes
CFLAGS += $(INC) -Wall -Werror -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) -Werror=missing-prototypes -Werror=old-style-definition
# Nordic Softdevice SDK header files contains inline assembler that has
# broken constraints. As a result the IPA-modref pass, introduced in gcc-11,

View file

@ -80,7 +80,7 @@ void check_sec_status(uint8_t sec_status) {
void common_hal_bleio_init(void) {
}
void bleio_user_reset() {
void bleio_user_reset(void) {
if (common_hal_bleio_adapter_get_enabled(&common_hal_bleio_adapter_obj)) {
// Stop any user scanning or advertising.
common_hal_bleio_adapter_stop_scan(&common_hal_bleio_adapter_obj);
@ -94,7 +94,7 @@ void bleio_user_reset() {
}
// Turn off BLE on a reset or reload.
void bleio_reset() {
void bleio_reset(void) {
// Set this explicitly to save data.
common_hal_bleio_adapter_obj.base.type = &bleio_adapter_type;
if (!common_hal_bleio_adapter_get_enabled(&common_hal_bleio_adapter_obj)) {

View file

@ -136,7 +136,7 @@ static void audiopwmout_background_obj(audiopwmio_pwmaudioout_obj_t *self) {
}
}
void audiopwmout_background() {
void audiopwmout_background(void) {
// Check the NVIC first because it is part of the CPU and fast to read.
if (!NVIC_GetPendingIRQ(PWM0_IRQn) &&
!NVIC_GetPendingIRQ(PWM1_IRQn) &&

View file

@ -35,7 +35,7 @@ void common_hal_mcu_delay_us(uint32_t delay) {
static volatile uint32_t nesting_count = 0;
static uint8_t is_nested_critical_region;
void common_hal_mcu_disable_interrupts() {
void common_hal_mcu_disable_interrupts(void) {
if (nesting_count == 0) {
// Unlike __disable_irq(), this should only be called the first time
// "is_nested_critical_region" is sd's equivalent of our nesting count
@ -51,7 +51,7 @@ void common_hal_mcu_disable_interrupts() {
nesting_count++;
}
void common_hal_mcu_enable_interrupts() {
void common_hal_mcu_enable_interrupts(void) {
if (nesting_count == 0) {
// This is very very bad because it means there was mismatched disable/enables.
reset_into_safe_mode(SAFE_MODE_INTERRUPT_ERROR);

View file

@ -21,7 +21,7 @@ INC += \
CFLAGS += -ggdb3 -Os
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) -Wall -Werror -std=gnu11 -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) $(DISABLE_WARNINGS) -Werror=missing-prototypes -Werror=old-style-definition
CFLAGS += \
-march=armv6-m \

View file

@ -210,7 +210,7 @@ __attribute__((used)) void HardFault_Handler(void) {
}
}
void port_yield() {
void port_yield(void) {
}
void port_boot_info(void) {

View file

@ -75,7 +75,7 @@ static mp_obj_t sensor_init(mp_obj_t i2c_in) {
return mp_const_true;
}
static mp_obj_t sensor_deinit() {
static mp_obj_t sensor_deinit(void) {
sl_sensor_hall_deinit();
sl_sensor_lux_deinit();

View file

@ -156,7 +156,7 @@ bool common_hal_bleio_characteristic_buffer_connected(
common_hal_bleio_connection_get_connected(self->characteristic->service->connection)));
}
void reset_characteristic_buffer_list() {
void reset_characteristic_buffer_list(void) {
// Remove characteristic_buffer list
memset(bleio_characteristic_buffer_list.data, 0,
sizeof(bleio_characteristic_buffer_list.data));

View file

@ -391,7 +391,7 @@ void common_hal_bleio_packet_buffer_deinit(bleio_packet_buffer_obj_t *self) {
}
// Remove packet_buffer list when reload
void reset_packet_buffer_list() {
void reset_packet_buffer_list(void) {
// Remove packet_buffer list
memset(bleio_packet_buffer_list.data, 0,
sizeof(bleio_packet_buffer_list.data));

View file

@ -230,7 +230,7 @@ void common_hal_bleio_service_add_characteristic(bleio_service_obj_t *self,
}
// Remove dynamic service when reload
void reset_dynamic_service() {
void reset_dynamic_service(void) {
uint16_t gattdb_session;
uint8_t svc_index;

View file

@ -54,7 +54,7 @@ const osMutexAttr_t bluetooth_connection_mutex_attr = {
void common_hal_bleio_init(void) {
}
void bleio_user_reset() {
void bleio_user_reset(void) {
// Stop any user scanning or advertising.
common_hal_bleio_adapter_stop_scan(&common_hal_bleio_adapter_obj);
common_hal_bleio_adapter_stop_advertising(&common_hal_bleio_adapter_obj);
@ -63,7 +63,7 @@ void bleio_user_reset() {
supervisor_bluetooth_background();
}
void bleio_reset() {
void bleio_reset(void) {
reset_dynamic_service();
reset_packet_buffer_list();
reset_characteristic_buffer_list();

View file

@ -51,7 +51,7 @@ CFLAGS += -ftree-vrp
# STM32 MCU series must be defined. See supervisor/linker.h
C_DEFS = -D$(MCU_PACKAGE) -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -D$(MCU_VARIANT) -DSTM32$(MCU_SERIES)
CFLAGS += $(INC) -Werror -Wall -std=gnu11 -fshort-enums $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT) -nostdlib -nostartfiles
CFLAGS += $(INC) -Werror -Wall -std=gnu11 -fshort-enums $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT) -nostdlib -nostartfiles -Werror=old-style-definition
# Undo some warnings.
# STM32 HAL uses undefined preprocessor variables, shadowed variables, casts that change alignment reqs

View file

@ -338,7 +338,7 @@ void common_hal_sdioio_sdcard_never_reset(sdioio_sdcard_obj_t *self) {
}
}
void sdioio_reset() {
void sdioio_reset(void) {
for (size_t i = 0; i < MP_ARRAY_SIZE(reserved_sdio); i++) {
if (!never_reset_sdio[i]) {
reserved_sdio[i] = false;

View file

@ -285,7 +285,7 @@ void HAL_Delay(uint32_t delay_ms) {
}
}
uint32_t HAL_GetTick() {
uint32_t HAL_GetTick(void) {
if (SysTick->CTRL != 0) {
return systick_ms;
} else {