Skip to content

Commit 4a1ce64

Browse files
authored
Merge pull request #5561 from jepler/enable-error-missing-prototypes
Enable -Wmissing-prototypes for atmel-samd
2 parents e2d2050 + 63fbf98 commit 4a1ce64

File tree

16 files changed

+42
-24
lines changed

16 files changed

+42
-24
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
// Zephyr include files to define HCI communication values and structs.
2727
// #include "hci_include/hci.h"
2828
// #include "hci_include/hci_err.h"
29+
#include "hci_include/att_internal.h"
2930
#include "hci_include/l2cap_internal.h"
3031

3132
#include "py/obj.h"

devices/ble_hci/common-hal/_bleio/hci_include/att_internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* SPDX-License-Identifier: Apache-2.0
99
*/
1010

11+
#pragma once
1112

1213
#include <stdbool.h>
1314
// for __packed

main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -915,13 +915,13 @@ void NORETURN nlr_jump_fail(void *val) {
915915
}
916916
}
917917

918-
void NORETURN __fatal_error(const char *msg) {
918+
#ifndef NDEBUG
919+
static void NORETURN __fatal_error(const char *msg) {
919920
reset_into_safe_mode(MICROPY_FATAL_ERROR);
920921
while (true) {
921922
}
922923
}
923924

924-
#ifndef NDEBUG
925925
void MP_WEAK __assert_func(const char *file, int line, const char *func, const char *expr) {
926926
mp_printf(&mp_plat_print, "Assertion '%s' failed, at file %s:%d\n", expr, file, line);
927927
__fatal_error("Assertion failed");

ports/atmel-samd/Makefile

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ else
158158
endif
159159
endif
160160

161-
CFLAGS += $(INC) -Wall -Werror -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT)
161+
CFLAGS += $(INC) -Wall -Werror -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) -Werror=missing-prototypes
162162

163163
ifeq ($(CHIP_FAMILY), samd21)
164164
CFLAGS += \
@@ -291,19 +291,9 @@ $(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
294295

295-
SRC_C += \
296-
audio_dma.c \
297-
background.c \
298-
bindings/samd/Clock.c \
299-
bindings/samd/__init__.c \
300-
boards/$(BOARD)/board.c \
301-
boards/$(BOARD)/pins.c \
302-
eic_handler.c \
303-
fatfs_port.c \
304-
freetouch/adafruit_ptc.c \
305-
lib/tinyusb/src/portable/microchip/samd/dcd_samd.c \
306-
mphalport.c \
296+
SRC_PERIPHERALS := \
307297
peripherals/samd/$(PERIPHERALS_CHIP_FAMILY)/adc.c \
308298
peripherals/samd/$(PERIPHERALS_CHIP_FAMILY)/cache.c \
309299
peripherals/samd/$(PERIPHERALS_CHIP_FAMILY)/clocks.c \
@@ -319,8 +309,24 @@ SRC_C += \
319309
peripherals/samd/external_interrupts.c \
320310
peripherals/samd/sercom.c \
321311
peripherals/samd/timers.c \
312+
313+
$(patsubst $(SRC_PERIPHERALS),%.c,%.o): CFLAGS += -Wno-missing-prototypes
314+
315+
SRC_C += \
316+
audio_dma.c \
317+
background.c \
318+
bindings/samd/Clock.c \
319+
bindings/samd/__init__.c \
320+
boards/$(BOARD)/board.c \
321+
boards/$(BOARD)/pins.c \
322+
eic_handler.c \
323+
fatfs_port.c \
324+
freetouch/adafruit_ptc.c \
325+
lib/tinyusb/src/portable/microchip/samd/dcd_samd.c \
326+
mphalport.c \
322327
reset.c \
323328
timer_handler.c \
329+
$(SRC_PERIPHERALS) \
324330

325331
# This is an OR because it filters to any 1s and then checks to see if it is not
326332
# empty.

ports/atmel-samd/supervisor/port.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ uint64_t port_get_raw_ticks(uint8_t *subticks) {
556556
return overflow_count + current_ticks / 16;
557557
}
558558

559-
void evsyshandler_common(void) {
559+
static void evsyshandler_common(void) {
560560
#ifdef SAMD21
561561
if (_tick_event_channel < EVSYS_SYNCH_NUM && event_interrupt_active(_tick_event_channel)) {
562562
supervisor_tick();

shared-module/usb_cdc/Serial.c

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

2727
#include "shared/runtime/interrupt_char.h"
28+
#include "shared-bindings/usb_cdc/Serial.h"
2829
#include "shared-module/usb_cdc/Serial.h"
2930
#include "supervisor/shared/tick.h"
3031

shared-module/usb_midi/PortIn.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
* THE SOFTWARE.
2525
*/
2626

27+
#include "shared-bindings/usb_midi/PortIn.h"
2728
#include "shared-module/usb_midi/PortIn.h"
2829
#include "supervisor/shared/translate.h"
2930
#include "tusb.h"

shared-module/usb_midi/PortOut.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
* THE SOFTWARE.
2525
*/
2626

27+
#include "shared-bindings/usb_midi/PortOut.h"
2728
#include "shared-module/usb_midi/PortOut.h"
2829
#include "supervisor/shared/translate.h"
2930
#include "tusb.h"

supervisor/shared/background_callback.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "py/mpconfig.h"
3131
#include "supervisor/background_callback.h"
3232
#include "supervisor/linker.h"
33+
#include "supervisor/port.h"
3334
#include "supervisor/shared/tick.h"
3435
#include "shared-bindings/microcontroller/__init__.h"
3536

supervisor/shared/external_flash/external_flash.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ static int32_t convert_block_to_flash_addr(uint32_t block) {
495495
return -1;
496496
}
497497

498-
bool external_flash_read_block(uint8_t *dest, uint32_t block) {
498+
static bool external_flash_read_block(uint8_t *dest, uint32_t block) {
499499
int32_t address = convert_block_to_flash_addr(block);
500500
if (address == -1) {
501501
// bad block number
@@ -524,7 +524,7 @@ bool external_flash_read_block(uint8_t *dest, uint32_t block) {
524524
return read_flash(address, dest, FILESYSTEM_BLOCK_SIZE);
525525
}
526526

527-
bool external_flash_write_block(const uint8_t *data, uint32_t block) {
527+
static bool external_flash_write_block(const uint8_t *data, uint32_t block) {
528528
// Non-MBR block, copy to cache
529529
int32_t address = convert_block_to_flash_addr(block);
530530
if (address == -1) {

0 commit comments

Comments
 (0)