enale Wextra

clean up some warning
This commit is contained in:
hathach 2020-03-25 14:09:07 +07:00
parent 01ac2b3d46
commit b2d4b016a9
3 changed files with 16 additions and 11 deletions

View File

@ -230,8 +230,13 @@ CFLAGS += \
-Wall \ -Wall \
-Werror \ -Werror \
-Wfatal-errors \ -Wfatal-errors \
-Wextra
CFLAGS += -Wno-error=unused-parameter # Suppress warning caused by SDK
CFLAGS += -Wno-error=unused-parameter -Wno-error=expansion-to-defined
# TinyUSB tusb_hal_nrf_power_event
CFLAGS += -Wno-error=cast-function-type
# Defined Symbol (MACROS) # Defined Symbol (MACROS)
CFLAGS += -D__HEAP_SIZE=0 CFLAGS += -D__HEAP_SIZE=0

View File

@ -50,22 +50,22 @@ SOFTWARE.
: 12u /*Dec*/ ) : 12u /*Dec*/ )
#define __DAY_INT__ ( \ #define __DAY_INT__ ( \
(__DATE__ [4u] == ' ' ? 0u : __DATE__ [4u] - '0') * 10u \ (__DATE__ [4u] == ' ' ? 0 : __DATE__ [4u] - '0') * 10u \
+ (__DATE__ [5u] - '0') ) + (__DATE__ [5u] - '0') )
// __TIME__ expands to an eight-character string constant // __TIME__ expands to an eight-character string constant
// "23:59:01", or (if cannot determine time) "??:??:??" // "23:59:01", or (if cannot determine time) "??:??:??"
#define __HOUR_INT__ ( \ #define __HOUR_INT__ ( \
(__TIME__ [0u] == '?' ? 0u : __TIME__ [0u] - '0') * 10u \ (__TIME__ [0u] == '?' ? 0 : __TIME__ [0u] - '0') * 10u \
+ (__TIME__ [1u] == '?' ? 0u : __TIME__ [1u] - '0') ) + (__TIME__ [1u] == '?' ? 0 : __TIME__ [1u] - '0') )
#define __MINUTE_INT__ ( \ #define __MINUTE_INT__ ( \
(__TIME__ [3u] == '?' ? 0u : __TIME__ [3u] - '0') * 10u \ (__TIME__ [3u] == '?' ? 0 : __TIME__ [3u] - '0') * 10u \
+ (__TIME__ [4u] == '?' ? 0u : __TIME__ [4u] - '0') ) + (__TIME__ [4u] == '?' ? 0 : __TIME__ [4u] - '0') )
#define __SECONDS_INT__ ( \ #define __SECONDS_INT__ ( \
(__TIME__ [6u] == '?' ? 0u : __TIME__ [6u] - '0') * 10u \ (__TIME__ [6u] == '?' ? 0 : __TIME__ [6u] - '0') * 10u \
+ (__TIME__ [7u] == '?' ? 0u : __TIME__ [7u] - '0') ) + (__TIME__ [7u] == '?' ? 0 : __TIME__ [7u] - '0') )
#define __DOSDATE__ ( \ #define __DOSDATE__ ( \

View File

@ -214,11 +214,11 @@ void read_block(uint32_t block_no, uint8_t *data) {
// WARNING -- code presumes only one NULL .content for .UF2 file // WARNING -- code presumes only one NULL .content for .UF2 file
// and all non-NULL .content fit in one sector // and all non-NULL .content fit in one sector
// and requires it be the last element of the array // and requires it be the last element of the array
for (int i = 1; i < NUM_FILES * 2 + 4; ++i) { for (uint32_t i = 1; i < NUM_FILES * 2 + 4; ++i) {
data[i] = 0xff; data[i] = 0xff;
} }
} }
for (int i = 0; i < 256; ++i) { // Generate the FAT chain for the firmware "file" for (uint32_t i = 0; i < 256; ++i) { // Generate the FAT chain for the firmware "file"
uint32_t v = sectionIdx * 256 + i; uint32_t v = sectionIdx * 256 + i;
if (UF2_FIRST_SECTOR <= v && v <= UF2_LAST_SECTOR) if (UF2_FIRST_SECTOR <= v && v <= UF2_LAST_SECTOR)
((uint16_t *)(void *)data)[i] = v == UF2_LAST_SECTOR ? 0xffff : v + 1; ((uint16_t *)(void *)data)[i] = v == UF2_LAST_SECTOR ? 0xffff : v + 1;
@ -237,7 +237,7 @@ void read_block(uint32_t block_no, uint8_t *data) {
remainingEntries--; remainingEntries--;
} }
for (int i = DIRENTRIES_PER_SECTOR * sectionIdx; for (uint32_t i = DIRENTRIES_PER_SECTOR * sectionIdx;
remainingEntries > 0 && i < NUM_FILES; remainingEntries > 0 && i < NUM_FILES;
i++, d++) { i++, d++) {