Remove now-unnecessary struct keyword (#1320)

C++ acts like structs are `typedef`ed by default

We do have to keep `struct stat`, since there's ambiguity
with the function also called `stat`.
This commit is contained in:
Sylvie
2024-02-29 14:41:58 -05:00
committed by GitHub
parent 1210a7441f
commit eff8c324c8
40 changed files with 537 additions and 553 deletions

View File

@@ -31,7 +31,7 @@ extern bool isWRAM0Mode;
extern bool disablePadding;
struct FileStackNode {
struct FileStackNode *parent;
FileStackNode *parent;
// Line at which the parent context was exited; meaningless for the root level
uint32_t lineNo;
@@ -60,15 +60,12 @@ struct FileStackNode {
* Dump a file stack to stderr
* @param node The leaf node to dump the context of
*/
std::string const *dumpFileStack(struct FileStackNode const *node);
std::string const *dumpFileStack(FileStackNode const *node);
void warning(struct FileStackNode const *where, uint32_t lineNo,
char const *fmt, ...) format_(printf, 3, 4);
void warning(FileStackNode const *where, uint32_t lineNo, char const *fmt, ...) format_(printf, 3, 4);
void error(struct FileStackNode const *where, uint32_t lineNo,
char const *fmt, ...) format_(printf, 3, 4);
void error(FileStackNode const *where, uint32_t lineNo, char const *fmt, ...) format_(printf, 3, 4);
[[noreturn]] void fatal(struct FileStackNode const *where, uint32_t lineNo,
char const *fmt, ...) format_(printf, 3, 4);
[[noreturn]] void fatal(FileStackNode const *where, uint32_t lineNo, char const *fmt, ...) format_(printf, 3, 4);
#endif // RGBDS_LINK_MAIN_H

View File

@@ -12,14 +12,14 @@
* Registers a section for output.
* @param section The section to add
*/
void out_AddSection(struct Section const *section);
void out_AddSection(Section const *section);
/*
* Finds an assigned section overlapping another one.
* @param section The section that is being overlapped
* @return A section overlapping it
*/
struct Section const *out_OverlappingSection(struct Section const *section);
Section const *out_OverlappingSection(Section const *section);
/*
* Writes all output (bin, sym, map) files.

View File

@@ -13,17 +13,17 @@
#include "linkdefs.hpp"
struct Assertion {
struct Patch patch; // Also used for its `.type`
Patch patch; // Also used for its `.type`
std::string message;
// This would be redundant with `.section->fileSymbols`... but `section` is sometimes NULL!
std::vector<struct Symbol> *fileSymbols;
std::vector<Symbol> *fileSymbols;
};
/*
* Checks all assertions
* @return true if assertion failed
*/
void patch_CheckAssertions(std::deque<struct Assertion> &assertions);
void patch_CheckAssertions(std::deque<Assertion> &assertions);
/*
* Applies all SECTIONs' patches to them

View File

@@ -10,6 +10,6 @@
struct FileStackNode;
struct Symbol;
void sdobj_ReadFile(struct FileStackNode const *fileName, FILE *file, std::vector<struct Symbol> &fileSymbols);
void sdobj_ReadFile(FileStackNode const *fileName, FILE *file, std::vector<Symbol> &fileSymbols);
#endif // RGBDS_LINK_SDAS_OBJ_H

View File

@@ -16,12 +16,13 @@
struct FileStackNode;
struct Section;
struct Symbol;
struct Patch {
struct FileStackNode const *src;
FileStackNode const *src;
uint32_t lineNo;
uint32_t offset;
struct Section const *pcSection;
Section const *pcSection;
uint32_t pcSectionID;
uint32_t pcOffset;
enum PatchType type;
@@ -45,11 +46,11 @@ struct Section {
uint16_t alignMask;
uint16_t alignOfs;
std::vector<uint8_t> data; // Array of size `size`, or 0 if `type` does not have data
std::vector<struct Patch> patches;
std::vector<Patch> patches;
// Extra info computed during linking
std::vector<struct Symbol> *fileSymbols;
std::vector<struct Symbol *> symbols;
struct Section *nextu; // The next "component" of this unionized sect
std::vector<Symbol> *fileSymbols;
std::vector<Symbol *> symbols;
Section *nextu; // The next "component" of this unionized sect
};
/*
@@ -57,20 +58,20 @@ struct Section {
* This is to avoid exposing the data structure in which sections are stored.
* @param callback The function to call for each structure.
*/
void sect_ForEach(void (*callback)(struct Section *));
void sect_ForEach(void (*callback)(Section *));
/*
* Registers a section to be processed.
* @param section The section to register.
*/
void sect_AddSection(struct Section *section);
void sect_AddSection(Section *section);
/*
* Finds a section by its name.
* @param name The name of the section to look for
* @return A pointer to the section, or NULL if it wasn't found
*/
struct Section *sect_GetSection(std::string const &name);
Section *sect_GetSection(std::string const &name);
/*
* Checks if all sections meet reasonable criteria, such as max size

View File

@@ -12,13 +12,14 @@
#include "linkdefs.hpp"
struct FileStackNode;
struct Section;
struct Symbol {
// Info contained in the object files
std::string name;
enum ExportLevel type;
char const *objFileName;
struct FileStackNode const *src;
FileStackNode const *src;
int32_t lineNo;
int32_t sectionID;
union {
@@ -27,16 +28,16 @@ struct Symbol {
int32_t value;
};
// Extra info computed during linking
struct Section *section;
Section *section;
};
void sym_AddSymbol(struct Symbol *symbol);
void sym_AddSymbol(Symbol *symbol);
/*
* Finds a symbol in all the defined symbols.
* @param name The name of the symbol to look for
* @return A pointer to the symbol, or NULL if not found.
*/
struct Symbol *sym_GetSymbol(std::string const &name);
Symbol *sym_GetSymbol(std::string const &name);
#endif // RGBDS_LINK_SYMBOL_H