Skip to content

Commit 6b24be5

Browse files
committed
- add GCC diagnostic ignored "-Warray-bounds" to affected code
- correct usage of __has_attribute(nonstring) and rename to ATTR_NOSTRING
1 parent d435d66 commit 6b24be5

File tree

3 files changed

+30
-29
lines changed

3 files changed

+30
-29
lines changed

Makefile

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

393393
CFLAGS += -DDFU_APP_DATA_RESERVED=$(DFU_APP_DATA_RESERVED)
394394

395-
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523
396-
# Fixes for gcc version 12, 13, 14 and 15.
397-
ifneq (,$(filter 12.% 13.% 14.% 15.%,$(shell $(CC) -dumpversion 2>$(NULL_DEVICE))))
398-
CFLAGS += --param=min-pagesize=0
399-
endif
400-
401395
#------------------------------------------------------------------------------
402396
# Linker Flags
403397
#------------------------------------------------------------------------------

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: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,18 @@
4141
//--------------------------------------------------------------------+
4242

4343
// Add nonstring attribute if supported to avoid errors in GCC 15
44-
#ifdef __has_attribute
45-
#define __NONSTRING__ __attribute__((nonstring))
44+
#if defined(__has_attribute) && __has_attribute(nonstring)
45+
#define ATTR_NONSTRING __attribute__((nonstring))
4646
#else
47-
#define __NONSTRING__
47+
#define ATTR_NONSTRING
4848
#endif
4949

5050
typedef struct {
5151
uint8_t JumpInstruction[3];
52-
uint8_t OEMInfo[8] __NONSTRING__;
53-
uint16_t SectorSize;
54-
uint8_t SectorsPerCluster;
55-
uint16_t ReservedSectors;
52+
uint8_t OEMInfo[8] ATTR_NONSTRING;
53+
uint16_t SectorSize;
54+
uint8_t SectorsPerCluster;
55+
uint16_t ReservedSectors;
5656
uint8_t FATCopies;
5757
uint16_t RootDirectoryEntries;
5858
uint16_t TotalSectors16;
@@ -66,8 +66,8 @@ typedef struct {
6666
uint8_t Reserved;
6767
uint8_t ExtendedBootSig;
6868
uint32_t VolumeSerialNumber;
69-
uint8_t VolumeLabel[11] __NONSTRING__;
70-
uint8_t FilesystemIdentifier[8] __NONSTRING__;
69+
uint8_t VolumeLabel[11] ATTR_NONSTRING;
70+
uint8_t FilesystemIdentifier[8] ATTR_NONSTRING;
7171
} __attribute__((packed)) FAT_BootBlock;
7272

7373
typedef struct {
@@ -88,8 +88,8 @@ typedef struct {
8888
STATIC_ASSERT(sizeof(DirEntry) == 32);
8989

9090
struct TextFile {
91-
char const name[11] __NONSTRING__;
92-
char const *content;
91+
const char name[11] ATTR_NONSTRING;
92+
const char *content;
9393
};
9494

9595

0 commit comments

Comments
 (0)