mirror of
https://github.com/gbdev/rgbds.git
synced 2026-11-21 21:48:39 +00:00
Remove the unused offset field from Assertions (#2205)
This commit is contained in:
1 parent
17475648cc
commit
fe082e7ff2
6 files changed
+3
-20
No files matched your search
@@ -19,9 +19,7 @@ enum StateFeature { STATE_EQU, STATE_VAR, STATE_EQUS, STATE_CHAR, STATE_MACRO, N
|
||||
void out_RegisterNode(std::shared_ptr<FileStackNode> node);
|
||||
void out_RegisterSymbol(Symbol &sym);
|
||||
void out_CreatePatch(PatchType type, Expression const &expr, uint32_t ofs, uint32_t pcShift);
|
||||
void out_CreateAssert(
|
||||
AssertionType type, Expression const &expr, std::string const &message, uint32_t ofs
|
||||
);
|
||||
void out_CreateAssert(AssertionType type, Expression const &expr, std::string const &message);
|
||||
void out_WriteObject();
|
||||
void out_WriteState(std::string name, std::vector<StateFeature> const &features);
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ struct Symbol;
|
||||
|
||||
struct Assertion {
|
||||
Expression rpn;
|
||||
uint32_t offset;
|
||||
AssertionType type;
|
||||
std::string message;
|
||||
// This would be redundant with `rpn.pcSection->fileSymbols`,
|
||||
|
||||
@@ -275,8 +275,6 @@ Assertions are essentially patches with a message.
|
||||
Context in which the assertions was defined.
|
||||
.It Cm LONG Ar LineNo
|
||||
Line number in the context at which the assertion was defined.
|
||||
.It Cm LONG Ar Offset
|
||||
Unused leftover from the patch structure.
|
||||
.It Cm LONG Ar PCSectionID
|
||||
ID of the section in which PC is located.
|
||||
.It Cm LONG Ar PCOffset
|
||||
|
||||
+1
-1
@@ -126,7 +126,7 @@ void act_Assert(AssertionType type, Expression const &expr, std::string const &m
|
||||
fatal("Assertion messages cannot contain '\\0' characters");
|
||||
}
|
||||
if (!expr.isKnown()) {
|
||||
out_CreateAssert(type, expr, message, sect_GetOutputOffset());
|
||||
out_CreateAssert(type, expr, message);
|
||||
} else if (expr.value() == 0) {
|
||||
failAssert(type, message);
|
||||
}
|
||||
|
||||
+1
-6
@@ -33,7 +33,6 @@
|
||||
struct Assertion {
|
||||
std::shared_ptr<FileStackNode> src;
|
||||
uint32_t lineNo;
|
||||
uint32_t offset;
|
||||
Section *pcSection;
|
||||
uint32_t pcOffset;
|
||||
AssertionType type;
|
||||
@@ -160,16 +159,13 @@ void out_CreatePatch(PatchType type, Expression const &expr, uint32_t ofs, uint3
|
||||
patch.pcOffset -= pcShift;
|
||||
}
|
||||
|
||||
void out_CreateAssert(
|
||||
AssertionType type, Expression const &expr, std::string const &message, uint32_t ofs
|
||||
) {
|
||||
void out_CreateAssert(AssertionType type, Expression const &expr, std::string const &message) {
|
||||
Assertion &assertion = assertions.emplace_front();
|
||||
assertion.type = type;
|
||||
assertion.src = fstk_GetFileStack();
|
||||
// All assertions are assumed to eventually be written, so the file stack node is registered
|
||||
out_RegisterNode(assertion.src);
|
||||
assertion.lineNo = lexer_GetLineNo();
|
||||
assertion.offset = ofs;
|
||||
assertion.pcSection = sect_GetSymbolSection();
|
||||
assertion.pcOffset = sect_GetSymbolOffset();
|
||||
expr.encode(assertion.rpn);
|
||||
@@ -181,7 +177,6 @@ static void writeAssert(Assertion const &assert, FILE *file) {
|
||||
|
||||
putLong(assert.src->ID, file);
|
||||
putLong(assert.lineNo, file);
|
||||
putLong(assert.offset, file);
|
||||
putLong(assert.pcSection ? assert.pcSection->getID() : UINT32_MAX, file);
|
||||
putLong(assert.pcOffset, file);
|
||||
putc(assert.type, file);
|
||||
|
||||
@@ -432,13 +432,6 @@ static void readAssertion(
|
||||
fileName,
|
||||
assertID
|
||||
);
|
||||
tryReadLong(
|
||||
assert.offset,
|
||||
file,
|
||||
"%s: Cannot read assertion #%" PRIu32 "'s offset: %s",
|
||||
fileName,
|
||||
assertID
|
||||
);
|
||||
tryReadLong(
|
||||
assert.rpn.pcSectionID,
|
||||
file,
|
||||
|
||||
Reference in new issue
Block a user