diff --git a/Ghidra/Features/Decompiler/build.gradle b/Ghidra/Features/Decompiler/build.gradle index d0251eb6a9..2ee4270148 100644 --- a/Ghidra/Features/Decompiler/build.gradle +++ b/Ghidra/Features/Decompiler/build.gradle @@ -517,6 +517,7 @@ model { binaries { all{ b -> if (b.toolChain in Gcc) { + b.cppCompiler.args "-std=c++11" b.cppCompiler.args "-Wall" b.cppCompiler.args "-O2" // for DEBUG, comment this line out // b.cppCompiler.args "-g" // for DEBUG, uncomment this line diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/Makefile b/Ghidra/Features/Decompiler/src/decompile/cpp/Makefile index 0af0ec6124..a727c99e08 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/Makefile +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/Makefile @@ -29,7 +29,7 @@ endif ifeq ($(OS),Darwin) MAKE_STATIC= ARCH_TYPE=-arch x86_64 - ADDITIONAL_FLAGS=-std=c++11 -mmacosx-version-min=10.6 -w + ADDITIONAL_FLAGS=-mmacosx-version-min=10.6 -w OSDIR=osx64 endif @@ -37,12 +37,12 @@ CC=gcc CXX=g++ # Debug flags -DBG_CXXFLAGS=-g -Wall -Wno-sign-compare +DBG_CXXFLAGS=-g -std=c++11 -Wall -Wno-sign-compare #DBG_CXXFLAGS=-g -pg -Wall -Wno-sign-compare #DBG_CXXFLAGS=-g -fprofile-arcs -ftest-coverage -Wall -Wno-sign-compare # Optimization flags -OPT_CXXFLAGS=-O2 -Wall -Wno-sign-compare +OPT_CXXFLAGS=-O2 -std=c++11 -Wall -Wno-sign-compare YACC=bison diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/float.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/float.cc index fe37245d79..49b3c86201 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/float.cc +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/float.cc @@ -19,32 +19,6 @@ #include #include "address.hh" -#if defined(_WINDOWS) && !defined(INFINITY) - -// Some definitions for Windows floating point stuff -#include - -inline int4 signbit(double x) { - return (((_fpclass(x)& (_FPCLASS_NINF | _FPCLASS_NN - | _FPCLASS_ND | _FPCLASS_NZ))!=0) ? 1 : 0); -} - -inline int4 isnan(double x) { - return (((_fpclass(x)& (_FPCLASS_SNAN | _FPCLASS_QNAN))!=0) ? 1 : 0); -} - -inline int4 isinf(double x) { - int4 classify = _fpclass(x); - if (classify == _FPCLASS_NINF) return -1; - if (classify == _FPCLASS_PINF) return 1; - return 0; -} - -#define INFINITY HUGE_VAL -#define NAN (INFINITY/INFINITY) - -#endif - /// Set format for a given encoding size according to IEEE 754 standards /// \param sz is the size of the encoding in bytes FloatFormat::FloatFormat(int4 sz) @@ -105,10 +79,10 @@ FloatFormat::floatclass FloatFormat::extractExpSig(double x,bool *sgn,uintb *sig { int4 e; - *sgn = (signbit(x) != 0); + *sgn = std::signbit(x); if (x == 0.0) return zero; - if (isinf(x)!=0) return infinity; - if (isnan(x)!=0) return nan; + if (std::isinf(x)) return infinity; + if (std::isnan(x)) return nan; if (*sgn) x = -x; double norm = frexp(x,&e); // norm is between 1/2 and 1