Use a patch_AddAssertion function instead of extern assertions

This commit is contained in:
Rangi42
2025-07-21 17:49:41 -04:00
parent a0e23ee911
commit 0cd60ea1e6
4 changed files with 23 additions and 10 deletions

View File

@@ -3,6 +3,23 @@
#ifndef RGBDS_LINK_PATCH_HPP
#define RGBDS_LINK_PATCH_HPP
#include <string>
#include <vector>
#include "link/section.hpp"
struct Symbol;
struct Assertion {
Patch patch; // Also used for its `.type`
std::string message;
// This would be redundant with `patch.pcSection->fileSymbols`, but `section` is sometimes
// `nullptr`!
std::vector<Symbol> *fileSymbols;
};
Assertion &patch_AddAssertion();
// Checks all assertions
void patch_CheckAssertions();

View File

@@ -56,15 +56,6 @@ struct Section {
std::unique_ptr<Section> nextu; // The next "component" of this unionized sect
};
struct Assertion {
Patch patch; // Also used for its `.type`
std::string message;
// This would be redundant with `.section->fileSymbols`, but `section` is sometimes `nullptr`!
std::vector<Symbol> *fileSymbols;
};
extern std::deque<Assertion> assertions;
// Execute a callback for each section currently registered.
// This is to avoid exposing the data structure in which sections are stored.
void sect_ForEach(void (*callback)(Section &));