Remove now-unnecessary enum keyword (#1338)

C++ does not need it
This commit is contained in:
Sylvie
2024-03-08 19:40:41 -05:00
committed by GitHub
parent 1b97297d63
commit 53537cf9af
27 changed files with 95 additions and 127 deletions

View File

@@ -38,7 +38,7 @@ uint64_t nbSectionsToAssign;
// Init the free space-modelling structs
static void initFreeSpace() {
for (enum SectionType type : EnumSeq(SECTTYPE_INVALID)) {
for (SectionType type : EnumSeq(SECTTYPE_INVALID)) {
memory[type].resize(nbbanks(type));
for (std::deque<FreeSpace> &bankMem : memory[type]) {
bankMem.push_back({

View File

@@ -238,7 +238,7 @@ static void parseScrambleSpec(char const *spec) {
size_t regionNameLen = strcspn(spec, "=, \t");
// Length of region name string slice for printing, truncated if too long
int regionNamePrintLen = regionNameLen > INT_MAX ? INT_MAX : (int)regionNameLen;
enum ScrambledRegion region = SCRAMBLE_UNK;
ScrambledRegion region = SCRAMBLE_UNK;
// If this trips, `spec` must be pointing at a ',' or '=' (or NUL) due to the assert
if (regionNameLen == 0) {
@@ -262,7 +262,7 @@ static void parseScrambleSpec(char const *spec) {
}
// Now, determine which region type this is
for (enum ScrambledRegion r : EnumSeq(SCRAMBLE_UNK)) {
for (ScrambledRegion r : EnumSeq(SCRAMBLE_UNK)) {
// If the strings match (case-insensitively), we got it!
// `strncasecmp` must be used here since `regionName` points
// to the entire remaining argument.

View File

@@ -135,7 +135,7 @@ static void readFileStackNode(
node.lineNo, file, "%s: Cannot read node #%" PRIu32 "'s line number: %s", fileName, i
);
tryGetc(
enum FileStackNodeType,
FileStackNodeType,
node.type,
file,
"%s: Cannot read node #%" PRIu32 "'s type: %s",
@@ -186,7 +186,7 @@ static void readSymbol(
) {
tryReadstring(symbol.name, file, "%s: Cannot read symbol name: %s", fileName);
tryGetc(
enum ExportLevel,
ExportLevel,
symbol.type,
file,
"%s: Cannot read \"%s\"'s type: %s",
@@ -250,7 +250,7 @@ static void readPatch(
std::vector<FileStackNode> const &fileNodes
) {
uint32_t nodeID, rpnSize;
enum PatchType type;
PatchType type;
tryReadlong(
nodeID,
@@ -294,7 +294,7 @@ static void readPatch(
i
);
tryGetc(
enum PatchType,
PatchType,
type,
file,
"%s: Unable to read \"%s\"'s patch #%" PRIu32 "'s type: %s",
@@ -354,7 +354,7 @@ static void readSection(
tryGetc(
uint8_t, byte, file, "%s: Cannot read \"%s\"'s type: %s", fileName, section.name.c_str()
);
section.type = (enum SectionType)(byte & 0x3F);
section.type = (SectionType)(byte & 0x3F);
if (byte >> 7)
section.modifier = SECTION_UNION;
else if (byte >> 6)

View File

@@ -41,7 +41,7 @@ struct SortedSections {
static std::deque<SortedSections> sections[SECTTYPE_INVALID];
// Defines the order in which types are output to the sym and map files
static enum SectionType typeMap[SECTTYPE_INVALID] = {
static SectionType typeMap[SECTTYPE_INVALID] = {
SECTTYPE_ROM0,
SECTTYPE_ROMX,
SECTTYPE_VRAM,
@@ -315,7 +315,7 @@ static int compareSymbols(SortedSymbol const &sym1, SortedSymbol const &sym2) {
* Write a bank's contents to the sym file
* @param bankSections The bank's sections
*/
static void writeSymBank(SortedSections const &bankSections, enum SectionType type, uint32_t bank) {
static void writeSymBank(SortedSections const &bankSections, SectionType type, uint32_t bank) {
#define forEachSortedSection(sect, ...) \
do { \
for (auto it = bankSections.zeroLenSections.begin(); \
@@ -383,7 +383,7 @@ static void writeEmptySpace(uint16_t begin, uint16_t end) {
/*
* Write a bank's contents to the map file
*/
static void writeMapBank(SortedSections const &sectList, enum SectionType type, uint32_t bank) {
static void writeMapBank(SortedSections const &sectList, SectionType type, uint32_t bank) {
fprintf(
mapFile,
"\n%s bank #%" PRIu32 ":\n",
@@ -474,7 +474,7 @@ static void writeMapSummary() {
fputs("SUMMARY:\n", mapFile);
for (uint8_t i = 0; i < SECTTYPE_INVALID; i++) {
enum SectionType type = typeMap[i];
SectionType type = typeMap[i];
uint32_t nbBanks = sections[type].size();
// Do not output used space for VRAM or OAM
@@ -539,7 +539,7 @@ static void writeSym() {
fputs("; File generated by rgblink\n", symFile);
for (uint8_t i = 0; i < SECTTYPE_INVALID; i++) {
enum SectionType type = typeMap[i];
SectionType type = typeMap[i];
for (uint32_t bank = 0; bank < sections[type].size(); bank++)
writeSymBank(sections[type][bank], type, bank);
@@ -565,7 +565,7 @@ static void writeMap() {
writeMapSummary();
for (uint8_t i = 0; i < SECTTYPE_INVALID; i++) {
enum SectionType type = typeMap[i];
SectionType type = typeMap[i];
for (uint32_t bank = 0; bank < sections[type].size(); bank++)
writeMapBank(sections[type][bank], type, bank);

View File

@@ -75,15 +75,13 @@ static Symbol const *getSymbol(std::vector<Symbol> const &symbolList, uint32_t i
* errors caused by the value should be suppressed.
*/
static int32_t computeRPNExpr(Patch const &patch, std::vector<Symbol> const &fileSymbols) {
uint8_t const *expression = patch.rpnExpression.data();
int32_t size = (int32_t)patch.rpnExpression.size();
rpnStack.clear();
while (size > 0) {
enum RPNCommand command =
(enum RPNCommand)getRPNByte(expression, size, patch);
RPNCommand command = (RPNCommand)getRPNByte(expression, size, patch);
int32_t value;
isError = false;
@@ -418,7 +416,7 @@ void patch_CheckAssertions(std::deque<Assertion> &assertions) {
for (Assertion &assert : assertions) {
int32_t value = computeRPNExpr(assert.patch, *assert.fileSymbols);
enum AssertionType type = (enum AssertionType)assert.patch.type;
AssertionType type = (AssertionType)assert.patch.type;
if (!isError && !value) {
switch (type) {

View File

@@ -77,7 +77,7 @@ retry:
}
}
static uint32_t readNumber(char const *str, char const *&endptr, enum NumberType base) {
static uint32_t readNumber(char const *str, char const *&endptr, NumberType base) {
uint32_t res = 0;
for (;;) {
@@ -93,9 +93,8 @@ static uint32_t readNumber(char const *str, char const *&endptr, enum NumberType
}
}
static uint32_t parseNumber(
FileStackNode const &where, uint32_t lineNo, char const *str, enum NumberType base
) {
static uint32_t
parseNumber(FileStackNode const &where, uint32_t lineNo, char const *str, NumberType base) {
if (str[0] == '\0')
fatal(&where, lineNo, "Expected number, got empty string");
@@ -108,7 +107,7 @@ static uint32_t parseNumber(
}
static uint8_t
parseByte(FileStackNode const &where, uint32_t lineNo, char const *str, enum NumberType base) {
parseByte(FileStackNode const &where, uint32_t lineNo, char const *str, NumberType base) {
uint32_t num = parseNumber(where, lineNo, str, base);
if (num > UINT8_MAX)
@@ -173,7 +172,7 @@ void sdobj_ReadFile(FileStackNode const &where, FILE *file, std::vector<Symbol>
uint32_t lineNo = 0;
int lineType = nextLine(line, lineNo, where, file);
enum NumberType numberType;
NumberType numberType;
// The first letter (thus, the line type) identifies the integer type
switch (lineType) {

View File

@@ -139,7 +139,7 @@ static void checkFragmentCompat(Section &target, Section &other) {
}
}
static void mergeSections(Section &target, Section &other, enum SectionModifier mod) {
static void mergeSections(Section &target, Section &other, SectionModifier mod) {
// Common checks
if (target.type != other.type)