Skip to content

Commit

Permalink
Merge pull request #5563 from jepler/enable-error-missing-prototypes
Browse files Browse the repository at this point in the history
Additional missing-prototypes fixes
  • Loading branch information
dhalbert authored Nov 11, 2021
2 parents a817a60 + cd6599c commit adac5ee
Show file tree
Hide file tree
Showing 143 changed files with 252 additions and 175 deletions.
1 change: 1 addition & 0 deletions devices/ble_hci/common-hal/_bleio/CharacteristicBuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

#include "shared-bindings/_bleio/__init__.h"
#include "shared-bindings/_bleio/Connection.h"
#include "shared-bindings/_bleio/CharacteristicBuffer.h"
#include "supervisor/shared/tick.h"
#include "common-hal/_bleio/CharacteristicBuffer.h"

Expand Down
1 change: 1 addition & 0 deletions devices/ble_hci/common-hal/_bleio/Connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,6 @@ typedef struct {
uint16_t bleio_connection_get_conn_handle(bleio_connection_obj_t *self);
mp_obj_t bleio_connection_new_from_internal(bleio_connection_internal_t *connection);
bleio_connection_internal_t *bleio_conn_handle_to_connection(uint16_t conn_handle);
void bleio_connection_clear(bleio_connection_internal_t *self);

#endif // MICROPY_INCLUDED_BLE_HCI_COMMON_HAL_CONNECTION_H
16 changes: 11 additions & 5 deletions devices/ble_hci/common-hal/_bleio/att.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
// Derived from ArduinoBLE.
// Copyright 2020 Dan Halbert for Adafruit Industries

// Some functions here are unused now, but may be used in the future.
// Don't warn or error about this, and depend on the compiler & linker to
// eliminate the associated code.
#pragma GCC diagnostic ignored "-Wunused"
#pragma GCC diagnostic ignored "-Wunused-function"

/*
This file is part of the ArduinoBLE library.
Copyright (c) 2018 Arduino SA. All rights reserved.
Expand Down Expand Up @@ -857,7 +863,7 @@ STATIC void process_find_info_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
}
}

int att_find_info_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint8_t response_buffer[]) {
static int att_find_info_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint8_t response_buffer[]) {
struct __packed req {
struct bt_att_hdr h;
struct bt_att_find_info_req r;
Expand Down Expand Up @@ -925,7 +931,7 @@ STATIC void process_find_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
}
}

void process_read_group_req(uint16_t conn_handle, uint16_t mtu, uint8_t dlen, uint8_t data[]) {
static void process_read_group_req(uint16_t conn_handle, uint16_t mtu, uint8_t dlen, uint8_t data[]) {
struct bt_att_read_group_req *req = (struct bt_att_read_group_req *)data;
uint16_t type_uuid = req->uuid[0] | (req->uuid[1] << 8);

Expand Down Expand Up @@ -1009,7 +1015,7 @@ void process_read_group_req(uint16_t conn_handle, uint16_t mtu, uint8_t dlen, ui
}
}

int att_read_group_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint16_t uuid, uint8_t response_buffer[]) {
static int att_read_group_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint16_t uuid, uint8_t response_buffer[]) {

typedef struct __packed {
struct bt_att_hdr h;
Expand Down Expand Up @@ -1305,7 +1311,7 @@ STATIC void process_read_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
}
}

int att_read_type_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint16_t type, uint8_t response_buffer[]) {
static int att_read_type_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint16_t type, uint8_t response_buffer[]) {
typedef struct __packed {
struct bt_att_hdr h;
struct bt_att_read_type_req r;
Expand Down Expand Up @@ -1715,7 +1721,7 @@ void att_process_data(uint16_t conn_handle, uint8_t dlen, uint8_t data[]) {
}

// FIX Do we need all of these?
void check_att_err(uint8_t err) {
static void check_att_err(uint8_t err) {
const compressed_string_t *msg = NULL;
switch (err) {
case 0:
Expand Down
6 changes: 4 additions & 2 deletions ports/atmel-samd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ $(BUILD)/asf4/$(CHIP_FAMILY)/hpl/sdhc/hpl_sdhc.o: CFLAGS += -Wno-cast-align -Wno
endif

SRC_ASF := $(addprefix asf4/$(CHIP_FAMILY)/, $(SRC_ASF))
$(patsubst $(SRC_ASF),%.c,%.o): CFLAGS += -Wno-missing-prototypes
$(patsubst %.c,$(BUILD)/%.o,$(SRC_ASF)): CFLAGS += -Wno-missing-prototypes

SRC_PERIPHERALS := \
peripherals/samd/$(PERIPHERALS_CHIP_FAMILY)/adc.c \
Expand All @@ -310,7 +310,7 @@ SRC_PERIPHERALS := \
peripherals/samd/sercom.c \
peripherals/samd/timers.c \

$(patsubst $(SRC_PERIPHERALS),%.c,%.o): CFLAGS += -Wno-missing-prototypes
$(patsubst %.c,$(BUILD)/%.o,$(SRC_PERIPHERALS)): CFLAGS += -Wno-missing-prototypes

SRC_C += \
audio_dma.c \
Expand All @@ -328,6 +328,8 @@ SRC_C += \
timer_handler.c \
$(SRC_PERIPHERALS) \

$(BUILD)/lib/tinyusb/src/portable/microchip/samd/dcd_samd.o: CFLAGS += -Wno-missing-prototypes

# This is an OR because it filters to any 1s and then checks to see if it is not
# empty.
ifneq (,$(filter 1,$(CIRCUITPY_PWMIO) $(CIRCUITPY_AUDIOIO) $(CIRCUITPY_RGBMATRIX)))
Expand Down
2 changes: 1 addition & 1 deletion ports/atmel-samd/boards/pewpew_m4/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ typedef struct {

#define DELAY 0x80

uint32_t lookupCfg(uint32_t key, uint32_t defl) {
STATIC uint32_t lookupCfg(uint32_t key, uint32_t defl) {
const uint32_t *ptr = UF2_BINFO->config_data;
if (!ptr || (((uint32_t)ptr) & 3) || *ptr != CFG_MAGIC0) {
// no config data!
Expand Down
1 change: 1 addition & 0 deletions ports/atmel-samd/common-hal/alarm/SleepMemory.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include "py/runtime.h"
#include "common-hal/alarm/SleepMemory.h"
#include "shared-bindings/alarm/SleepMemory.h"
#include "shared-bindings/nvm/ByteArray.h"

void alarm_sleep_memory_reset(void) {
Expand Down
3 changes: 0 additions & 3 deletions ports/atmel-samd/common-hal/audiobusio/PDMIn.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,3 @@ uint32_t common_hal_audiobusio_pdmin_record_to_buffer(audiobusio_pdmin_obj_t* se

return values_output;
}

void common_hal_audiobusio_pdmin_record_to_file(audiobusio_pdmin_obj_t* self, uint8_t* buffer, uint32_t length) {
}
1 change: 1 addition & 0 deletions ports/atmel-samd/common-hal/busio/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*/

#include "samd/sercom.h"
#include "common-hal/busio/__init__.h"

static bool never_reset_sercoms[SERCOM_INST_NUM];

Expand Down
2 changes: 1 addition & 1 deletion ports/atmel-samd/common-hal/canio/Listener.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ STATIC void install_extended_filter(CanMramXidfe *extended, int id1, int id2, in


#define NO_ID (-1)
void set_filters(canio_listener_obj_t *self, size_t nmatch, canio_match_obj_t **matches) {
STATIC void set_filters(canio_listener_obj_t *self, size_t nmatch, canio_match_obj_t **matches) {
int fifo = self->fifo_idx;

if (!nmatch) {
Expand Down
1 change: 1 addition & 0 deletions ports/atmel-samd/common-hal/countio/Counter.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

#include "common-hal/countio/Counter.h"
#include "shared-bindings/countio/Counter.h"

#include "atmel_start_pins.h"

Expand Down
1 change: 1 addition & 0 deletions ports/atmel-samd/common-hal/microcontroller/Processor.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@

#include "py/mphal.h"
#include "common-hal/microcontroller/Processor.h"
#include "shared-bindings/microcontroller/Processor.h"
#include "shared-bindings/microcontroller/ResetReason.h"

#include "samd/adc.h"
Expand Down
7 changes: 4 additions & 3 deletions ports/atmel-samd/common-hal/nvm/ByteArray.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*/

#include "common-hal/nvm/ByteArray.h"
#include "shared-bindings/nvm/ByteArray.h"

#include "hal_flash.h"

Expand All @@ -33,11 +34,11 @@
#include <stdint.h>
#include <string.h>

uint32_t common_hal_nvm_bytearray_get_length(nvm_bytearray_obj_t *self) {
uint32_t common_hal_nvm_bytearray_get_length(const nvm_bytearray_obj_t *self) {
return self->len;
}

bool common_hal_nvm_bytearray_set_bytes(nvm_bytearray_obj_t *self,
bool common_hal_nvm_bytearray_set_bytes(const nvm_bytearray_obj_t *self,
uint32_t start_index, uint8_t *values, uint32_t len) {
// We don't use features that use any advanced NVMCTRL features so we can fake the descriptor
// whenever we need it instead of storing it long term.
Expand All @@ -49,7 +50,7 @@ bool common_hal_nvm_bytearray_set_bytes(nvm_bytearray_obj_t *self,
}

// NVM memory is memory mapped so reading it is easy.
void common_hal_nvm_bytearray_get_bytes(nvm_bytearray_obj_t *self,
void common_hal_nvm_bytearray_get_bytes(const nvm_bytearray_obj_t *self,
uint32_t start_index, uint32_t len, uint8_t *values) {
memcpy(values, self->start_address + start_index, len);
}
4 changes: 3 additions & 1 deletion ports/atmel-samd/common-hal/os/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#include "py/objtuple.h"
#include "py/qstr.h"

#include "shared-bindings/os/__init__.h"

#ifdef SAM_D5X_E5X
#include "hal/include/hal_rand_sync.h"
#endif
Expand Down Expand Up @@ -66,7 +68,7 @@ mp_obj_t common_hal_os_uname(void) {
return (mp_obj_t)&os_uname_info_obj;
}

bool common_hal_os_urandom(uint8_t *buffer, uint32_t length) {
bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) {
#ifdef SAM_D5X_E5X
hri_mclk_set_APBCMASK_TRNG_bit(MCLK);
struct rand_sync_desc random;
Expand Down
6 changes: 1 addition & 5 deletions ports/atmel-samd/common-hal/ps2io/Ps2.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/

#include "common-hal/ps2io/Ps2.h"
#include "shared-bindings/ps2io/Ps2.h"

#include <stdint.h>

Expand Down Expand Up @@ -302,11 +303,6 @@ uint16_t common_hal_ps2io_ps2_get_len(ps2io_ps2_obj_t *self) {
return self->bufcount;
}

bool common_hal_ps2io_ps2_get_paused(ps2io_ps2_obj_t *self) {
uint32_t mask = 1 << self->channel;
return (EIC->INTENSET.reg & (mask << EIC_INTENSET_EXTINT_Pos)) == 0;
}

int16_t common_hal_ps2io_ps2_popleft(ps2io_ps2_obj_t *self) {
common_hal_mcu_disable_interrupts();
if (self->bufcount <= 0) {
Expand Down
2 changes: 1 addition & 1 deletion ports/atmel-samd/common-hal/pulseio/PulseOut.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static void turn_off(__IO PORT_PINCFG_Type *pincfg) {
pincfg->reg = PORT_PINCFG_RESETVALUE;
}

void pulse_finish(void) {
STATIC void pulse_finish(void) {
pulse_index++;

if (active_pincfg == NULL) {
Expand Down
2 changes: 1 addition & 1 deletion ports/atmel-samd/common-hal/pwmio/PWMOut.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ static uint8_t tcc_channel(const pin_timer_t *t) {
return t->wave_output % tcc_cc_num[t->index];
}

bool channel_ok(const pin_timer_t *t) {
STATIC bool channel_ok(const pin_timer_t *t) {
uint8_t channel_bit = 1 << tcc_channel(t);
return (!t->is_tc && ((tcc_channels[t->index] & channel_bit) == 0)) ||
t->is_tc;
Expand Down
1 change: 1 addition & 0 deletions ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*/

#include "common-hal/rotaryio/IncrementalEncoder.h"
#include "shared-bindings/rotaryio/IncrementalEncoder.h"
#include "shared-module/rotaryio/IncrementalEncoder.h"

#include "atmel_start_pins.h"
Expand Down
1 change: 1 addition & 0 deletions ports/atmel-samd/common-hal/rtc/RTC.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "py/runtime.h"
#include "shared/timeutils/timeutils.h"
#include "shared-bindings/rtc/__init__.h"
#include "shared-bindings/rtc/RTC.h"
#include "supervisor/port.h"
#include "supervisor/shared/translate.h"

Expand Down
2 changes: 1 addition & 1 deletion ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ mp_float_t common_hal_watchdog_get_timeout(watchdog_watchdogtimer_obj_t *self) {
return self->timeout;
}

void setup_wdt(watchdog_watchdogtimer_obj_t *self, int setting) {
STATIC void setup_wdt(watchdog_watchdogtimer_obj_t *self, int setting) {
OSC32KCTRL->OSCULP32K.bit.EN1K = 1; // Enable out 1K (for WDT)

// disable watchdog for config
Expand Down
8 changes: 2 additions & 6 deletions ports/atmel-samd/supervisor/internal_flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@ void port_internal_flash_flush(void) {
void supervisor_flash_release_cache(void) {
}

void flash_flush(void) {
supervisor_flash_flush();
}

static int32_t convert_block_to_flash_addr(uint32_t block) {
if (0 <= block && block < INTERNAL_FLASH_PART1_NUM_BLOCKS) {
// a block in partition 1
Expand All @@ -91,7 +87,7 @@ static int32_t convert_block_to_flash_addr(uint32_t block) {
return -1;
}

bool supervisor_flash_read_block(uint8_t *dest, uint32_t block) {
STATIC bool supervisor_flash_read_block(uint8_t *dest, uint32_t block) {
// non-MBR block, get data from flash memory
int32_t src = convert_block_to_flash_addr(block);
if (src == -1) {
Expand All @@ -102,7 +98,7 @@ bool supervisor_flash_read_block(uint8_t *dest, uint32_t block) {
return error_code == ERR_NONE;
}

bool supervisor_flash_write_block(const uint8_t *src, uint32_t block) {
STATIC bool supervisor_flash_write_block(const uint8_t *src, uint32_t block) {
// non-MBR block, copy to cache
int32_t dest = convert_block_to_flash_addr(block);
if (dest == -1) {
Expand Down
1 change: 1 addition & 0 deletions ports/atmel-samd/supervisor/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
#include "shared-bindings/rtc/__init__.h"
#include "shared_timers.h"
#include "reset.h"
#include "common-hal/pulseio/PulseIn.h"

#include "supervisor/background_callback.h"
#include "supervisor/shared/safe_mode.h"
Expand Down
2 changes: 1 addition & 1 deletion ports/espressif/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,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)
CFLAGS += $(INC) -Werror -Wall -std=gnu11 -Wl,--gc-sections $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT) -Werror=missing-prototypes

ifeq ($(IDF_TARGET_ARCH),xtensa)
CFLAGS += -mlongcalls
Expand Down
1 change: 1 addition & 0 deletions ports/espressif/background.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include "py/runtime.h"
#include "supervisor/filesystem.h"
#include "supervisor/port.h"
#include "supervisor/shared/stack.h"

#include "freertos/FreeRTOS.h"
Expand Down
10 changes: 1 addition & 9 deletions ports/espressif/bindings/espidf/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,7 @@ STATIC mp_obj_t espidf_erase_nvs(void) {
MP_DEFINE_CONST_FUN_OBJ_0(espidf_erase_nvs_obj, espidf_erase_nvs);


//| class IDFError(OSError):
//| """Raised for certain generic ESP IDF errors."""
//| ...
//|
NORETURN void mp_raise_espidf_IDFError(void) {
nlr_raise(mp_obj_new_exception(&mp_type_espidf_IDFError));
}

void espidf_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
STATIC void espidf_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
mp_print_kind_t k = kind & ~PRINT_EXC_SUBCLASS;
bool is_subclass = kind & PRINT_EXC_SUBCLASS;
if (!is_subclass && (k == PRINT_EXC)) {
Expand Down
4 changes: 1 addition & 3 deletions ports/espressif/boards/ai_thinker_esp32-c3s/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/

#include "shared-bindings/microcontroller/Pin.h"
#include "supervisor/board.h"

void board_init(void) {

Expand All @@ -51,6 +52,3 @@ bool board_requests_safe_mode(void) {

void reset_board(void) {
}

void board_deinit(void) {
}
3 changes: 3 additions & 0 deletions ports/espressif/boards/microdev_micro_c3/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*/

#include "shared-bindings/microcontroller/Pin.h"
#include "supervisor/board.h"

void board_init(void) {
// USB
Expand Down Expand Up @@ -54,5 +55,7 @@ bool board_requests_safe_mode(void) {
void reset_board(void) {
}

#if CIRCUITPY_ALARM
void board_deinit(void) {
}
#endif
6 changes: 3 additions & 3 deletions ports/espressif/cam.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ typedef struct {

static cam_obj_t *cam_obj = NULL;

void IRAM_ATTR cam_isr(void *arg) {
static void IRAM_ATTR cam_isr(void *arg) {
cam_event_t cam_event = {0};
BaseType_t HPTaskAwoken = pdFALSE;
typeof(I2S0.int_st) int_st = I2S0.int_st;
Expand All @@ -85,7 +85,7 @@ void IRAM_ATTR cam_isr(void *arg) {
}
}

void IRAM_ATTR cam_vsync_isr(void *arg) {
static void IRAM_ATTR cam_vsync_isr(void *arg) {
cam_event_t cam_event = {0};
BaseType_t HPTaskAwoken = pdFALSE;
/*!< filter */
Expand Down Expand Up @@ -392,7 +392,7 @@ void cam_give(uint8_t *buffer) {
}
}

void cam_dma_config(const cam_config_t *config) {
static void cam_dma_config(const cam_config_t *config) {
int cnt = 0;

if (config->mode.jpeg) {
Expand Down
Loading

0 comments on commit adac5ee

Please sign in to comment.