From 220f55d7603840e8211a20f519d44f102ead0ee5 Mon Sep 17 00:00:00 2001 From: "gregory.hainaut" Date: Sun, 23 Feb 2014 09:57:01 +0000 Subject: [PATCH] linux compilation fix: * use c++11 for pcsx2 * rename __rdtsc so I won't conflict with gnu version * add a bunch of .data() method to get string data git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5913 96395faa-99c1-11dd-bbfe-3dabce05a288 --- common/include/intrin_x86.h | 4 +++- common/src/x86emitter/cpudetect.cpp | 4 ++-- pcsx2/CMakeLists.txt | 1 + pcsx2/gui/Debugger/BreakpointWindow.cpp | 10 +++++----- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/common/include/intrin_x86.h b/common/include/intrin_x86.h index 9f40fc31e1..a1f9305762 100644 --- a/common/include/intrin_x86.h +++ b/common/include/intrin_x86.h @@ -843,7 +843,9 @@ static __inline__ __attribute__((always_inline)) unsigned long long __xgetbv(uns return ((unsigned long long)edx << 32) | eax; } -static __inline__ __attribute__((always_inline)) unsigned long long __rdtsc(void) +// gcc 4.8 define __rdtsc but unfortunately the compiler crash... +// The redefine allow to skip the gcc __rdtsc version -- Gregory +static __inline__ __attribute__((always_inline)) unsigned long long __pcsx2__rdtsc(void) { unsigned long long retval; __asm__ __volatile__("rdtsc" : "=A"(retval)); diff --git a/common/src/x86emitter/cpudetect.cpp b/common/src/x86emitter/cpudetect.cpp index 649e105321..b6a6cbc6f8 100644 --- a/common/src/x86emitter/cpudetect.cpp +++ b/common/src/x86emitter/cpudetect.cpp @@ -93,12 +93,12 @@ s64 x86capabilities::_CPUSpeedHz( u64 time ) const do { timeStart = GetCPUTicks(); - startCycle = __rdtsc(); + startCycle = __pcsx2__rdtsc(); } while( GetCPUTicks() == timeStart ); do { timeStop = GetCPUTicks(); - endCycle = __rdtsc(); + endCycle = __pcsx2__rdtsc(); } while( ( timeStop - timeStart ) < time ); s64 cycleCount = endCycle - startCycle; diff --git a/pcsx2/CMakeLists.txt b/pcsx2/CMakeLists.txt index d948597962..4446936167 100644 --- a/pcsx2/CMakeLists.txt +++ b/pcsx2/CMakeLists.txt @@ -19,6 +19,7 @@ set(CommonFlags -fno-tree-dse -fno-strict-aliasing -Wstrict-aliasing # Allow to track strict aliasing issue. + -std=c++0x -pipe) if (SPARSEHASH_NEW_FOUND) diff --git a/pcsx2/gui/Debugger/BreakpointWindow.cpp b/pcsx2/gui/Debugger/BreakpointWindow.cpp index a8c00d9807..6c3f542b52 100644 --- a/pcsx2/gui/Debugger/BreakpointWindow.cpp +++ b/pcsx2/gui/Debugger/BreakpointWindow.cpp @@ -232,7 +232,7 @@ bool BreakpointWindow::fetchDialogData() wxCharBuffer addressText = editAddress->GetLabel().ToUTF8(); if (cpu->initExpression(addressText,exp) == false) { - swprintf(errorMessage,512,L"Invalid expression \"%s\".",editAddress->GetLabel().wchar_str()); + swprintf(errorMessage,512,L"Invalid expression \"%s\".",editAddress->GetLabel().wchar_str().data()); wxMessageBox(errorMessage,L"Error",wxICON_ERROR); return false; } @@ -240,7 +240,7 @@ bool BreakpointWindow::fetchDialogData() u64 value; if (cpu->parseExpression(exp,value) == false) { - swprintf(errorMessage,512,L"Invalid expression \"%s\".",editAddress->GetLabel().wchar_str()); + swprintf(errorMessage,512,L"Invalid expression \"%s\".",editAddress->GetLabel().wchar_str().data()); wxMessageBox(errorMessage,L"Error",wxICON_ERROR); return false; } @@ -252,14 +252,14 @@ bool BreakpointWindow::fetchDialogData() wxCharBuffer sizeText = editSize->GetLabel().ToUTF8(); if (cpu->initExpression(sizeText,exp) == false) { - swprintf(errorMessage,512,L"Invalid expression \"%s\".",editSize->GetLabel().wchar_str()); + swprintf(errorMessage,512,L"Invalid expression \"%s\".",editSize->GetLabel().wchar_str().data()); wxMessageBox(errorMessage,L"Error",wxICON_ERROR); return false; } if (cpu->parseExpression(exp,value) == false) { - swprintf(errorMessage,512,L"Invalid expression \"%s\".",editSize->GetLabel().wchar_str()); + swprintf(errorMessage,512,L"Invalid expression \"%s\".",editSize->GetLabel().wchar_str().data()); wxMessageBox(errorMessage,L"Error",wxICON_ERROR); return false; } @@ -276,7 +276,7 @@ bool BreakpointWindow::fetchDialogData() { if (cpu->initExpression(condition,compiledCondition) == false) { - swprintf(errorMessage,512,L"Invalid expression \"%s\".",editCondition->GetLabel().wchar_str()); + swprintf(errorMessage,512,L"Invalid expression \"%s\".",editCondition->GetLabel().wchar_str().data()); wxMessageBox(errorMessage,L"Error",wxICON_ERROR); return false; }