mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
RGBFIX returns 1 if there was a -Werror before processing any files
This commit is contained in:
@@ -76,8 +76,6 @@ enum MbcType {
|
|||||||
MBC_NONE = UNSPECIFIED, // No MBC specified, do not act on it
|
MBC_NONE = UNSPECIFIED, // No MBC specified, do not act on it
|
||||||
};
|
};
|
||||||
|
|
||||||
void mbc_PrintAcceptedNames(FILE *file);
|
|
||||||
|
|
||||||
bool mbc_HasRAM(MbcType type);
|
bool mbc_HasRAM(MbcType type);
|
||||||
char const *mbc_Name(MbcType type);
|
char const *mbc_Name(MbcType type);
|
||||||
MbcType mbc_ParseName(char const *name, uint8_t &tpp1Major, uint8_t &tpp1Minor);
|
MbcType mbc_ParseName(char const *name, uint8_t &tpp1Major, uint8_t &tpp1Minor);
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ void error(char const *fmt, ...);
|
|||||||
void fatal(char const *fmt, ...);
|
void fatal(char const *fmt, ...);
|
||||||
|
|
||||||
void resetErrors();
|
void resetErrors();
|
||||||
|
bool anyErrors();
|
||||||
uint32_t checkErrors(char const *filename);
|
uint32_t checkErrors(char const *filename);
|
||||||
|
|
||||||
#endif // RGBDS_FIX_WARNING_HPP
|
#endif // RGBDS_FIX_WARNING_HPP
|
||||||
|
|||||||
@@ -901,7 +901,7 @@ int main(int argc, char *argv[]) {
|
|||||||
fatalWithUsage("If `-o` is set then only a single input file may be specified");
|
fatalWithUsage("If `-o` is set then only a single input file may be specified");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool failed = false;
|
bool failed = anyErrors();
|
||||||
do {
|
do {
|
||||||
failed |= processFilename(*argv, outputFilename);
|
failed |= processFilename(*argv, outputFilename);
|
||||||
} while (*++argv);
|
} while (*++argv);
|
||||||
|
|||||||
@@ -7,20 +7,7 @@
|
|||||||
|
|
||||||
#include "fix/warning.hpp"
|
#include "fix/warning.hpp"
|
||||||
|
|
||||||
[[gnu::format(printf, 1, 2), noreturn]]
|
static void printAcceptedMbcNames(FILE *file) {
|
||||||
static void fatalWithMBCNames(char const *fmt, ...) {
|
|
||||||
va_list ap;
|
|
||||||
fputs("FATAL: ", stderr);
|
|
||||||
va_start(ap, fmt);
|
|
||||||
vfprintf(stderr, fmt, ap);
|
|
||||||
va_end(ap);
|
|
||||||
putc('\n', stderr);
|
|
||||||
|
|
||||||
mbc_PrintAcceptedNames(stderr);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void mbc_PrintAcceptedNames(FILE *file) {
|
|
||||||
fputs("Accepted MBC names:\n", file);
|
fputs("Accepted MBC names:\n", file);
|
||||||
fputs("\tROM ($00) [aka ROM_ONLY]\n", file);
|
fputs("\tROM ($00) [aka ROM_ONLY]\n", file);
|
||||||
fputs("\tMBC1 ($01), MBC1+RAM ($02), MBC1+RAM+BATTERY ($03)\n", file);
|
fputs("\tMBC1 ($01), MBC1+RAM ($02), MBC1+RAM+BATTERY ($03)\n", file);
|
||||||
@@ -45,6 +32,19 @@ void mbc_PrintAcceptedNames(FILE *file) {
|
|||||||
fputs("\tTPP1_1.0+BATTERY+TIMER+MULTIRUMBLE\n", file);
|
fputs("\tTPP1_1.0+BATTERY+TIMER+MULTIRUMBLE\n", file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[gnu::format(printf, 1, 2), noreturn]]
|
||||||
|
static void fatalWithMBCNames(char const *fmt, ...) {
|
||||||
|
va_list ap;
|
||||||
|
fputs("FATAL: ", stderr);
|
||||||
|
va_start(ap, fmt);
|
||||||
|
vfprintf(stderr, fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
putc('\n', stderr);
|
||||||
|
|
||||||
|
printAcceptedMbcNames(stderr);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
bool mbc_HasRAM(MbcType type) {
|
bool mbc_HasRAM(MbcType type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ROM_RAM:
|
case ROM_RAM:
|
||||||
@@ -241,7 +241,7 @@ MbcType mbc_ParseName(char const *name, uint8_t &tpp1Major, uint8_t &tpp1Minor)
|
|||||||
char const *fullName = name;
|
char const *fullName = name;
|
||||||
|
|
||||||
if (!strcasecmp(name, "help") || !strcasecmp(name, "list")) {
|
if (!strcasecmp(name, "help") || !strcasecmp(name, "list")) {
|
||||||
mbc_PrintAcceptedNames(stdout);
|
printAcceptedMbcNames(stdout);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,12 @@ void resetErrors() {
|
|||||||
nbErrors = 0;
|
nbErrors = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool anyErrors() {
|
||||||
|
return nbErrors > 0;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t checkErrors(char const *filename) {
|
uint32_t checkErrors(char const *filename) {
|
||||||
if (nbErrors > 0) {
|
if (anyErrors()) {
|
||||||
fprintf(
|
fprintf(
|
||||||
stderr,
|
stderr,
|
||||||
"Fixing \"%s\" failed with %u error%s\n",
|
"Fixing \"%s\" failed with %u error%s\n",
|
||||||
|
|||||||
Reference in New Issue
Block a user