Ghidra is a software reverse engineering (SRE) framework
Simplified types.h
Andrew Strelskyf1a812354733
diff --git a/Ghidra/Features/Decompiler/buildNatives.gradle b/Ghidra/Features/Decompiler/buildNatives.gradleindex a05736f686..94b7699b8f 100644--- a/Ghidra/Features/Decompiler/buildNatives.gradle+++ b/Ghidra/Features/Decompiler/buildNatives.gradle@@ -13,7 +13,9 @@* See the License for the specific language governing permissions and* limitations under the License.*/-++import java.nio.ByteOrder+// Native build files are already applied in development mode (indicated by presence of the// Generic project). Only need to apply them if we are in a distribution.if (findProject(':Generic') == null) {@@ -22,6 +24,13 @@ if (findProject(':Generic') == null) {apply from: "../../../GPL/nativeBuildProperties.gradle"}+def getHostEndianDefine() {+ if (ByteOrder.nativeOrder().equals(ByteOrder.BIG_ENDIAN)) {+ return "HOST_ENDIAN=1"+ }+ return "HOST_ENDIAN=0"+}+/*** Define the "native build model" for building the decompiler executables.*/@@ -187,6 +196,7 @@ model {binaries {all{ b ->+ b.cppCompiler.define getHostEndianDefine()if (b.toolChain in Gcc) {b.cppCompiler.args "-std=c++11"b.cppCompiler.args "-Wall"diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/types.h b/Ghidra/Features/Decompiler/src/decompile/cpp/types.hindex f07b14b8dd..bf2d369d8d 100644--- a/Ghidra/Features/Decompiler/src/decompile/cpp/types.h+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/types.h@@ -25,191 +25,20 @@#ifndef __MYTYPES__#define __MYTYPES__-#if defined( __sparc )-#define HOST_ENDIAN 1-#if defined( __sparcv9 )-typedef unsigned long uintm;-typedef long intm;-typedef unsigned long uint8;-typedef long int8;-typedef unsigned int uint4;-typedef int int4;-typedef unsigned short uint2;-typedef short int2;-typedef unsigned char uint1;-typedef char int1;-typedef uint8 uintp;-#else-typedef unsigned int uintm;-typedef int intm;--typedef unsigned long long uint8;-typedef long long int8;-typedef unsigned int uint4;-typedef int int4;-typedef unsigned short uint2;-typedef short int2;-typedef unsigned char uint1;-typedef char int1;-typedef uint4 uintp;--#endif /* __sparcv9 */-#endif /* __sparc */--/* Alpha defines */-#if defined (__digital__) && defined (__unix__)-typedef unsigned long uintm;-typedef long intm;-typedef unsigned long uint8;-typedef long int8;-typedef unsigned int uint4;-typedef int int4;-typedef unsigned short uint2;-typedef short int2;-typedef unsigned char uint1;-typedef char int1;-typedef uint8 uintp;-#endif--#if defined (__linux__) && defined (__i386__)-#define HOST_ENDIAN 0-typedef unsigned long uintm;-typedef long intm;-typedef unsigned long long uint8;-typedef long long int8;-typedef unsigned int uint4;-typedef int int4;-typedef unsigned short uint2;-typedef short int2;-typedef unsigned char uint1;-typedef char int1;-typedef uint4 uintp;-#endif--#if defined (__linux__) && defined (__x86_64__)-#define HOST_ENDIAN 0-typedef unsigned int uintm;-typedef int intm;-typedef unsigned long uint8;-typedef long int8;-typedef unsigned int uint4;-typedef int int4;-typedef unsigned short uint2;-typedef short int2;-typedef unsigned char uint1;-typedef char int1;-typedef uint8 uintp;-#endif--#if defined (__linux__) && defined (__aarch64__)-#define HOST_ENDIAN 0-typedef unsigned int uintm;-typedef int intm;-typedef unsigned long uint8;-typedef long int8;-typedef unsigned int uint4;-typedef int int4;-typedef unsigned short uint2;-typedef short int2;-typedef unsigned char uint1;-typedef char int1;-typedef uint8 uintp;-#endif--#if defined(_WINDOWS)--#if defined(_WIN64)--#define HOST_ENDIAN 0-typedef unsigned int uintm;-typedef int intm;-typedef unsigned long long uint8;-typedef long long int8;-typedef unsigned int uint4;-typedef int int4;-typedef unsigned short uint2;-typedef short int2;-typedef unsigned char uint1;-typedef char int1;-typedef uint8 uintp;--#else // _WIN32 assumed--#define HOST_ENDIAN 0-typedef unsigned long uintm;-typedef long intm;-typedef unsigned long long uint8;-typedef long long int8;-typedef unsigned int uint4;-typedef int int4;-typedef unsigned short uint2;-typedef short int2;-typedef unsigned char uint1;-typedef char int1;-typedef uint4 uintp;-#endif // _WIN32--#endif // _WINDOWS--#if defined( __APPLE_CC__) && defined( __ppc__)-#define HOST_ENDIAN 1-typedef unsigned long uintm;-typedef long intm;-typedef unsigned long uint8;-typedef long int8;-typedef unsigned int uint4;-typedef int int4;-typedef unsigned short uint2;-typedef short int2;-typedef unsigned char uint1;-typedef char int1;-typedef uint4 uintp;-#endif--#if defined( __APPLE_CC__) && defined( __i386__)-#define HOST_ENDIAN 0-typedef unsigned long uintm;-typedef long intm;-typedef unsigned long long uint8;-typedef long long int8;-typedef unsigned int uint4;-typedef int int4;-typedef unsigned short uint2;-typedef short int2;-typedef unsigned char uint1;-typedef char int1;-typedef uint4 uintp;-#endif--#if defined (__APPLE_CC__) && defined (__x86_64__)-#define HOST_ENDIAN 0-typedef unsigned int uintm;-typedef int intm;-typedef unsigned long uint8;-typedef long int8;-typedef unsigned int uint4;-typedef int int4;-typedef unsigned short uint2;-typedef short int2;-typedef unsigned char uint1;-typedef char int1;-typedef uint8 uintp;-#endif--#if defined (__APPLE_CC__) && defined (__aarch64__)-#define HOST_ENDIAN 0-typedef unsigned int uintm;-typedef int intm;-typedef unsigned long uint8;-typedef long int8;-typedef unsigned int uint4;-typedef int int4;-typedef unsigned short uint2;-typedef short int2;-typedef unsigned char uint1;-typedef char int1;-typedef uint8 uintp;-#endif+#include <cstdint>+#include <type_traits>++typedef size_t uintm;+typedef std::make_signed<uintm>::type intm;+typedef uint64_t uint8;+typedef int64_t int8;+typedef uint32_t uint4;+typedef int32_t int4;+typedef uint16_t uint2;+typedef int16_t int2;+typedef uint8_t uint1;+typedef int8_t int1;+typedef uintptr_t uintp;#if defined(_WINDOWS)#pragma warning (disable:4312)