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

@@ -10,7 +10,7 @@
#include "Script.h"
#include "UtilityClass.h"
mapclass::mapclass()
mapclass::mapclass(void)
{
//Start here!
colstatedelay = 0;
@@ -128,13 +128,13 @@ void mapclass::settrinket(int x, int y)
shinytrinkets.push_back(temp);
}
void mapclass::resetmap()
void mapclass::resetmap(void)
{
//clear the explored area of the map
SDL_memset(explored, 0, sizeof(explored));
}
void mapclass::resetnames()
void mapclass::resetnames(void)
{
//Reset all the special names
specialnames[0] = "Rear Window";
@@ -393,7 +393,7 @@ std::string mapclass::getglitchname(int x, int y)
return roomname;
}
void mapclass::initmapdata()
void mapclass::initmapdata(void)
{
if (custommode)
{
@@ -443,7 +443,7 @@ void mapclass::initmapdata()
settrinket(10, 8);
}
void mapclass::initcustommapdata()
void mapclass::initcustommapdata(void)
{
shinytrinkets.clear();
@@ -622,7 +622,7 @@ void mapclass::updatetowerglow(TowerBG& bg_obj)
}
}
void mapclass::nexttowercolour()
void mapclass::nexttowercolour(void)
{
graphics.titlebg.colstate+=5;
if (graphics.titlebg.colstate >= 30) graphics.titlebg.colstate = 0;
@@ -721,7 +721,7 @@ int mapclass::area(int _rx, int _ry)
}
}
void mapclass::exploretower()
void mapclass::exploretower(void)
{
for (int i = 0; i < 20; i++)
{
@@ -729,7 +729,7 @@ void mapclass::exploretower()
}
}
void mapclass::hideship()
void mapclass::hideship(void)
{
//remove the ship from the explored areas
explored[2 + (10 * 20)] = 0;
@@ -740,7 +740,7 @@ void mapclass::hideship()
explored[4 + (11 * 20)] = 0;
}
void mapclass::showship()
void mapclass::showship(void)
{
//remove the ship from the explored areas
explored[2 + (10 * 20)] = 1;
@@ -751,7 +751,7 @@ void mapclass::showship()
explored[4 + (11 * 20)] = 1;
}
void mapclass::resetplayer()
void mapclass::resetplayer(void)
{
resetplayer(false);
}
@@ -2048,7 +2048,7 @@ void mapclass::loadlevel(int rx, int ry)
}
}
void mapclass::twoframedelayfix()
void mapclass::twoframedelayfix(void)
{
// Fixes the two-frame delay in custom levels that use scripts to spawn an entity upon room load.
// Because when the room loads and newscript is set to run, newscript has already ran for that frame,