Fix C++11 compatibility

master
kwolekr 2015-10-31 02:38:23 -04:00
parent 482c4d69b0
commit fdede60034
4 changed files with 12 additions and 8 deletions

View File

@ -45,7 +45,7 @@ void sanity_check_fn(const char *assertion, const char *file,
unsigned int line, const char *function) unsigned int line, const char *function)
{ {
errorstream << std::endl << "In thread " << std::hex errorstream << std::endl << "In thread " << std::hex
<< (unsigned long)thr_get_current_thread_id() << ":" << std::endl; << thr_get_current_thread_id() << ":" << std::endl;
errorstream << file << ":" << line << ": " << function errorstream << file << ":" << line << ": " << function
<< ": An engine assumption '" << assertion << "' failed." << std::endl; << ": An engine assumption '" << assertion << "' failed." << std::endl;
@ -58,7 +58,7 @@ void fatal_error_fn(const char *msg, const char *file,
unsigned int line, const char *function) unsigned int line, const char *function)
{ {
errorstream << std::endl << "In thread " << std::hex errorstream << std::endl << "In thread " << std::hex
<< (unsigned long)thr_get_current_thread_id() << ":" << std::endl; << thr_get_current_thread_id() << ":" << std::endl;
errorstream << file << ":" << line << ": " << function errorstream << file << ":" << line << ": " << function
<< ": A fatal error occured: " << msg << std::endl; << ": A fatal error occured: " << msg << std::endl;
@ -93,8 +93,10 @@ DebugStack::DebugStack(threadid_t id)
void DebugStack::print(FILE *file, bool everything) void DebugStack::print(FILE *file, bool everything)
{ {
fprintf(file, "DEBUG STACK FOR THREAD %lx:\n", std::ostringstream os;
(unsigned long)threadid); os << threadid;
fprintf(file, "DEBUG STACK FOR THREAD %s:\n",
os.str().c_str());
for(int i=0; i<stack_max_i; i++) for(int i=0; i<stack_max_i; i++)
{ {
@ -113,7 +115,7 @@ void DebugStack::print(FILE *file, bool everything)
void DebugStack::print(std::ostream &os, bool everything) void DebugStack::print(std::ostream &os, bool everything)
{ {
os<<"DEBUG STACK FOR THREAD "<<(unsigned long)threadid<<": "<<std::endl; os<<"DEBUG STACK FOR THREAD "<<threadid<<": "<<std::endl;
for(int i=0; i<stack_max_i; i++) for(int i=0; i<stack_max_i; i++)
{ {

View File

@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#ifndef OBJDEF_HEADER #ifndef OBJDEF_HEADER
#define OBJDEF_HEADER #define OBJDEF_HEADER
#include "basicmacros.h"
#include "porting.h" #include "porting.h"
class IGameDef; class IGameDef;

View File

@ -117,9 +117,9 @@ bool Thread::start()
try { try {
m_thread_obj = new std::thread(threadProc, this); m_thread_obj = new std::thread(threadProc, this);
m_thread_id = m_thread->get_id(); m_thread_id = m_thread_obj->get_id();
m_thread_handle = m_thread->native_handle(); m_thread_handle = m_thread_obj->native_handle();
} except (const std::system_error &e) { } catch (const std::system_error &e) {
return false; return false;
} }

View File

@ -26,6 +26,7 @@ DEALINGS IN THE SOFTWARE.
#ifndef THREADING_THREAD_H #ifndef THREADING_THREAD_H
#define THREADING_THREAD_H #define THREADING_THREAD_H
#include "basicmacros.h"
#include "threading/atomic.h" #include "threading/atomic.h"
#include "threading/mutex.h" #include "threading/mutex.h"
#include "threads.h" #include "threads.h"