mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Run clang-format
This commit is contained in:
@@ -72,7 +72,7 @@ void charmap_New(std::string const &name, std::string const *baseName) {
|
||||
Charmap &charmap = charmapList.emplace_back();
|
||||
|
||||
if (baseIdx != (size_t)-1) {
|
||||
charmap.nodes = charmapList[baseIdx].nodes; // Copies `charmapList[baseIdx].nodes`
|
||||
charmap.nodes = charmapList[baseIdx].nodes; // Copies `charmapList[baseIdx].nodes`
|
||||
charmap.mappings = charmapList[baseIdx].mappings; // Copies `charmapList[baseIdx].mappings`
|
||||
} else {
|
||||
charmap.nodes.emplace_back(); // Zero-init the root node
|
||||
|
||||
@@ -264,7 +264,7 @@ int main(int argc, char *argv[]) {
|
||||
: !strcasecmp(feature, "equs") ? STATE_EQUS
|
||||
: !strcasecmp(feature, "char") ? STATE_CHAR
|
||||
: !strcasecmp(feature, "macro") ? STATE_MACRO
|
||||
: NB_STATE_FEATURES;
|
||||
: NB_STATE_FEATURES;
|
||||
if (value == NB_STATE_FEATURES) {
|
||||
errx("Invalid feature for option 's': \"%s\"", feature);
|
||||
} else if (std::find(RANGE(features), value) != features.end()) {
|
||||
|
||||
@@ -76,11 +76,11 @@ void sect_CheckSizes() {
|
||||
for (Section const § : sectionList) {
|
||||
if (uint32_t maxSize = sectionTypeInfo[sect.type].size; sect.size > maxSize)
|
||||
error(
|
||||
"Section '%s' grew too big (max size = 0x%" PRIX32 " bytes, reached 0x%" PRIX32
|
||||
").\n",
|
||||
sect.name.c_str(),
|
||||
maxSize,
|
||||
sect.size
|
||||
"Section '%s' grew too big (max size = 0x%" PRIX32 " bytes, reached 0x%" PRIX32
|
||||
").\n",
|
||||
sect.name.c_str(),
|
||||
maxSize,
|
||||
sect.size
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -837,8 +837,7 @@ void sect_BinaryFile(std::string const &name, int32_t startPos) {
|
||||
while (startPos--) {
|
||||
if (fgetc(file) == EOF) {
|
||||
error(
|
||||
"Specified start position is greater than length of file '%s'\n",
|
||||
name.c_str()
|
||||
"Specified start position is greater than length of file '%s'\n", name.c_str()
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -908,8 +907,7 @@ void sect_BinaryFileSlice(std::string const &name, int32_t startPos, int32_t len
|
||||
while (startPos--) {
|
||||
if (fgetc(file) == EOF) {
|
||||
error(
|
||||
"Specified start position is greater than length of file '%s'\n",
|
||||
name.c_str()
|
||||
"Specified start position is greater than length of file '%s'\n", name.c_str()
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -750,7 +750,7 @@ public:
|
||||
if (options.allowMirroringX) {
|
||||
// Count the line itself as mirrorred horizontally; vertical mirroring is already
|
||||
// taken care of because the symmetric line will be XOR'd the same way.
|
||||
// (...this reduces the hash's efficiency, but seems benign with most real-world data.)
|
||||
// (This reduces the hash's efficiency, but seems benign with most real-world data.)
|
||||
_hash ^= flipTable[bitplanes >> 8] << 8 | flipTable[bitplanes & 0xFF];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,8 +183,7 @@ static ssize_t getPlacement(Section const §ion, MemoryLocation &location) {
|
||||
location.bank = scrambleROMX + 1;
|
||||
else
|
||||
return -1;
|
||||
} else if (scrambleWRAMX && section.type == SECTTYPE_WRAMX
|
||||
&& location.bank <= scrambleWRAMX) {
|
||||
} else if (scrambleWRAMX && section.type == SECTTYPE_WRAMX && location.bank <= scrambleWRAMX) {
|
||||
if (location.bank > typeInfo.firstBank)
|
||||
location.bank--;
|
||||
else if (scrambleWRAMX < typeInfo.lastBank)
|
||||
@@ -237,8 +236,9 @@ static void placeSection(Section §ion) {
|
||||
assignSection(section, location);
|
||||
|
||||
// Update the free space
|
||||
uint16_t sectionEnd = section.org + section.size;
|
||||
bool noLeftSpace = freeSpace.address == section.org;
|
||||
bool noRightSpace = freeSpace.address + freeSpace.size == section.org + section.size;
|
||||
bool noRightSpace = freeSpace.address + freeSpace.size == sectionEnd;
|
||||
if (noLeftSpace && noRightSpace) {
|
||||
// The free space is entirely deleted
|
||||
bankMem.erase(bankMem.begin() + spaceIdx);
|
||||
@@ -247,12 +247,11 @@ static void placeSection(Section §ion) {
|
||||
// Append the new space after the original one
|
||||
bankMem.insert(
|
||||
bankMem.begin() + spaceIdx + 1,
|
||||
{.address = (uint16_t)(section.org + section.size),
|
||||
.size = (uint16_t)(freeSpace.address + freeSpace.size - section.org - section.size)
|
||||
}
|
||||
{.address = sectionEnd,
|
||||
.size = (uint16_t)(freeSpace.address + freeSpace.size - sectionEnd)}
|
||||
);
|
||||
// **`freeSpace` cannot be reused from this point on**, because `bankMem.insert`
|
||||
// invalidates all references to itself!
|
||||
// **`freeSpace` cannot be reused from this point on, because `bankMem.insert`
|
||||
// invalidates all references to itself!**
|
||||
|
||||
// Resize the original space (address is unmodified)
|
||||
bankMem[spaceIdx].size = section.org - bankMem[spaceIdx].address;
|
||||
|
||||
@@ -625,7 +625,8 @@ void obj_ReadFile(char const *fileName, unsigned int fileID) {
|
||||
Label &label = fileSymbols[i].data.get<Label>();
|
||||
if (Section *section = label.section; section->modifier != SECTION_NORMAL) {
|
||||
if (section->modifier == SECTION_FRAGMENT) {
|
||||
// Add the fragment's offset to the symbol's (`section->offset` is computed by `sect_AddSection`)
|
||||
// Add the fragment's offset to the symbol's
|
||||
// (`section->offset` is computed by `sect_AddSection`)
|
||||
label.offset += section->offset;
|
||||
}
|
||||
// Associate the symbol with the main section, not the "component" one
|
||||
|
||||
@@ -880,7 +880,8 @@ void sdobj_ReadFile(FileStackNode const &where, FILE *file, std::vector<Symbol>
|
||||
Label &label = sym.data.get<Label>();
|
||||
if (Section *section = label.section; section->modifier != SECTION_NORMAL) {
|
||||
if (section->modifier == SECTION_FRAGMENT) {
|
||||
// Add the fragment's offset to the symbol's (`section->offset` is computed by `sect_AddSection`)
|
||||
// Add the fragment's offset to the symbol's
|
||||
// (`section->offset` is computed by `sect_AddSection`)
|
||||
label.offset += section->offset;
|
||||
}
|
||||
// Associate the symbol with the main section, not the "component" one
|
||||
|
||||
@@ -231,7 +231,12 @@ static void doSanityChecks(Section §ion) {
|
||||
if (section.type < 0 || section.type >= SECTTYPE_INVALID) {
|
||||
// This is trapped early in RGBDS objects (because then the format is not parseable),
|
||||
// which leaves SDAS objects.
|
||||
error(nullptr, 0, "Section \"%s\" has not been assigned a type by a linker script", section.name.c_str());
|
||||
error(
|
||||
nullptr,
|
||||
0,
|
||||
"Section \"%s\" has not been assigned a type by a linker script",
|
||||
section.name.c_str()
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user