Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miscellaneous refactoring #1658

Merged
merged 2 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions include/asm/rpn.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,6 @@ struct Expression {
std::vector<uint8_t> rpn{}; // Bytes serializing the RPN expression
uint32_t rpnPatchSize = 0; // Size the expression will take in the object file

Expression() = default;
Expression(Expression &&) = default;
#ifdef _MSC_VER
// MSVC and WinFlexBison won't build without this...
Expression(Expression const &) = default;
#endif

Expression &operator=(Expression &&) = default;

bool isKnown() const { return data.holds<int32_t>(); }
int32_t value() const { return data.get<int32_t>(); }

Expand Down
10 changes: 5 additions & 5 deletions include/asm/section.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ void sect_ByteString(std::vector<int32_t> const &string);
void sect_WordString(std::vector<int32_t> const &string);
void sect_LongString(std::vector<int32_t> const &string);
void sect_Skip(uint32_t skip, bool ds);
void sect_RelByte(Expression &expr, uint32_t pcShift);
void sect_RelBytes(uint32_t n, std::vector<Expression> &exprs);
void sect_RelWord(Expression &expr, uint32_t pcShift);
void sect_RelLong(Expression &expr, uint32_t pcShift);
void sect_PCRelByte(Expression &expr, uint32_t pcShift);
void sect_RelByte(Expression const &expr, uint32_t pcShift);
void sect_RelBytes(uint32_t n, std::vector<Expression> const &exprs);
void sect_RelWord(Expression const &expr, uint32_t pcShift);
void sect_RelLong(Expression const &expr, uint32_t pcShift);
void sect_PCRelByte(Expression const &expr, uint32_t pcShift);
void sect_BinaryFile(std::string const &name, int32_t startPos);
void sect_BinaryFileSlice(std::string const &name, int32_t startPos, int32_t length);

Expand Down
9 changes: 0 additions & 9 deletions src/asm/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,6 @@
struct StrFmtArgList {
std::string format;
std::vector<Either<uint32_t, std::string>> args;

StrFmtArgList() = default;
StrFmtArgList(StrFmtArgList &&) = default;
#ifdef _MSC_VER
// MSVC and WinFlexBison won't build without this...
StrFmtArgList(StrFmtArgList const &) = default;
#endif

StrFmtArgList &operator=(StrFmtArgList &&) = default;
};
}

Expand Down
14 changes: 6 additions & 8 deletions src/asm/section.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ void sect_Skip(uint32_t skip, bool ds) {
}

// Output a byte that can be relocatable or constant
void sect_RelByte(Expression &expr, uint32_t pcShift) {
void sect_RelByte(Expression const &expr, uint32_t pcShift) {
if (!requireCodeSection()) {
return;
}
Expand All @@ -782,15 +782,13 @@ void sect_RelByte(Expression &expr, uint32_t pcShift) {
}

// Output several bytes that can be relocatable or constant
void sect_RelBytes(uint32_t n, std::vector<Expression> &exprs) {
void sect_RelBytes(uint32_t n, std::vector<Expression> const &exprs) {
if (!requireCodeSection()) {
return;
}

for (uint32_t i = 0; i < n; i++) {
Expression &expr = exprs[i % exprs.size()];

if (!expr.isKnown()) {
if (Expression const &expr = exprs[i % exprs.size()]; !expr.isKnown()) {
createPatch(PATCHTYPE_BYTE, expr, i);
writeByte(0);
} else {
Expand All @@ -800,7 +798,7 @@ void sect_RelBytes(uint32_t n, std::vector<Expression> &exprs) {
}

// Output a word that can be relocatable or constant
void sect_RelWord(Expression &expr, uint32_t pcShift) {
void sect_RelWord(Expression const &expr, uint32_t pcShift) {
if (!requireCodeSection()) {
return;
}
Expand All @@ -814,7 +812,7 @@ void sect_RelWord(Expression &expr, uint32_t pcShift) {
}

// Output a long that can be relocatable or constant
void sect_RelLong(Expression &expr, uint32_t pcShift) {
void sect_RelLong(Expression const &expr, uint32_t pcShift) {
if (!requireCodeSection()) {
return;
}
Expand All @@ -828,7 +826,7 @@ void sect_RelLong(Expression &expr, uint32_t pcShift) {
}

// Output a PC-relative byte that can be relocatable or constant
void sect_PCRelByte(Expression &expr, uint32_t pcShift) {
void sect_PCRelByte(Expression const &expr, uint32_t pcShift) {
if (!requireCodeSection()) {
return;
}
Expand Down
Loading