Make some changes noticed while porting to C++

This commit is contained in:
Rangi42
2023-11-05 16:08:07 -05:00
committed by Eldred Habert
parent 6ac1dd8966
commit 02f9128d07
19 changed files with 72 additions and 61 deletions

View File

@@ -122,9 +122,8 @@ void charmap_Set(char const *name)
void charmap_Push(void)
{
struct CharmapStackEntry *stackEntry;
struct CharmapStackEntry *stackEntry = malloc(sizeof(*stackEntry));
stackEntry = malloc(sizeof(*stackEntry));
if (stackEntry == NULL)
fatalerror("Failed to alloc charmap stack entry: %s\n", strerror(errno));

View File

@@ -386,7 +386,7 @@ static void changeSection(void)
}
// Set the current section by name and type
void sect_NewSection(char const *name, uint32_t type, uint32_t org,
void sect_NewSection(char const *name, enum SectionType type, uint32_t org,
struct SectionSpec const *attribs, enum SectionModifier mod)
{
if (currentLoadSection)
@@ -406,7 +406,7 @@ void sect_NewSection(char const *name, uint32_t type, uint32_t org,
}
// Set the current section by name and type
void sect_SetLoadSection(char const *name, uint32_t type, uint32_t org,
void sect_SetLoadSection(char const *name, enum SectionType type, uint32_t org,
struct SectionSpec const *attribs, enum SectionModifier mod)
{
// Important info: currently, UNION and LOAD cannot interact, since UNION is prohibited in

View File

@@ -260,7 +260,7 @@ void processWarningFlag(char *flag)
// Not an error, then check if this is a negation
strncmp(flag, "no-", strlen("no-")) ? WARNING_ENABLED
: WARNING_DISABLED;
char const *rootFlag = state == WARNING_DISABLED ? flag + strlen("no-") : flag;
char *rootFlag = state == WARNING_DISABLED ? flag + strlen("no-") : flag;
// Is this a "parametric" warning?
if (state != WARNING_DISABLED) { // The `no-` form cannot be parametrized