Skip to content

Commit 6180d8a

Browse files
authored
Merge pull request #381 from ReFil/gcc-15-fixes
fix: Fix build errors on GCC15
2 parents ede0f06 + 6b24be5 commit 6180d8a

File tree

3 files changed

+34
-26
lines changed

3 files changed

+34
-26
lines changed

Makefile

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -397,12 +397,6 @@ endif
397397

398398
CFLAGS += -DDFU_APP_DATA_RESERVED=$(DFU_APP_DATA_RESERVED)
399399

400-
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523
401-
# Fixes for gcc version 12, 13 and 14.
402-
ifneq (,$(filter 12.% 13.% 14.%,$(shell $(CC) -dumpversion 2>$(NULL_DEVICE))))
403-
CFLAGS += --param=min-pagesize=0
404-
endif
405-
406400
#------------------------------------------------------------------------------
407401
# Linker Flags
408402
#------------------------------------------------------------------------------

lib/sdk11/components/libraries/bootloader_dfu/bootloader_settings.c

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,22 @@ void bootloader_util_settings_get(const bootloader_settings_t ** pp_bootloader_s
4040
*pp_bootloader_settings = p_bootloader_settings;
4141
}
4242

43-
void bootloader_mbr_addrs_populate(void)
44-
{
45-
if (*(const uint32_t *)MBR_BOOTLOADER_ADDR == 0xFFFFFFFF)
46-
{
47-
nrfx_nvmc_word_write(MBR_BOOTLOADER_ADDR, BOOTLOADER_REGION_START);
48-
}
49-
50-
if (*(const uint32_t *)MBR_PARAM_PAGE_ADDR == 0xFFFFFFFF)
51-
{
52-
nrfx_nvmc_word_write(MBR_PARAM_PAGE_ADDR, BOOTLOADER_MBR_PARAMS_PAGE_ADDRESS);
53-
}
54-
}
43+
void bootloader_mbr_addrs_populate(void)
44+
{
45+
#if defined(__GNUC__) && (__GNUC__ >= 12)
46+
#pragma GCC diagnostic push
47+
#pragma GCC diagnostic ignored "-Warray-bounds"
48+
#endif
49+
if (*(const uint32_t *)MBR_BOOTLOADER_ADDR == 0xFFFFFFFF)
50+
{
51+
nrfx_nvmc_word_write(MBR_BOOTLOADER_ADDR, BOOTLOADER_REGION_START);
52+
}
53+
54+
if (*(const uint32_t *)MBR_PARAM_PAGE_ADDR == 0xFFFFFFFF)
55+
{
56+
nrfx_nvmc_word_write(MBR_PARAM_PAGE_ADDR, BOOTLOADER_MBR_PARAMS_PAGE_ADDRESS);
57+
}
58+
#if defined(__GNUC__) && (__GNUC__ >= 12)
59+
#pragma GCC diagnostic pop
60+
#endif
61+
}

src/usb/uf2/ghostfat.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,19 @@
4040
//
4141
//--------------------------------------------------------------------+
4242

43+
// Add nonstring attribute if supported to avoid errors in GCC 15
44+
#if defined(__has_attribute) && __has_attribute(nonstring)
45+
#define ATTR_NONSTRING __attribute__((nonstring))
46+
#else
47+
#define ATTR_NONSTRING
48+
#endif
49+
4350
typedef struct {
4451
uint8_t JumpInstruction[3];
45-
uint8_t OEMInfo[8];
46-
uint16_t SectorSize;
47-
uint8_t SectorsPerCluster;
48-
uint16_t ReservedSectors;
52+
uint8_t OEMInfo[8] ATTR_NONSTRING;
53+
uint16_t SectorSize;
54+
uint8_t SectorsPerCluster;
55+
uint16_t ReservedSectors;
4956
uint8_t FATCopies;
5057
uint16_t RootDirectoryEntries;
5158
uint16_t TotalSectors16;
@@ -59,8 +66,8 @@ typedef struct {
5966
uint8_t Reserved;
6067
uint8_t ExtendedBootSig;
6168
uint32_t VolumeSerialNumber;
62-
uint8_t VolumeLabel[11];
63-
uint8_t FilesystemIdentifier[8];
69+
uint8_t VolumeLabel[11] ATTR_NONSTRING;
70+
uint8_t FilesystemIdentifier[8] ATTR_NONSTRING;
6471
} __attribute__((packed)) FAT_BootBlock;
6572

6673
typedef struct {
@@ -81,8 +88,8 @@ typedef struct {
8188
STATIC_ASSERT(sizeof(DirEntry) == 32);
8289

8390
struct TextFile {
84-
char const name[11];
85-
char const *content;
91+
const char name[11] ATTR_NONSTRING;
92+
const char *content;
8693
};
8794

8895

0 commit comments

Comments
 (0)