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

@@ -156,7 +156,7 @@ FILE *openFile(char const *fileName, char const *mode)
file = fdopen(STDOUT_FILENO, mode);
if (!file)
err("Could not open file \"%s\"", fileName);
err("Failed to open file \"%s\"", fileName);
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
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',
// 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));
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);
fileSymbols[i] = symbol;
@@ -570,7 +570,7 @@ void obj_ReadFile(char const *fileName, unsigned int fileID)
// Read section
fileSections[i] = (struct Section *)malloc(sizeof(*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;
readSection(file, fileSections[i], fileName, nodes[fileID].nodes);
@@ -579,8 +579,7 @@ void obj_ReadFile(char const *fileName, unsigned int fileID)
fileSections[i]->symbols =
(struct Symbol **)malloc(nbSymPerSect[i] * sizeof(*fileSections[i]->symbols));
if (!fileSections[i]->symbols)
err("%s: Couldn't link to symbols",
fileName);
err("%s: Failed to link to symbols", fileName);
} else {
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));
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);
linkPatchToPCSect(&assertion->patch, fileSections);
assertion->fileSymbols = fileSymbols;

View File

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

View File

@@ -132,7 +132,7 @@ static void includeFile(std::string &&path) {
if (!newContext.file.open(newContext.path, std::ios_base::in)) {
// 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());
++prevContext.lineNo;
lexerStack.pop_back();
@@ -574,7 +574,7 @@ void script_ProcessScript(char const *path) {
auto &newContext = lexerStack.emplace_back(std::string(path));
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();
} else {
yy::parser linkerScriptParser;

View File

@@ -370,7 +370,7 @@ void sdobj_ReadFile(struct FileStackNode const *where, FILE *file) {
if (!newFileSymbols)
fatal(where, lineNo, "Failed to alloc extra symbols: %s", strerror(errno));
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
}
#define symbol (fileSymbols[nbSymbols])