Phrase error messages as "Failed to", not "Could not" or "Couldn't" (#1298)

This commit is contained in:
Sylvie
2024-02-18 08:52:31 -05:00
committed by GitHub
parent ef0d973187
commit d71a161bc9
12 changed files with 20 additions and 21 deletions

View File

@@ -259,7 +259,7 @@ int main(int argc, char *argv[])
dependFileName = musl_optarg; dependFileName = musl_optarg;
} }
if (dependfile == NULL) if (dependfile == NULL)
err("Could not open dependfile %s", dependFileName); err("Failed to open dependfile %s", dependFileName);
break; break;
case 'o': case 'o':

View File

@@ -655,7 +655,7 @@ void sym_Init(time_t now)
#endif #endif
if (now == (time_t)-1) { if (now == (time_t)-1) {
warn("Couldn't determine current time"); warn("Failed to determine current time");
// Fall back by pretending we are at the Epoch // Fall back by pretending we are at the Epoch
now = 0; now = 0;
} }

View File

@@ -468,7 +468,7 @@ static void parseACOFile(std::filebuf &file) {
char buf[10]; char buf[10];
if (file.sgetn(buf, 2) != 2) { if (file.sgetn(buf, 2) != 2) {
error("Couldn't read ACO file version"); error("Failed to read ACO file version");
return; return;
} }
if (readBE<uint16_t>(buf) != 1) { if (readBE<uint16_t>(buf) != 1) {
@@ -477,7 +477,7 @@ static void parseACOFile(std::filebuf &file) {
} }
if (file.sgetn(buf, 2) != 2) { if (file.sgetn(buf, 2) != 2) {
error("Couldn't read number of colors in palette file"); error("Failed to read number of colors in palette file");
return; return;
} }
uint16_t nbColors = readBE<uint16_t>(buf); uint16_t nbColors = readBE<uint16_t>(buf);

View File

@@ -606,7 +606,7 @@ static std::tuple<DefaultInitVec<size_t>, std::vector<Palette>>
if (iter == palettes.end()) { if (iter == palettes.end()) {
assert(!protoPal.empty()); assert(!protoPal.empty());
error("Could not fit tile colors [%s] in specified palettes", listColors(protoPal)); error("Failed to fit tile colors [%s] in specified palettes", listColors(protoPal));
bad = true; bad = true;
} }
mappings[i] = iter - palettes.begin(); // Bogus value, but whatever mappings[i] = iter - palettes.begin(); // Bogus value, but whatever

View File

@@ -246,11 +246,11 @@ void reverse() {
const_cast<png_voidp>(static_cast<void const *>(pngFile.c_str(options.input))), pngError, const_cast<png_voidp>(static_cast<void const *>(pngFile.c_str(options.input))), pngError,
pngWarning); pngWarning);
if (!png) { if (!png) {
fatal("Couldn't create PNG write struct: %s", strerror(errno)); fatal("Failed to create PNG write struct: %s", strerror(errno));
} }
png_infop pngInfo = png_create_info_struct(png); png_infop pngInfo = png_create_info_struct(png);
if (!pngInfo) { if (!pngInfo) {
fatal("Couldn't create PNG info struct: %s", strerror(errno)); fatal("Failed to create PNG info struct: %s", strerror(errno));
} }
png_set_write_fn(png, &pngFile, writePng, flushPng); png_set_write_fn(png, &pngFile, writePng, flushPng);

View File

@@ -156,7 +156,7 @@ FILE *openFile(char const *fileName, char const *mode)
file = fdopen(STDOUT_FILENO, mode); file = fdopen(STDOUT_FILENO, mode);
if (!file) if (!file)
err("Could not open file \"%s\"", fileName); err("Failed to open file \"%s\"", fileName);
return file; return file;
} }

View File

@@ -452,7 +452,7 @@ void obj_ReadFile(char const *fileName, unsigned int fileID)
file = fdopen(STDIN_FILENO, "rb"); // `stdin` is in text mode by default file = fdopen(STDIN_FILENO, "rb"); // `stdin` is in text mode by default
if (!file) if (!file)
err("Could not open file %s", fileName); err("Failed to open file %s", fileName);
// First, check if the object is a RGBDS object or a SDCC one. If the first byte is 'R', // First, check if the object is a RGBDS object or a SDCC one. If the first byte is 'R',
// we'll assume it's a RGBDS object file, and otherwise, that it's a SDCC object file. // we'll assume it's a RGBDS object file, and otherwise, that it's a SDCC object file.
@@ -551,7 +551,7 @@ void obj_ReadFile(char const *fileName, unsigned int fileID)
struct Symbol *symbol = (struct Symbol *)malloc(sizeof(*symbol)); struct Symbol *symbol = (struct Symbol *)malloc(sizeof(*symbol));
if (!symbol) if (!symbol)
err("%s: Couldn't create new symbol", fileName); err("%s: Failed to create new symbol", fileName);
readSymbol(file, symbol, fileName, nodes[fileID].nodes); readSymbol(file, symbol, fileName, nodes[fileID].nodes);
fileSymbols[i] = symbol; fileSymbols[i] = symbol;
@@ -570,7 +570,7 @@ void obj_ReadFile(char const *fileName, unsigned int fileID)
// Read section // Read section
fileSections[i] = (struct Section *)malloc(sizeof(*fileSections[i])); fileSections[i] = (struct Section *)malloc(sizeof(*fileSections[i]));
if (!fileSections[i]) if (!fileSections[i])
err("%s: Couldn't create new section", fileName); err("%s: Failed to create new section", fileName);
fileSections[i]->nextu = NULL; fileSections[i]->nextu = NULL;
readSection(file, fileSections[i], fileName, nodes[fileID].nodes); readSection(file, fileSections[i], fileName, nodes[fileID].nodes);
@@ -579,8 +579,7 @@ void obj_ReadFile(char const *fileName, unsigned int fileID)
fileSections[i]->symbols = fileSections[i]->symbols =
(struct Symbol **)malloc(nbSymPerSect[i] * sizeof(*fileSections[i]->symbols)); (struct Symbol **)malloc(nbSymPerSect[i] * sizeof(*fileSections[i]->symbols));
if (!fileSections[i]->symbols) if (!fileSections[i]->symbols)
err("%s: Couldn't link to symbols", err("%s: Failed to link to symbols", fileName);
fileName);
} else { } else {
fileSections[i]->symbols = NULL; fileSections[i]->symbols = NULL;
} }
@@ -630,7 +629,7 @@ void obj_ReadFile(char const *fileName, unsigned int fileID)
struct Assertion *assertion = (struct Assertion *)malloc(sizeof(*assertion)); struct Assertion *assertion = (struct Assertion *)malloc(sizeof(*assertion));
if (!assertion) if (!assertion)
err("%s: Couldn't create new assertion", fileName); err("%s: Failed to create new assertion", fileName);
readAssertion(file, assertion, fileName, i, nodes[fileID].nodes); readAssertion(file, assertion, fileName, i, nodes[fileID].nodes);
linkPatchToPCSect(&assertion->patch, fileSections); linkPatchToPCSect(&assertion->patch, fileSections);
assertion->fileSymbols = fileSymbols; assertion->fileSymbols = fileSymbols;

View File

@@ -485,7 +485,7 @@ void patch_CheckAssertions(struct Assertion *assert)
} }
} else if (isError && type == ASSERT_FATAL) { } else if (isError && type == ASSERT_FATAL) {
fatal(assert->patch.src, assert->patch.lineNo, fatal(assert->patch.src, assert->patch.lineNo,
"couldn't evaluate assertion%s%s", "Failed to evaluate assertion%s%s",
assert->message[0] ? ": " : "", assert->message[0] ? ": " : "",
assert->message); assert->message);
} }

View File

@@ -132,7 +132,7 @@ static void includeFile(std::string &&path) {
if (!newContext.file.open(newContext.path, std::ios_base::in)) { if (!newContext.file.open(newContext.path, std::ios_base::in)) {
// The order is important: report the error, increment the line number, modify the stack! // The order is important: report the error, increment the line number, modify the stack!
scriptError(prevContext, "Could not open included linker script \"%s\"", scriptError(prevContext, "Failed to open included linker script \"%s\"",
newContext.path.c_str()); newContext.path.c_str());
++prevContext.lineNo; ++prevContext.lineNo;
lexerStack.pop_back(); lexerStack.pop_back();
@@ -574,7 +574,7 @@ void script_ProcessScript(char const *path) {
auto &newContext = lexerStack.emplace_back(std::string(path)); auto &newContext = lexerStack.emplace_back(std::string(path));
if (!newContext.file.open(newContext.path, std::ios_base::in)) { if (!newContext.file.open(newContext.path, std::ios_base::in)) {
error(NULL, 0, "Could not open linker script \"%s\"", newContext.path.c_str()); error(NULL, 0, "Failed to open linker script \"%s\"", newContext.path.c_str());
lexerStack.clear(); lexerStack.clear();
} else { } else {
yy::parser linkerScriptParser; yy::parser linkerScriptParser;

View File

@@ -370,7 +370,7 @@ void sdobj_ReadFile(struct FileStackNode const *where, FILE *file) {
if (!newFileSymbols) if (!newFileSymbols)
fatal(where, lineNo, "Failed to alloc extra symbols: %s", strerror(errno)); fatal(where, lineNo, "Failed to alloc extra symbols: %s", strerror(errno));
if (newFileSymbols != fileSymbols) if (newFileSymbols != fileSymbols)
fatal(where, lineNo, "Couldn't handle extra 'S' lines (pointer moved)"); fatal(where, lineNo, "Failed to handle extra 'S' lines (pointer moved)");
// No need to assign, obviously // No need to assign, obviously
} }
#define symbol (fileSymbols[nbSymbols]) #define symbol (fileSymbols[nbSymbols])

View File

@@ -1,5 +1,5 @@
error: Could not fit tile colors [$6c8a, $7f55, $7fff] in specified palettes error: Failed to fit tile colors [$6c8a, $7f55, $7fff] in specified palettes
error: Could not fit tile colors [$6c8a, $7f55] in specified palettes error: Failed to fit tile colors [$6c8a, $7f55] in specified palettes
note: The following palettes were specified: note: The following palettes were specified:
[$7fff, $7f55] [$7fff, $7f55]
[$7fff, $6c8a] [$7fff, $6c8a]

View File

@@ -1,3 +1,3 @@
error: cascading-errors-fatal-assert.asm(1): Unknown symbol "UnknownSymbol" error: cascading-errors-fatal-assert.asm(1): Unknown symbol "UnknownSymbol"
FATAL: cascading-errors-fatal-assert.asm(1): couldn't evaluate assertion FATAL: cascading-errors-fatal-assert.asm(1): Failed to evaluate assertion
Linking aborted after 2 errors Linking aborted after 2 errors