Skip to content

Commit adac5ee

Browse files
authored
Merge pull request #5563 from jepler/enable-error-missing-prototypes
Additional missing-prototypes fixes
2 parents a817a60 + cd6599c commit adac5ee

File tree

143 files changed

+252
-175
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+252
-175
lines changed

devices/ble_hci/common-hal/_bleio/CharacteristicBuffer.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
#include "shared-bindings/_bleio/__init__.h"
3535
#include "shared-bindings/_bleio/Connection.h"
36+
#include "shared-bindings/_bleio/CharacteristicBuffer.h"
3637
#include "supervisor/shared/tick.h"
3738
#include "common-hal/_bleio/CharacteristicBuffer.h"
3839

devices/ble_hci/common-hal/_bleio/Connection.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,6 @@ typedef struct {
8585
uint16_t bleio_connection_get_conn_handle(bleio_connection_obj_t *self);
8686
mp_obj_t bleio_connection_new_from_internal(bleio_connection_internal_t *connection);
8787
bleio_connection_internal_t *bleio_conn_handle_to_connection(uint16_t conn_handle);
88+
void bleio_connection_clear(bleio_connection_internal_t *self);
8889

8990
#endif // MICROPY_INCLUDED_BLE_HCI_COMMON_HAL_CONNECTION_H

devices/ble_hci/common-hal/_bleio/att.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
// Derived from ArduinoBLE.
22
// Copyright 2020 Dan Halbert for Adafruit Industries
33

4+
// Some functions here are unused now, but may be used in the future.
5+
// Don't warn or error about this, and depend on the compiler & linker to
6+
// eliminate the associated code.
7+
#pragma GCC diagnostic ignored "-Wunused"
8+
#pragma GCC diagnostic ignored "-Wunused-function"
9+
410
/*
511
This file is part of the ArduinoBLE library.
612
Copyright (c) 2018 Arduino SA. All rights reserved.
@@ -857,7 +863,7 @@ STATIC void process_find_info_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
857863
}
858864
}
859865

860-
int att_find_info_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint8_t response_buffer[]) {
866+
static int att_find_info_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint8_t response_buffer[]) {
861867
struct __packed req {
862868
struct bt_att_hdr h;
863869
struct bt_att_find_info_req r;
@@ -925,7 +931,7 @@ STATIC void process_find_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
925931
}
926932
}
927933

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

@@ -1009,7 +1015,7 @@ void process_read_group_req(uint16_t conn_handle, uint16_t mtu, uint8_t dlen, ui
10091015
}
10101016
}
10111017

1012-
int att_read_group_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint16_t uuid, uint8_t response_buffer[]) {
1018+
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[]) {
10131019

10141020
typedef struct __packed {
10151021
struct bt_att_hdr h;
@@ -1305,7 +1311,7 @@ STATIC void process_read_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
13051311
}
13061312
}
13071313

1308-
int att_read_type_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle, uint16_t type, uint8_t response_buffer[]) {
1314+
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[]) {
13091315
typedef struct __packed {
13101316
struct bt_att_hdr h;
13111317
struct bt_att_read_type_req r;
@@ -1715,7 +1721,7 @@ void att_process_data(uint16_t conn_handle, uint8_t dlen, uint8_t data[]) {
17151721
}
17161722

17171723
// FIX Do we need all of these?
1718-
void check_att_err(uint8_t err) {
1724+
static void check_att_err(uint8_t err) {
17191725
const compressed_string_t *msg = NULL;
17201726
switch (err) {
17211727
case 0:

ports/atmel-samd/Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ $(BUILD)/asf4/$(CHIP_FAMILY)/hpl/sdhc/hpl_sdhc.o: CFLAGS += -Wno-cast-align -Wno
291291
endif
292292

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

296296
SRC_PERIPHERALS := \
297297
peripherals/samd/$(PERIPHERALS_CHIP_FAMILY)/adc.c \
@@ -310,7 +310,7 @@ SRC_PERIPHERALS := \
310310
peripherals/samd/sercom.c \
311311
peripherals/samd/timers.c \
312312

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

315315
SRC_C += \
316316
audio_dma.c \
@@ -328,6 +328,8 @@ SRC_C += \
328328
timer_handler.c \
329329
$(SRC_PERIPHERALS) \
330330

331+
$(BUILD)/lib/tinyusb/src/portable/microchip/samd/dcd_samd.o: CFLAGS += -Wno-missing-prototypes
332+
331333
# This is an OR because it filters to any 1s and then checks to see if it is not
332334
# empty.
333335
ifneq (,$(filter 1,$(CIRCUITPY_PWMIO) $(CIRCUITPY_AUDIOIO) $(CIRCUITPY_RGBMATRIX)))

ports/atmel-samd/boards/pewpew_m4/board.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ typedef struct {
5050

5151
#define DELAY 0x80
5252

53-
uint32_t lookupCfg(uint32_t key, uint32_t defl) {
53+
STATIC uint32_t lookupCfg(uint32_t key, uint32_t defl) {
5454
const uint32_t *ptr = UF2_BINFO->config_data;
5555
if (!ptr || (((uint32_t)ptr) & 3) || *ptr != CFG_MAGIC0) {
5656
// no config data!

ports/atmel-samd/common-hal/alarm/SleepMemory.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
#include "py/runtime.h"
3030
#include "common-hal/alarm/SleepMemory.h"
31+
#include "shared-bindings/alarm/SleepMemory.h"
3132
#include "shared-bindings/nvm/ByteArray.h"
3233

3334
void alarm_sleep_memory_reset(void) {

ports/atmel-samd/common-hal/audiobusio/PDMIn.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,3 @@ uint32_t common_hal_audiobusio_pdmin_record_to_buffer(audiobusio_pdmin_obj_t* se
485485

486486
return values_output;
487487
}
488-
489-
void common_hal_audiobusio_pdmin_record_to_file(audiobusio_pdmin_obj_t* self, uint8_t* buffer, uint32_t length) {
490-
}

ports/atmel-samd/common-hal/busio/__init__.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
*/
2626

2727
#include "samd/sercom.h"
28+
#include "common-hal/busio/__init__.h"
2829

2930
static bool never_reset_sercoms[SERCOM_INST_NUM];
3031

ports/atmel-samd/common-hal/canio/Listener.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ STATIC void install_extended_filter(CanMramXidfe *extended, int id1, int id2, in
195195

196196

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

201201
if (!nmatch) {

ports/atmel-samd/common-hal/countio/Counter.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

22
#include "common-hal/countio/Counter.h"
3+
#include "shared-bindings/countio/Counter.h"
34

45
#include "atmel_start_pins.h"
56

ports/atmel-samd/common-hal/microcontroller/Processor.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565

6666
#include "py/mphal.h"
6767
#include "common-hal/microcontroller/Processor.h"
68+
#include "shared-bindings/microcontroller/Processor.h"
6869
#include "shared-bindings/microcontroller/ResetReason.h"
6970

7071
#include "samd/adc.h"

ports/atmel-samd/common-hal/nvm/ByteArray.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
*/
2626

2727
#include "common-hal/nvm/ByteArray.h"
28+
#include "shared-bindings/nvm/ByteArray.h"
2829

2930
#include "hal_flash.h"
3031

@@ -33,11 +34,11 @@
3334
#include <stdint.h>
3435
#include <string.h>
3536

36-
uint32_t common_hal_nvm_bytearray_get_length(nvm_bytearray_obj_t *self) {
37+
uint32_t common_hal_nvm_bytearray_get_length(const nvm_bytearray_obj_t *self) {
3738
return self->len;
3839
}
3940

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

5152
// NVM memory is memory mapped so reading it is easy.
52-
void common_hal_nvm_bytearray_get_bytes(nvm_bytearray_obj_t *self,
53+
void common_hal_nvm_bytearray_get_bytes(const nvm_bytearray_obj_t *self,
5354
uint32_t start_index, uint32_t len, uint8_t *values) {
5455
memcpy(values, self->start_address + start_index, len);
5556
}

ports/atmel-samd/common-hal/os/__init__.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
#include "py/objtuple.h"
3131
#include "py/qstr.h"
3232

33+
#include "shared-bindings/os/__init__.h"
34+
3335
#ifdef SAM_D5X_E5X
3436
#include "hal/include/hal_rand_sync.h"
3537
#endif
@@ -66,7 +68,7 @@ mp_obj_t common_hal_os_uname(void) {
6668
return (mp_obj_t)&os_uname_info_obj;
6769
}
6870

69-
bool common_hal_os_urandom(uint8_t *buffer, uint32_t length) {
71+
bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) {
7072
#ifdef SAM_D5X_E5X
7173
hri_mclk_set_APBCMASK_TRNG_bit(MCLK);
7274
struct rand_sync_desc random;

ports/atmel-samd/common-hal/ps2io/Ps2.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
*/
2727

2828
#include "common-hal/ps2io/Ps2.h"
29+
#include "shared-bindings/ps2io/Ps2.h"
2930

3031
#include <stdint.h>
3132

@@ -302,11 +303,6 @@ uint16_t common_hal_ps2io_ps2_get_len(ps2io_ps2_obj_t *self) {
302303
return self->bufcount;
303304
}
304305

305-
bool common_hal_ps2io_ps2_get_paused(ps2io_ps2_obj_t *self) {
306-
uint32_t mask = 1 << self->channel;
307-
return (EIC->INTENSET.reg & (mask << EIC_INTENSET_EXTINT_Pos)) == 0;
308-
}
309-
310306
int16_t common_hal_ps2io_ps2_popleft(ps2io_ps2_obj_t *self) {
311307
common_hal_mcu_disable_interrupts();
312308
if (self->bufcount <= 0) {

ports/atmel-samd/common-hal/pulseio/PulseOut.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static void turn_off(__IO PORT_PINCFG_Type *pincfg) {
5959
pincfg->reg = PORT_PINCFG_RESETVALUE;
6060
}
6161

62-
void pulse_finish(void) {
62+
STATIC void pulse_finish(void) {
6363
pulse_index++;
6464

6565
if (active_pincfg == NULL) {

ports/atmel-samd/common-hal/pwmio/PWMOut.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static uint8_t tcc_channel(const pin_timer_t *t) {
9191
return t->wave_output % tcc_cc_num[t->index];
9292
}
9393

94-
bool channel_ok(const pin_timer_t *t) {
94+
STATIC bool channel_ok(const pin_timer_t *t) {
9595
uint8_t channel_bit = 1 << tcc_channel(t);
9696
return (!t->is_tc && ((tcc_channels[t->index] & channel_bit) == 0)) ||
9797
t->is_tc;

ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
*/
2626

2727
#include "common-hal/rotaryio/IncrementalEncoder.h"
28+
#include "shared-bindings/rotaryio/IncrementalEncoder.h"
2829
#include "shared-module/rotaryio/IncrementalEncoder.h"
2930

3031
#include "atmel_start_pins.h"

ports/atmel-samd/common-hal/rtc/RTC.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "py/runtime.h"
3636
#include "shared/timeutils/timeutils.h"
3737
#include "shared-bindings/rtc/__init__.h"
38+
#include "shared-bindings/rtc/RTC.h"
3839
#include "supervisor/port.h"
3940
#include "supervisor/shared/translate.h"
4041

ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ mp_float_t common_hal_watchdog_get_timeout(watchdog_watchdogtimer_obj_t *self) {
5050
return self->timeout;
5151
}
5252

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

5656
// disable watchdog for config

ports/atmel-samd/supervisor/internal_flash.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,6 @@ void port_internal_flash_flush(void) {
7878
void supervisor_flash_release_cache(void) {
7979
}
8080

81-
void flash_flush(void) {
82-
supervisor_flash_flush();
83-
}
84-
8581
static int32_t convert_block_to_flash_addr(uint32_t block) {
8682
if (0 <= block && block < INTERNAL_FLASH_PART1_NUM_BLOCKS) {
8783
// a block in partition 1
@@ -91,7 +87,7 @@ static int32_t convert_block_to_flash_addr(uint32_t block) {
9187
return -1;
9288
}
9389

94-
bool supervisor_flash_read_block(uint8_t *dest, uint32_t block) {
90+
STATIC bool supervisor_flash_read_block(uint8_t *dest, uint32_t block) {
9591
// non-MBR block, get data from flash memory
9692
int32_t src = convert_block_to_flash_addr(block);
9793
if (src == -1) {
@@ -102,7 +98,7 @@ bool supervisor_flash_read_block(uint8_t *dest, uint32_t block) {
10298
return error_code == ERR_NONE;
10399
}
104100

105-
bool supervisor_flash_write_block(const uint8_t *src, uint32_t block) {
101+
STATIC bool supervisor_flash_write_block(const uint8_t *src, uint32_t block) {
106102
// non-MBR block, copy to cache
107103
int32_t dest = convert_block_to_flash_addr(block);
108104
if (dest == -1) {

ports/atmel-samd/supervisor/port.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@
109109
#include "shared-bindings/rtc/__init__.h"
110110
#include "shared_timers.h"
111111
#include "reset.h"
112+
#include "common-hal/pulseio/PulseIn.h"
112113

113114
#include "supervisor/background_callback.h"
114115
#include "supervisor/shared/safe_mode.h"

ports/espressif/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ endif
150150
# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk
151151
CFLAGS += $(OPTIMIZATION_FLAGS)
152152

153-
CFLAGS += $(INC) -Werror -Wall -std=gnu11 -Wl,--gc-sections $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT)
153+
CFLAGS += $(INC) -Werror -Wall -std=gnu11 -Wl,--gc-sections $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT) -Werror=missing-prototypes
154154

155155
ifeq ($(IDF_TARGET_ARCH),xtensa)
156156
CFLAGS += -mlongcalls

ports/espressif/background.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
#include "py/runtime.h"
2828
#include "supervisor/filesystem.h"
29+
#include "supervisor/port.h"
2930
#include "supervisor/shared/stack.h"
3031

3132
#include "freertos/FreeRTOS.h"

ports/espressif/bindings/espidf/__init__.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,7 @@ STATIC mp_obj_t espidf_erase_nvs(void) {
8282
MP_DEFINE_CONST_FUN_OBJ_0(espidf_erase_nvs_obj, espidf_erase_nvs);
8383

8484

85-
//| class IDFError(OSError):
86-
//| """Raised for certain generic ESP IDF errors."""
87-
//| ...
88-
//|
89-
NORETURN void mp_raise_espidf_IDFError(void) {
90-
nlr_raise(mp_obj_new_exception(&mp_type_espidf_IDFError));
91-
}
92-
93-
void espidf_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
85+
STATIC void espidf_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) {
9486
mp_print_kind_t k = kind & ~PRINT_EXC_SUBCLASS;
9587
bool is_subclass = kind & PRINT_EXC_SUBCLASS;
9688
if (!is_subclass && (k == PRINT_EXC)) {

ports/espressif/boards/ai_thinker_esp32-c3s/board.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
*/
2727

2828
#include "shared-bindings/microcontroller/Pin.h"
29+
#include "supervisor/board.h"
2930

3031
void board_init(void) {
3132

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

5253
void reset_board(void) {
5354
}
54-
55-
void board_deinit(void) {
56-
}

ports/espressif/boards/microdev_micro_c3/board.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
*/
2626

2727
#include "shared-bindings/microcontroller/Pin.h"
28+
#include "supervisor/board.h"
2829

2930
void board_init(void) {
3031
// USB
@@ -54,5 +55,7 @@ bool board_requests_safe_mode(void) {
5455
void reset_board(void) {
5556
}
5657

58+
#if CIRCUITPY_ALARM
5759
void board_deinit(void) {
5860
}
61+
#endif

ports/espressif/cam.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ typedef struct {
6969

7070
static cam_obj_t *cam_obj = NULL;
7171

72-
void IRAM_ATTR cam_isr(void *arg) {
72+
static void IRAM_ATTR cam_isr(void *arg) {
7373
cam_event_t cam_event = {0};
7474
BaseType_t HPTaskAwoken = pdFALSE;
7575
typeof(I2S0.int_st) int_st = I2S0.int_st;
@@ -85,7 +85,7 @@ void IRAM_ATTR cam_isr(void *arg) {
8585
}
8686
}
8787

88-
void IRAM_ATTR cam_vsync_isr(void *arg) {
88+
static void IRAM_ATTR cam_vsync_isr(void *arg) {
8989
cam_event_t cam_event = {0};
9090
BaseType_t HPTaskAwoken = pdFALSE;
9191
/*!< filter */
@@ -392,7 +392,7 @@ void cam_give(uint8_t *buffer) {
392392
}
393393
}
394394

395-
void cam_dma_config(const cam_config_t *config) {
395+
static void cam_dma_config(const cam_config_t *config) {
396396
int cnt = 0;
397397

398398
if (config->mode.jpeg) {

0 commit comments

Comments
 (0)