Explicitly declare void for all void parameter functions (#628)

Apparently in C, if you have `void test();`, it's completely okay to do
`test(2);`. The function will take in the argument, but just discard it
and throw it away. It's like a trash can, and a rude one at that. If you
declare it like `void test(void);`, this is prevented.

This is not a problem in C++ - doing `void test();` and `test(2);` is
guaranteed to result in a compile error (this also means that right now,
at least in all `.cpp` files, nobody is ever calling a void parameter
function with arguments and having their arguments be thrown away).
However, we may not be using C++ in the future, so I just want to lay
down the precedent that if a function takes in no arguments, you must
explicitly declare it as such.

I would've added `-Wstrict-prototypes`, but it produces an annoying
warning message saying it doesn't work in C++ mode if you're compiling
in C++ mode. So it can be added later.
This commit is contained in:
Misa
2021-02-25 14:23:59 -08:00
committed by GitHub
parent 0e313d0d75
commit 6a3a1fe147
53 changed files with 439 additions and 439 deletions

View File

@@ -43,7 +43,7 @@ public:
class edlevelclass{
public:
edlevelclass();
edlevelclass(void);
int tileset, tilecol;
std::string roomname;
int warpdir;
@@ -76,7 +76,7 @@ class EditorData
{
public:
static EditorData& GetInstance()
static EditorData& GetInstance(void)
{
static EditorData instance; // Guaranteed to be destroyed.
// Instantiated on first use.
@@ -103,7 +103,7 @@ struct GhostInfo {
class editorclass{
//Special class to handle ALL editor variables locally
public:
editorclass();
editorclass(void);
std::string Desc1;
std::string Desc2;
@@ -112,11 +112,11 @@ class editorclass{
std::vector<LevelMetaData> ListOfMetaData;
void loadZips();
void getDirectoryData();
void loadZips(void);
void getDirectoryData(void);
bool getLevelMetaData(std::string& filename, LevelMetaData& _data );
void reset();
void reset(void);
void getlin(const enum textmode mode, const std::string& prompt, std::string* ptr);
const short* loadlevel(int rxi, int ryi);
@@ -151,7 +151,7 @@ class editorclass{
bool load(std::string& _path);
bool save(std::string& _path);
void generatecustomminimap();
void generatecustomminimap(void);
int edgetile(int x, int y);
int outsideedgetile(int x, int y);
@@ -162,7 +162,7 @@ class editorclass{
int findtrinket(int t);
int findcrewmate(int t);
int findwarptoken(int t);
void findstartpoint();
void findstartpoint(void);
int getlevelcol(int t);
int getenemycol(int t);
int entcol;
@@ -176,8 +176,8 @@ class editorclass{
static const int numrooms = maxwidth * maxheight;
short contents[40 * 30 * numrooms];
int vmult[30 * maxheight];
int numtrinkets();
int numcrewmates();
int numtrinkets(void);
int numcrewmates(void);
edlevelclass level[numrooms]; //Maxwidth*maxheight
int kludgewarpdir[numrooms]; //Also maxwidth*maxheight
@@ -242,8 +242,8 @@ class editorclass{
void addhooktoscript(std::string t);
void removehookfromscript(std::string t);
void loadhookineditor(std::string t);
void clearscriptbuffer();
void gethooks();
void clearscriptbuffer(void);
void gethooks(void);
bool checkhook(std::string t);
std::vector<std::string> hooklist;
@@ -254,7 +254,7 @@ class editorclass{
int dmtileeditor;
Uint32 getonewaycol(const int rx, const int ry);
Uint32 getonewaycol();
Uint32 getonewaycol(void);
bool onewaycol_override;
int returneditoralpha;
@@ -265,13 +265,13 @@ class editorclass{
};
#if !defined(NO_EDITOR)
void editorrender();
void editorrender(void);
void editorrenderfixed();
void editorrenderfixed(void);
void editorlogic();
void editorlogic(void);
void editorinput();
void editorinput(void);
#endif
#ifndef ED_DEFINITION