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

@@ -8,9 +8,9 @@
#include "Map.h"
#include "UtilityClass.h"
static void songend();
static void songend(void);
musicclass::musicclass()
musicclass::musicclass(void)
{
safeToProcessMusic= false;
m_doFadeInVol = false;
@@ -31,7 +31,7 @@ musicclass::musicclass()
usingmmmmmm = false;
}
void musicclass::init()
void musicclass::init(void)
{
soundTracks.push_back(SoundTrack( "sounds/jump.wav" ));
soundTracks.push_back(SoundTrack( "sounds/jump2.wav" ));
@@ -141,14 +141,14 @@ void musicclass::init()
}
}
static void songend()
static void songend(void)
{
extern musicclass music;
music.songEnd = SDL_GetPerformanceCounter();
music.currentsong = -1;
}
void musicclass::destroy()
void musicclass::destroy(void)
{
for (size_t i = 0; i < soundTracks.size(); ++i)
{
@@ -257,18 +257,18 @@ void musicclass::resume(const int fadein_ms /*= 0*/)
play(resumesong, position_sec, fadein_ms);
}
void musicclass::fadein()
void musicclass::fadein(void)
{
resume(3000); // 3000 ms fadein
}
void musicclass::haltdasmusik()
void musicclass::haltdasmusik(void)
{
Mix_HaltMusic();
resumesong = currentsong;
}
void musicclass::silencedasmusik()
void musicclass::silencedasmusik(void)
{
musicVolume = 0;
}
@@ -286,7 +286,7 @@ void musicclass::fadeout(const bool quick_fade_ /*= true*/)
quick_fade = quick_fade_;
}
void musicclass::processmusicfadein()
void musicclass::processmusicfadein(void)
{
musicVolume += FadeVolAmountPerFrame;
if (musicVolume >= MIX_MAX_VOLUME)
@@ -295,7 +295,7 @@ void musicclass::processmusicfadein()
}
}
void musicclass::processmusic()
void musicclass::processmusic(void)
{
if(!safeToProcessMusic)
{