mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-21 02:32:06 +00:00
Refactor warnings and errors (#1728)
* Remove `err` and `warn`, keep `errx` and `warnx`, using them in RGBGFX too * Separate RGBGFX and RGBLINK warnings/errors from main options * Separate `report` function into `error` and `fatal` messages * Implicit newlines for most RGBASM errors
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <deque>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -20,6 +21,7 @@
|
||||
#include "link/main.hpp"
|
||||
#include "link/section.hpp"
|
||||
#include "link/symbol.hpp"
|
||||
#include "link/warning.hpp"
|
||||
|
||||
static constexpr size_t BANK_SIZE = 0x4000;
|
||||
|
||||
@@ -211,7 +213,7 @@ static void writeROM() {
|
||||
outputFile = stdout;
|
||||
}
|
||||
if (!outputFile) {
|
||||
err("Failed to open output file \"%s\"", outputFileName);
|
||||
errx("Failed to open output file \"%s\": %s", outputFileName, strerror(errno));
|
||||
}
|
||||
}
|
||||
Defer closeOutputFile{[&] {
|
||||
@@ -229,7 +231,7 @@ static void writeROM() {
|
||||
overlayFile = stdin;
|
||||
}
|
||||
if (!overlayFile) {
|
||||
err("Failed to open overlay file \"%s\"", overlayFileName);
|
||||
errx("Failed to open overlay file \"%s\": %s", overlayFileName, strerror(errno));
|
||||
}
|
||||
}
|
||||
Defer closeOverlayFile{[&] {
|
||||
@@ -572,7 +574,7 @@ static void writeSym() {
|
||||
symFile = stdout;
|
||||
}
|
||||
if (!symFile) {
|
||||
err("Failed to open sym file \"%s\"", symFileName);
|
||||
errx("Failed to open sym file \"%s\": %s", symFileName, strerror(errno));
|
||||
}
|
||||
Defer closeSymFile{[&] { fclose(symFile); }};
|
||||
|
||||
@@ -623,7 +625,7 @@ static void writeMap() {
|
||||
mapFile = stdout;
|
||||
}
|
||||
if (!mapFile) {
|
||||
err("Failed to open map file \"%s\"", mapFileName);
|
||||
errx("Failed to open map file \"%s\": %s", mapFileName, strerror(errno));
|
||||
}
|
||||
Defer closeMapFile{[&] { fclose(mapFile); }};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user