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

@@ -23,23 +23,23 @@ enum
class entityclass
{
public:
void init();
void init(void);
void resetallflags();
void resetallflags(void);
void fatal_top()
void fatal_top(void)
{
createblock(DAMAGE, -8, -8, 384, 16);
}
void fatal_bottom()
void fatal_bottom(void)
{
createblock(DAMAGE, -8, 224, 384, 16);
}
void fatal_left()
void fatal_left(void)
{
createblock(DAMAGE, -8, -8, 16, 260);
}
void fatal_right()
void fatal_right(void)
{
createblock(DAMAGE, 312, -8, 16, 260);
}
@@ -56,7 +56,7 @@ public:
bool disableentity(int t);
void removeallblocks();
void removeallblocks(void);
void disableblock(int t);
@@ -81,18 +81,18 @@ public:
void animateentities(int i);
int getcompanion();
int getcompanion(void);
int getplayer();
int getplayer(void);
int getscm();
int getscm(void);
int getlineat(int t);
int getcrewman(int t);
int getcustomcrewman(int t);
int getteleporter();
int getteleporter(void);
bool entitycollide(int a, int b);
@@ -100,7 +100,7 @@ public:
int checktrigger(int* block_idx);
int checkactivity();
int checkactivity(void);
int getgridpoint(int t);
@@ -147,7 +147,7 @@ public:
void movingplatformfix(int t, int j);
void entitycollisioncheck();
void entitycollisioncheck(void);
void collisioncheck(int i, int j, bool scm = false);