Codechange: Use override specifer for overriding member declarations
This is a C++11 feature that allows the compiler to check that a virtual member declaration overrides a base-class member with the same signature. Also src/blitter/32bpp_anim_sse4.hpp +38 is no longer erroneously marked as virtual despite being a template.
This commit is contained in:

committed by
Michael Lutz

parent
31260e6625
commit
af7d9020a1
@@ -41,13 +41,13 @@ public:
|
||||
thread = _beginthread(stThreadProc, NULL, 1048576, this);
|
||||
}
|
||||
|
||||
/* virtual */ bool Exit()
|
||||
bool Exit() override
|
||||
{
|
||||
_endthread();
|
||||
return true;
|
||||
}
|
||||
|
||||
/* virtual */ void Join()
|
||||
void Join() override
|
||||
{
|
||||
DosWaitThread(&this->thread, DCWW_WAIT);
|
||||
this->thread = 0;
|
||||
@@ -106,13 +106,13 @@ public:
|
||||
DosCreateEventSem(NULL, &event, 0, FALSE);
|
||||
}
|
||||
|
||||
/* virtual */ ~ThreadMutex_OS2()
|
||||
~ThreadMutex_OS2() override
|
||||
{
|
||||
DosCloseMutexSem(mutex);
|
||||
DosCloseEventSem(event);
|
||||
}
|
||||
|
||||
/* virtual */ void BeginCritical(bool allow_recursive = false)
|
||||
void BeginCritical(bool allow_recursive = false) override
|
||||
{
|
||||
/* os2 mutex is recursive by itself */
|
||||
DosRequestMutexSem(mutex, (unsigned long) SEM_INDEFINITE_WAIT);
|
||||
@@ -120,14 +120,14 @@ public:
|
||||
if (!allow_recursive && this->recursive_count != 1) NOT_REACHED();
|
||||
}
|
||||
|
||||
/* virtual */ void EndCritical(bool allow_recursive = false)
|
||||
void EndCritical(bool allow_recursive = false) override
|
||||
{
|
||||
if (!allow_recursive && this->recursive_count != 1) NOT_REACHED();
|
||||
this->recursive_count--;
|
||||
DosReleaseMutexSem(mutex);
|
||||
}
|
||||
|
||||
/* virtual */ void WaitForSignal()
|
||||
void WaitForSignal() override
|
||||
{
|
||||
assert(this->recursive_count == 1); // Do we need to call Begin/EndCritical multiple times otherwise?
|
||||
this->EndCritical();
|
||||
@@ -135,7 +135,7 @@ public:
|
||||
this->BeginCritical();
|
||||
}
|
||||
|
||||
/* virtual */ void SendSignal()
|
||||
void SendSignal() override
|
||||
{
|
||||
DosPostEventSem(event);
|
||||
}
|
||||
|
@@ -45,14 +45,14 @@ public:
|
||||
pthread_create(&this->thread, NULL, &stThreadProc, this);
|
||||
}
|
||||
|
||||
/* virtual */ bool Exit()
|
||||
bool Exit() override
|
||||
{
|
||||
assert(pthread_self() == this->thread);
|
||||
/* For now we terminate by throwing an error, gives much cleaner cleanup */
|
||||
throw OTTDThreadExitSignal();
|
||||
}
|
||||
|
||||
/* virtual */ void Join()
|
||||
void Join() override
|
||||
{
|
||||
/* You cannot join yourself */
|
||||
assert(pthread_self() != this->thread);
|
||||
@@ -129,7 +129,7 @@ public:
|
||||
pthread_cond_init(&this->condition, NULL);
|
||||
}
|
||||
|
||||
/* virtual */ ~ThreadMutex_pthread()
|
||||
~ThreadMutex_pthread() override
|
||||
{
|
||||
int err = pthread_cond_destroy(&this->condition);
|
||||
assert(err != EBUSY);
|
||||
@@ -142,7 +142,7 @@ public:
|
||||
return this->owner == pthread_self();
|
||||
}
|
||||
|
||||
/* virtual */ void BeginCritical(bool allow_recursive = false)
|
||||
void BeginCritical(bool allow_recursive = false) override
|
||||
{
|
||||
/* pthread mutex is not recursive by itself */
|
||||
if (this->IsOwnedByCurrentThread()) {
|
||||
@@ -156,7 +156,7 @@ public:
|
||||
this->recursive_count++;
|
||||
}
|
||||
|
||||
/* virtual */ void EndCritical(bool allow_recursive = false)
|
||||
void EndCritical(bool allow_recursive = false) override
|
||||
{
|
||||
assert(this->IsOwnedByCurrentThread());
|
||||
if (!allow_recursive && this->recursive_count != 1) NOT_REACHED();
|
||||
@@ -167,7 +167,7 @@ public:
|
||||
assert(err == 0);
|
||||
}
|
||||
|
||||
/* virtual */ void WaitForSignal()
|
||||
void WaitForSignal() override
|
||||
{
|
||||
uint old_recursive_count = this->recursive_count;
|
||||
this->recursive_count = 0;
|
||||
@@ -178,7 +178,7 @@ public:
|
||||
this->recursive_count = old_recursive_count;
|
||||
}
|
||||
|
||||
/* virtual */ void SendSignal()
|
||||
void SendSignal() override
|
||||
{
|
||||
int err = pthread_cond_signal(&this->condition);
|
||||
assert(err == 0);
|
||||
|
@@ -49,7 +49,7 @@ public:
|
||||
ResumeThread(this->thread);
|
||||
}
|
||||
|
||||
/* virtual */ ~ThreadObject_Win32()
|
||||
~ThreadObject_Win32() override
|
||||
{
|
||||
if (this->thread != NULL) {
|
||||
CloseHandle(this->thread);
|
||||
@@ -57,14 +57,14 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
/* virtual */ bool Exit()
|
||||
bool Exit() override
|
||||
{
|
||||
assert(GetCurrentThreadId() == this->id);
|
||||
/* For now we terminate by throwing an error, gives much cleaner cleanup */
|
||||
throw OTTDThreadExitSignal();
|
||||
}
|
||||
|
||||
/* virtual */ void Join()
|
||||
void Join() override
|
||||
{
|
||||
/* You cannot join yourself */
|
||||
assert(GetCurrentThreadId() != this->id);
|
||||
@@ -126,13 +126,13 @@ public:
|
||||
this->event = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
}
|
||||
|
||||
/* virtual */ ~ThreadMutex_Win32()
|
||||
~ThreadMutex_Win32() override
|
||||
{
|
||||
DeleteCriticalSection(&this->critical_section);
|
||||
CloseHandle(this->event);
|
||||
}
|
||||
|
||||
/* virtual */ void BeginCritical(bool allow_recursive = false)
|
||||
void BeginCritical(bool allow_recursive = false) override
|
||||
{
|
||||
/* windows mutex is recursive by itself */
|
||||
EnterCriticalSection(&this->critical_section);
|
||||
@@ -140,14 +140,14 @@ public:
|
||||
if (!allow_recursive && this->recursive_count != 1) NOT_REACHED();
|
||||
}
|
||||
|
||||
/* virtual */ void EndCritical(bool allow_recursive = false)
|
||||
void EndCritical(bool allow_recursive = false) override
|
||||
{
|
||||
if (!allow_recursive && this->recursive_count != 1) NOT_REACHED();
|
||||
this->recursive_count--;
|
||||
LeaveCriticalSection(&this->critical_section);
|
||||
}
|
||||
|
||||
/* virtual */ void WaitForSignal()
|
||||
void WaitForSignal() override
|
||||
{
|
||||
assert(this->recursive_count == 1); // Do we need to call Begin/EndCritical multiple times otherwise?
|
||||
this->EndCritical();
|
||||
@@ -155,7 +155,7 @@ public:
|
||||
this->BeginCritical();
|
||||
}
|
||||
|
||||
/* virtual */ void SendSignal()
|
||||
void SendSignal() override
|
||||
{
|
||||
SetEvent(this->event);
|
||||
}
|
||||
|
Reference in New Issue
Block a user