mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-21 02:32:06 +00:00
Enable a few warning flags
Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
This commit is contained in:
7
Makefile
7
Makefile
@@ -28,7 +28,12 @@ VERSION_STRING := `git describe --tags --dirty --always 2>/dev/null`
|
|||||||
|
|
||||||
WARNFLAGS := -Werror -Wall -Wextra -Wpedantic -Wno-sign-compare -Wchkp \
|
WARNFLAGS := -Werror -Wall -Wextra -Wpedantic -Wno-sign-compare -Wchkp \
|
||||||
-Wformat=2 -Wformat-overflow=2 -Wformat-truncation=1 \
|
-Wformat=2 -Wformat-overflow=2 -Wformat-truncation=1 \
|
||||||
-Wformat-y2k
|
-Wformat-y2k -Wswitch-enum -Wunused -Wuninitialized \
|
||||||
|
-Wunknown-pragmas -Wstrict-overflow=5 -Wstringop-overflow=4 \
|
||||||
|
-Walloc-zero -Wduplicated-cond -Wfloat-equal -Wshadow \
|
||||||
|
-Wcast-qual -Wcast-align -Wlogical-op -Wnested-externs \
|
||||||
|
-Wno-aggressive-loop-optimizations -Winline \
|
||||||
|
-Wstrict-prototypes -Wold-style-definition
|
||||||
|
|
||||||
# Overridable CFLAGS
|
# Overridable CFLAGS
|
||||||
CFLAGS := -g
|
CFLAGS := -g
|
||||||
|
|||||||
@@ -414,7 +414,7 @@ void yylex_GetFloatMaskAndFloatLen(uint32_t *pnFloatMask, uint32_t *pnFloatLen)
|
|||||||
/*
|
/*
|
||||||
* Gets the longest keyword/operator from the current position in the buffer.
|
* Gets the longest keyword/operator from the current position in the buffer.
|
||||||
*/
|
*/
|
||||||
struct sLexString *yylex_GetLongestFixed()
|
struct sLexString *yylex_GetLongestFixed(void)
|
||||||
{
|
{
|
||||||
struct sLexString *pLongestFixed = NULL;
|
struct sLexString *pLongestFixed = NULL;
|
||||||
char *s = pLexBuffer;
|
char *s = pLexBuffer;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <float.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -483,7 +484,7 @@ int main(int argc, char *argv[])
|
|||||||
if (CurrentOptions.verbose) {
|
if (CurrentOptions.verbose) {
|
||||||
printf("Success! %u lines in %d.%02d seconds ", nTotalLines,
|
printf("Success! %u lines in %d.%02d seconds ", nTotalLines,
|
||||||
(int)timespent, ((int)(timespent * 100.0)) % 100);
|
(int)timespent, ((int)(timespent * 100.0)) % 100);
|
||||||
if (timespent == 0)
|
if (timespent < FLT_MIN_EXP)
|
||||||
printf("(INFINITY lines/minute)\n");
|
printf("(INFINITY lines/minute)\n");
|
||||||
else
|
else
|
||||||
printf("(%d lines/minute)\n",
|
printf("(%d lines/minute)\n",
|
||||||
|
|||||||
@@ -469,8 +469,10 @@ struct ColorWithLuminance {
|
|||||||
|
|
||||||
static int compare_luminance(const void *a, const void *b)
|
static int compare_luminance(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
struct ColorWithLuminance *x = (struct ColorWithLuminance *)a;
|
const struct ColorWithLuminance *x, *y;
|
||||||
struct ColorWithLuminance *y = (struct ColorWithLuminance *)b;
|
|
||||||
|
x = (const struct ColorWithLuminance *)a;
|
||||||
|
y = (const struct ColorWithLuminance *)b;
|
||||||
|
|
||||||
return y->luminance - x->luminance;
|
return y->luminance - x->luminance;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,6 +74,10 @@ static void do_max_bank(enum eSectionType Type, int32_t nBank)
|
|||||||
if (nBank > MaxVBankUsed)
|
if (nBank > MaxVBankUsed)
|
||||||
MaxVBankUsed = nBank;
|
MaxVBankUsed = nBank;
|
||||||
break;
|
break;
|
||||||
|
case SECT_ROM0:
|
||||||
|
case SECT_WRAM0:
|
||||||
|
case SECT_OAM:
|
||||||
|
case SECT_HRAM:
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -494,7 +498,6 @@ void SetLinkerscriptName(char *tzLinkerscriptFile)
|
|||||||
|
|
||||||
void AssignSections(void)
|
void AssignSections(void)
|
||||||
{
|
{
|
||||||
int32_t i;
|
|
||||||
struct sSection *pSection;
|
struct sSection *pSection;
|
||||||
|
|
||||||
MaxBankUsed = 0;
|
MaxBankUsed = 0;
|
||||||
@@ -503,7 +506,7 @@ void AssignSections(void)
|
|||||||
* Initialize the memory areas
|
* Initialize the memory areas
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for (i = 0; i < BANK_INDEX_MAX; i += 1) {
|
for (int32_t i = 0; i < BANK_INDEX_MAX; i += 1) {
|
||||||
BankFree[i] = malloc(sizeof(*BankFree[i]));
|
BankFree[i] = malloc(sizeof(*BankFree[i]));
|
||||||
|
|
||||||
if (!BankFree[i]) {
|
if (!BankFree[i]) {
|
||||||
@@ -663,6 +666,10 @@ void AssignSections(void)
|
|||||||
do_max_bank(pSection->Type, pSection->nBank);
|
do_max_bank(pSection->Type, pSection->nBank);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SECT_ROM0:
|
||||||
|
case SECT_WRAM0:
|
||||||
|
case SECT_OAM:
|
||||||
|
case SECT_HRAM:
|
||||||
default: /* Handle other sections later */
|
default: /* Handle other sections later */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
extern int yyparse();
|
extern int yyparse(void);
|
||||||
|
|
||||||
/* File include stack. */
|
/* File include stack. */
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#include "link/script.h"
|
#include "link/script.h"
|
||||||
|
|
||||||
int yylex();
|
int yylex(void);
|
||||||
void yyerror(char *);
|
void yyerror(char *);
|
||||||
|
|
||||||
extern int yylineno;
|
extern int yylineno;
|
||||||
@@ -107,8 +107,8 @@ statement:
|
|||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
extern int yylex();
|
extern int yylex(void);
|
||||||
extern int yyparse();
|
extern int yyparse(void);
|
||||||
|
|
||||||
int yywrap(void)
|
int yywrap(void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -85,59 +85,59 @@ void script_InitSections(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void script_SetCurrentSectionType(const char *type, uint32_t bank)
|
void script_SetCurrentSectionType(const char *type, uint32_t bank_num)
|
||||||
{
|
{
|
||||||
if (strcmp(type, "ROM0") == 0) {
|
if (strcmp(type, "ROM0") == 0) {
|
||||||
if (bank != 0)
|
if (bank_num != 0)
|
||||||
errx(1, "Trying to assign a bank number to ROM0.\n");
|
errx(1, "Trying to assign a bank number to ROM0.\n");
|
||||||
current_bank = BANK_INDEX_ROM0;
|
current_bank = BANK_INDEX_ROM0;
|
||||||
current_real_bank = 0;
|
current_real_bank = 0;
|
||||||
return;
|
return;
|
||||||
} else if (strcmp(type, "ROMX") == 0) {
|
} else if (strcmp(type, "ROMX") == 0) {
|
||||||
if (bank == 0)
|
if (bank_num == 0)
|
||||||
errx(1, "ROMX index can't be 0.\n");
|
errx(1, "ROMX index can't be 0.\n");
|
||||||
if (bank > BANK_COUNT_ROMX) {
|
if (bank_num > BANK_COUNT_ROMX) {
|
||||||
errx(1, "ROMX index too big (%d > %d).\n", bank,
|
errx(1, "ROMX index too big (%d > %d).\n", bank_num,
|
||||||
BANK_COUNT_ROMX);
|
BANK_COUNT_ROMX);
|
||||||
}
|
}
|
||||||
current_bank = BANK_INDEX_ROMX + bank - 1;
|
current_bank = BANK_INDEX_ROMX + bank_num - 1;
|
||||||
current_real_bank = bank;
|
current_real_bank = bank_num;
|
||||||
return;
|
return;
|
||||||
} else if (strcmp(type, "VRAM") == 0) {
|
} else if (strcmp(type, "VRAM") == 0) {
|
||||||
if (bank >= BANK_COUNT_VRAM) {
|
if (bank_num >= BANK_COUNT_VRAM) {
|
||||||
errx(1, "VRAM index too big (%d >= %d).\n", bank,
|
errx(1, "VRAM index too big (%d >= %d).\n", bank_num,
|
||||||
BANK_COUNT_VRAM);
|
BANK_COUNT_VRAM);
|
||||||
}
|
}
|
||||||
current_bank = BANK_INDEX_VRAM + bank;
|
current_bank = BANK_INDEX_VRAM + bank_num;
|
||||||
current_real_bank = bank;
|
current_real_bank = bank_num;
|
||||||
return;
|
return;
|
||||||
} else if (strcmp(type, "WRAM0") == 0) {
|
} else if (strcmp(type, "WRAM0") == 0) {
|
||||||
if (bank != 0)
|
if (bank_num != 0)
|
||||||
errx(1, "Trying to assign a bank number to WRAM0.\n");
|
errx(1, "Trying to assign a bank number to WRAM0.\n");
|
||||||
|
|
||||||
current_bank = BANK_INDEX_WRAM0;
|
current_bank = BANK_INDEX_WRAM0;
|
||||||
current_real_bank = 0;
|
current_real_bank = 0;
|
||||||
return;
|
return;
|
||||||
} else if (strcmp(type, "WRAMX") == 0) {
|
} else if (strcmp(type, "WRAMX") == 0) {
|
||||||
if (bank == 0)
|
if (bank_num == 0)
|
||||||
errx(1, "WRAMX index can't be 0.\n");
|
errx(1, "WRAMX index can't be 0.\n");
|
||||||
if (bank > BANK_COUNT_WRAMX) {
|
if (bank_num > BANK_COUNT_WRAMX) {
|
||||||
errx(1, "WRAMX index too big (%d > %d).\n", bank,
|
errx(1, "WRAMX index too big (%d > %d).\n", bank_num,
|
||||||
BANK_COUNT_WRAMX);
|
BANK_COUNT_WRAMX);
|
||||||
}
|
}
|
||||||
current_bank = BANK_INDEX_WRAMX + bank - 1;
|
current_bank = BANK_INDEX_WRAMX + bank_num - 1;
|
||||||
current_real_bank = bank;
|
current_real_bank = bank_num;
|
||||||
return;
|
return;
|
||||||
} else if (strcmp(type, "SRAM") == 0) {
|
} else if (strcmp(type, "SRAM") == 0) {
|
||||||
if (bank >= BANK_COUNT_SRAM) {
|
if (bank_num >= BANK_COUNT_SRAM) {
|
||||||
errx(1, "SRAM index too big (%d >= %d).\n", bank,
|
errx(1, "SRAM index too big (%d >= %d).\n", bank_num,
|
||||||
BANK_COUNT_SRAM);
|
BANK_COUNT_SRAM);
|
||||||
}
|
}
|
||||||
current_bank = BANK_INDEX_SRAM + bank;
|
current_bank = BANK_INDEX_SRAM + bank_num;
|
||||||
current_real_bank = bank;
|
current_real_bank = bank_num;
|
||||||
return;
|
return;
|
||||||
} else if (strcmp(type, "OAM") == 0) {
|
} else if (strcmp(type, "OAM") == 0) {
|
||||||
if (bank != 0) {
|
if (bank_num != 0) {
|
||||||
errx(1, "%s: Trying to assign a bank number to OAM.\n",
|
errx(1, "%s: Trying to assign a bank number to OAM.\n",
|
||||||
__func__);
|
__func__);
|
||||||
}
|
}
|
||||||
@@ -145,7 +145,7 @@ void script_SetCurrentSectionType(const char *type, uint32_t bank)
|
|||||||
current_real_bank = 0;
|
current_real_bank = 0;
|
||||||
return;
|
return;
|
||||||
} else if (strcmp(type, "HRAM") == 0) {
|
} else if (strcmp(type, "HRAM") == 0) {
|
||||||
if (bank != 0) {
|
if (bank_num != 0) {
|
||||||
errx(1, "%s: Trying to assign a bank number to HRAM.\n",
|
errx(1, "%s: Trying to assign a bank number to HRAM.\n",
|
||||||
__func__);
|
__func__);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user