Add more tests for RGBASM code coverage (#1257)

* Add more tests for RGBASM code coverage

* Use C++ unnamed parameters, not `(void)` casting

* Fix crash in `sect_AlignPC` from #1253
This commit is contained in:
Rangi
2023-12-01 10:21:43 -05:00
committed by GitHub
parent cee3d1c859
commit 6132b77c1e
85 changed files with 450 additions and 65 deletions

View File

@@ -328,9 +328,8 @@ static struct UnassignedSection *sections;
* @param section The section to categorize
* @param arg Callback arg, unused
*/
static void categorizeSection(struct Section *section, void *arg)
static void categorizeSection(struct Section *section, void *)
{
(void)arg;
uint8_t constraints = 0;
if (section->isBankFixed)

View File

@@ -406,7 +406,6 @@ int main(int argc, char *argv[])
break;
case 's':
// TODO: implement "smart linking" with `-s`
(void)musl_optarg;
warning(NULL, 0, "Nobody has any idea what `-s` does");
break;
case 't':

View File

@@ -669,10 +669,8 @@ static void freeNode(struct FileStackNode *node)
free(node->name);
}
static void freeSection(struct Section *section, void *arg)
static void freeSection(struct Section *section, void *)
{
(void)arg;
do {
struct Section *next = section->nextu;

View File

@@ -502,8 +502,8 @@ void patch_CheckAssertions(struct Assertion *assert)
/*
* Applies all of a section's patches
* @param section The section to patch
* @param arg Ignored callback arg
* @param section The section component to patch
* @param dataSection The section to patch
*/
static void applyFilePatches(struct Section *section, struct Section *dataSection)
{
@@ -554,23 +554,17 @@ static void applyFilePatches(struct Section *section, struct Section *dataSectio
}
/*
* Applies all of a section's patches, iterating over "components" of
* unionized sections
* Applies all of a section's patches, iterating over "components" of unionized sections
* @param section The section to patch
* @param arg Ignored callback arg
*/
static void applyPatches(struct Section *section, void *arg)
static void applyPatches(struct Section *section, void *)
{
if (!sect_HasData(section->type))
return;
(void)arg;
struct Section *dataSection = section;
do {
applyFilePatches(section, dataSection);
section = section->nextu;
} while (section);
for (struct Section *component = section; component; component = component->nextu)
applyFilePatches(component, section);
}
void patch_ApplyPatches(void)

View File

@@ -219,10 +219,8 @@ void sect_CleanupSections(void)
hash_EmptyMap(sections);
}
static void doSanityChecks(struct Section *section, void *ptr)
static void doSanityChecks(struct Section *section, void *)
{
(void)ptr;
// Sanity check the section's type
if (section->type < 0 || section->type >= SECTTYPE_INVALID) {