mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-21 10:42:07 +00:00
Fix some usually disabled compiler warnings (#1286)
* Fixes from temporarily re-enabling more compiler warnings * More edits suggested by cppcheck * Fix hanging on append_yylval_string * Fix FOR loop increment
This commit is contained in:
@@ -61,7 +61,7 @@ static enum SectionType typeMap[SECTTYPE_INVALID] = {
|
||||
|
||||
void out_AddSection(struct Section const *section)
|
||||
{
|
||||
static uint32_t maxNbBanks[] = {
|
||||
static const uint32_t maxNbBanks[] = {
|
||||
AT(SECTTYPE_WRAM0) 1,
|
||||
AT(SECTTYPE_VRAM) 2,
|
||||
AT(SECTTYPE_ROMX) UINT32_MAX,
|
||||
@@ -544,7 +544,7 @@ static void writeMapSummary(void)
|
||||
nbBanks * sectionTypeInfo[type].size - usedTotal);
|
||||
if (sectionTypeInfo[type].firstBank != sectionTypeInfo[type].lastBank
|
||||
|| nbBanks > 1)
|
||||
fprintf(mapFile, " in %d bank%s", nbBanks, nbBanks == 1 ? "" : "s");
|
||||
fprintf(mapFile, " in %u bank%s", nbBanks, nbBanks == 1 ? "" : "s");
|
||||
putc('\n', mapFile);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -569,7 +569,7 @@ void sdobj_ReadFile(struct FileStackNode const *where, FILE *file) {
|
||||
patch->pcSection = section; // No need to fill `pcSectionID`, then
|
||||
patch->pcOffset = patch->offset - 1; // For `jr`s
|
||||
|
||||
patch->type = flags & 1 << RELOC_SIZE ? PATCHTYPE_BYTE : PATCHTYPE_WORD;
|
||||
patch->type = (flags & 1 << RELOC_SIZE) ? PATCHTYPE_BYTE : PATCHTYPE_WORD;
|
||||
uint8_t nbBaseBytes = patch->type == PATCHTYPE_BYTE ? ADDR_SIZE : 2;
|
||||
uint32_t baseValue = 0;
|
||||
|
||||
@@ -694,7 +694,7 @@ void sdobj_ReadFile(struct FileStackNode const *where, FILE *file) {
|
||||
patch->rpnExpression[patch->rpnSize + 2] = 16 >> 8;
|
||||
patch->rpnExpression[patch->rpnSize + 3] = 16 >> 16;
|
||||
patch->rpnExpression[patch->rpnSize + 4] = 16 >> 24;
|
||||
patch->rpnExpression[patch->rpnSize + 5] = flags & 1 << RELOC_SIGNED ? RPN_SHR : RPN_USHR;
|
||||
patch->rpnExpression[patch->rpnSize + 5] = (flags & 1 << RELOC_SIGNED) ? RPN_SHR : RPN_USHR;
|
||||
patch->rpnSize += 5 + 1;
|
||||
} else {
|
||||
if (flags & 1 << RELOC_EXPR16 && flags & 1 << RELOC_WHICHBYTE) {
|
||||
@@ -703,7 +703,7 @@ void sdobj_ReadFile(struct FileStackNode const *where, FILE *file) {
|
||||
patch->rpnExpression[patch->rpnSize + 2] = 8 >> 8;
|
||||
patch->rpnExpression[patch->rpnSize + 3] = 8 >> 16;
|
||||
patch->rpnExpression[patch->rpnSize + 4] = 8 >> 24;
|
||||
patch->rpnExpression[patch->rpnSize + 5] = flags & 1 << RELOC_SIGNED ? RPN_SHR : RPN_USHR;
|
||||
patch->rpnExpression[patch->rpnSize + 5] = (flags & 1 << RELOC_SIGNED) ? RPN_SHR : RPN_USHR;
|
||||
patch->rpnSize += 5 + 1;
|
||||
}
|
||||
patch->rpnExpression[patch->rpnSize] = RPN_CONST;
|
||||
|
||||
Reference in New Issue
Block a user