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

@@ -17,7 +17,7 @@ enum FormatState {
};
class FormatSpec {
enum FormatState state;
FormatState state;
int sign;
bool prefix;
bool alignLeft;

View File

@@ -16,7 +16,7 @@
#include "asm/lexer.hpp"
struct FileStackNode {
enum FileStackNodeType type;
FileStackNodeType type;
std::variant<
std::vector<uint32_t>, // NODE_REPT
std::string // NODE_FILE, NODE_MACRO
@@ -39,9 +39,7 @@ struct FileStackNode {
std::string &name();
std::string const &name() const;
FileStackNode(
enum FileStackNodeType type_, std::variant<std::vector<uint32_t>, std::string> data_
)
FileStackNode(FileStackNodeType type_, std::variant<std::vector<uint32_t>, std::string> data_)
: type(type_), data(data_) {};
void dump(uint32_t curLineNo) const;

View File

@@ -67,7 +67,7 @@ struct BufferedLexerState {
struct LexerState {
char const *path;
enum LexerMode mode;
LexerMode mode;
bool atLineStart;
uint32_t lineNo;
uint32_t colNo;
@@ -122,7 +122,7 @@ void lexer_OpenFileView(
void lexer_RestartRept(uint32_t lineNo);
void lexer_CleanupState(LexerState &state);
void lexer_Init();
void lexer_SetMode(enum LexerMode mode);
void lexer_SetMode(LexerMode mode);
void lexer_ToggleStringExpansion(bool enable);
uint32_t lexer_GetIFDepth();

View File

@@ -17,7 +17,7 @@ void out_ReplaceNode(FileStackNode *node);
void out_SetFileName(char *s);
void out_CreatePatch(uint32_t type, Expression const &expr, uint32_t ofs, uint32_t pcShift);
void out_CreateAssert(
enum AssertionType type, Expression const &expr, char const *message, uint32_t ofs
AssertionType type, Expression const &expr, char const *message, uint32_t ofs
);
void out_WriteObject();

View File

@@ -27,9 +27,7 @@ struct Expression {
void rpn_Number(Expression &expr, uint32_t val);
void rpn_Symbol(Expression &expr, char const *symName);
void rpn_LOGNOT(Expression &expr, const Expression &src);
void rpn_BinaryOp(
enum RPNCommand op, Expression &expr, const Expression &src1, const Expression &src2
);
void rpn_BinaryOp(RPNCommand op, Expression &expr, const Expression &src1, const Expression &src2);
void rpn_HIGH(Expression &expr, const Expression &src);
void rpn_LOW(Expression &expr, const Expression &src);
void rpn_ISCONST(Expression &expr, const Expression &src);
@@ -40,8 +38,8 @@ void rpn_BankSection(Expression &expr, char const *sectionName);
void rpn_BankSelf(Expression &expr);
void rpn_SizeOfSection(Expression &expr, char const *sectionName);
void rpn_StartOfSection(Expression &expr, char const *sectionName);
void rpn_SizeOfSectionType(Expression &expr, enum SectionType type);
void rpn_StartOfSectionType(Expression &expr, enum SectionType type);
void rpn_SizeOfSectionType(Expression &expr, SectionType type);
void rpn_StartOfSectionType(Expression &expr, SectionType type);
void rpn_Free(Expression &expr);

View File

@@ -27,8 +27,8 @@ struct Patch {
struct Section {
std::string name;
enum SectionType type;
enum SectionModifier modifier;
SectionType type;
SectionModifier modifier;
FileStackNode const *src; // Where the section was defined
uint32_t fileLine; // Line where the section was defined
uint32_t size;
@@ -53,18 +53,10 @@ extern Section *currentSection;
Section *sect_FindSectionByName(char const *name);
void sect_NewSection(
char const *name,
enum SectionType type,
uint32_t org,
SectionSpec const &attrs,
enum SectionModifier mod
char const *name, SectionType type, uint32_t org, SectionSpec const &attrs, SectionModifier mod
);
void sect_SetLoadSection(
char const *name,
enum SectionType type,
uint32_t org,
SectionSpec const &attrs,
enum SectionModifier mod
char const *name, SectionType type, uint32_t org, SectionSpec const &attrs, SectionModifier mod
);
void sect_EndLoadSection();

View File

@@ -27,7 +27,7 @@ bool sym_IsPC(Symbol const *sym); // For the inline `getSection` method
struct Symbol {
std::string name;
enum SymbolType type;
SymbolType type;
bool isExported; // Whether the symbol is to be exported
bool isBuiltin; // Whether the symbol is a built-in
Section *section;

View File

@@ -54,7 +54,7 @@ enum WarningID {
#define NB_META_WARNINGS (NB_WARNINGS - META_WARNINGS_START)
};
extern enum WarningState warningStates[NB_PLAIN_AND_PARAM_WARNINGS];
extern WarningState warningStates[NB_PLAIN_AND_PARAM_WARNINGS];
extern bool warningsAreErrors;
void processWarningFlag(char const *flag);
@@ -63,7 +63,7 @@ void processWarningFlag(char const *flag);
* Used to warn the user about problems that don't prevent the generation of
* valid code.
*/
void warning(enum WarningID id, char const *fmt, ...) format_(printf, 2, 3);
void warning(WarningID id, char const *fmt, ...) format_(printf, 2, 3);
/*
* Used for errors that compromise the whole assembly process by affecting the

View File

@@ -38,7 +38,7 @@ extern bool disablePadding;
} while (0)
struct FileStackNode {
enum FileStackNodeType type;
FileStackNodeType type;
std::variant<
std::monostate, // Default constructed; `.type` and `.data` must be set manually
std::vector<uint32_t>, // NODE_REPT

View File

@@ -25,7 +25,7 @@ struct Patch {
Section const *pcSection;
uint32_t pcSectionID;
uint32_t pcOffset;
enum PatchType type;
PatchType type;
std::vector<uint8_t> rpnExpression;
};
@@ -34,8 +34,8 @@ struct Section {
std::string name;
uint16_t size;
uint16_t offset;
enum SectionType type;
enum SectionModifier modifier;
SectionType type;
SectionModifier modifier;
bool isAddressFixed;
// This `struct`'s address in ROM.
// Importantly for fragments, this does not include `offset`!

View File

@@ -25,7 +25,7 @@ struct Label {
struct Symbol {
// Info contained in the object files
std::string name;
enum ExportLevel type;
ExportLevel type;
char const *objFileName;
FileStackNode const *src;
int32_t lineNo;

View File

@@ -92,7 +92,7 @@ extern struct SectionTypeInfo {
* @param type The section's type
* @return `true` if the section's definition includes data
*/
static inline bool sect_HasData(enum SectionType type) {
static inline bool sect_HasData(SectionType type) {
assert(type != SECTTYPE_INVALID);
return type == SECTTYPE_ROM0 || type == SECTTYPE_ROMX;
}
@@ -101,7 +101,7 @@ static inline bool sect_HasData(enum SectionType type) {
* Computes a memory region's end address (last byte), eg. 0x7FFF
* @return The address of the last byte in that memory region
*/
static inline uint16_t endaddr(enum SectionType type) {
static inline uint16_t endaddr(SectionType type) {
return sectionTypeInfo[type].startAddr + sectionTypeInfo[type].size - 1;
}
@@ -109,7 +109,7 @@ static inline uint16_t endaddr(enum SectionType type) {
* Computes a memory region's number of banks
* @return The number of banks, 1 for regions without banking
*/
static inline uint32_t nbbanks(enum SectionType type) {
static inline uint32_t nbbanks(SectionType type) {
return sectionTypeInfo[type].lastBank - sectionTypeInfo[type].firstBank + 1;
}