mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-24 20:12:07 +00:00
Run clang-format
This commit is contained in:
@@ -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