summaryrefslogtreecommitdiffstats
path: root/Tools/RCONClient/Globals.h
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2015-03-10 20:05:46 +0100
committerHowaner <franzi.moos@googlemail.com>2015-03-10 20:05:46 +0100
commitab420f6cfc8519fb2ec0caa7fb242517244ffcea (patch)
treec31c3538db081516d81959ed8ad00259175441a9 /Tools/RCONClient/Globals.h
parentChanged return type from AbsorbWater() to void. (diff)
parentFixed client kick/crash if many block changes happend (diff)
downloadcuberite-ab420f6cfc8519fb2ec0caa7fb242517244ffcea.tar
cuberite-ab420f6cfc8519fb2ec0caa7fb242517244ffcea.tar.gz
cuberite-ab420f6cfc8519fb2ec0caa7fb242517244ffcea.tar.bz2
cuberite-ab420f6cfc8519fb2ec0caa7fb242517244ffcea.tar.lz
cuberite-ab420f6cfc8519fb2ec0caa7fb242517244ffcea.tar.xz
cuberite-ab420f6cfc8519fb2ec0caa7fb242517244ffcea.tar.zst
cuberite-ab420f6cfc8519fb2ec0caa7fb242517244ffcea.zip
Diffstat (limited to 'Tools/RCONClient/Globals.h')
-rw-r--r--Tools/RCONClient/Globals.h42
1 files changed, 40 insertions, 2 deletions
diff --git a/Tools/RCONClient/Globals.h b/Tools/RCONClient/Globals.h
index a3a2f2846..dc7669270 100644
--- a/Tools/RCONClient/Globals.h
+++ b/Tools/RCONClient/Globals.h
@@ -22,6 +22,18 @@
#define ALIGN_8
#define ALIGN_16
+ #define FORMATSTRING(formatIndex, va_argsIndex)
+
+ // MSVC has its own custom version of zu format
+ #define SIZE_T_FMT "%Iu"
+ #define SIZE_T_FMT_PRECISION(x) "%" #x "Iu"
+ #define SIZE_T_FMT_HEX "%Ix"
+
+ #define NORETURN __declspec(noreturn)
+
+ // Use non-standard defines in <cmath>
+ #define _USE_MATH_DEFINES
+
#elif defined(__GNUC__)
// TODO: Can GCC explicitly mark classes as abstract (no instances can be created)?
@@ -38,6 +50,29 @@
// Some portability macros :)
#define stricmp strcasecmp
+ #define FORMATSTRING(formatIndex, va_argsIndex) __attribute__((format (printf, formatIndex, va_argsIndex)))
+
+ #if defined(_WIN32)
+ // We're compiling on MinGW, which uses an old MSVCRT library that has no support for size_t printfing.
+ // We need direct size formats:
+ #if defined(_WIN64)
+ #define SIZE_T_FMT "%I64u"
+ #define SIZE_T_FMT_PRECISION(x) "%" #x "I64u"
+ #define SIZE_T_FMT_HEX "%I64x"
+ #else
+ #define SIZE_T_FMT "%u"
+ #define SIZE_T_FMT_PRECISION(x) "%" #x "u"
+ #define SIZE_T_FMT_HEX "%x"
+ #endif
+ #else
+ // We're compiling on Linux, so we can use libc's size_t printf format:
+ #define SIZE_T_FMT "%zu"
+ #define SIZE_T_FMT_PRECISION(x) "%" #x "zu"
+ #define SIZE_T_FMT_HEX "%zx"
+ #endif
+
+ #define NORETURN __attribute((__noreturn__))
+
#else
#error "You are using an unsupported compiler, you might need to #define some stuff here for your compiler"
@@ -74,6 +109,8 @@ typedef unsigned long long UInt64;
typedef unsigned int UInt32;
typedef unsigned short UInt16;
+typedef unsigned char Byte;
+
@@ -94,7 +131,7 @@ typedef unsigned short UInt16;
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
- #define _WIN32_WINNT 0x501 // We want to target WinXP and higher
+ #define _WIN32_WINNT 0x502 // We want to target WinXP SP2 and higher
#include <Windows.h>
#include <winsock2.h>
@@ -175,7 +212,8 @@ typedef unsigned short UInt16;
#include "StringUtils.h"
#include "OSSupport/CriticalSection.h"
#include "OSSupport/File.h"
-#include "MCLogger.h"
+#include "OSSupport/Event.h"
+#include "Logger.h"