From 64716dad74dbb4d29153292073ffc4245e269512 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Mon, 16 May 2016 16:17:22 -0700 Subject: [PATCH] makefile: Fix MinGW build to allow C++ compiles --- makefile | 6 +++++- sim_disk.c | 2 +- sim_sock.c | 12 ++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/makefile b/makefile index 07338de9..6d7cfcab 100644 --- a/makefile +++ b/makefile @@ -763,7 +763,11 @@ else endif GCC_VERSION = $(word 3,$(shell $(GCC) --version)) COMPILER_NAME = GCC Version: $(GCC_VERSION) - CC_STD = -std=gnu99 + ifeq (,$(findstring ++,$(GCC))) + CC_STD = -std=gnu99 + else + CPP_BUILD = 1 + endif LTO_EXCLUDE_VERSIONS = 4.5.2 ifeq (,$(PATH_SEPARATOR)) PATH_SEPARATOR := ; diff --git a/sim_disk.c b/sim_disk.c index 5bc0de8a..14496bec 100644 --- a/sim_disk.c +++ b/sim_disk.c @@ -1676,7 +1676,7 @@ errno = EINVAL; #endif struct _device_type { int32 Type; - char *desc; + const char *desc; } DeviceTypes[] = { {FILE_DEVICE_8042_PORT, "8042_PORT"}, {FILE_DEVICE_ACPI, "ACPI"}, diff --git a/sim_sock.c b/sim_sock.c index f76ea546..8a2dbd78 100644 --- a/sim_sock.c +++ b/sim_sock.c @@ -445,21 +445,19 @@ static HINSTANCE hLib = 0; /* handle to DLL */ static void *hLib = NULL; /* handle to Library */ #endif static int lib_loaded = 0; /* 0=not loaded, 1=loaded, 2=library load failed, 3=Func load failed */ -static char* lib_name = "Ws2_32.dll"; +static const char* lib_name = "Ws2_32.dll"; /* load function pointer from DLL */ typedef int (*_func)(); -static void load_function(char* function, _func* func_ptr) { +static void load_function(const char* function, _func* func_ptr) { #ifdef _WIN32 *func_ptr = (_func)GetProcAddress(hLib, function); #else *func_ptr = (_func)dlsym(hLib, function); #endif if (*func_ptr == 0) { - char* msg = "Sockets: Failed to find function '%s' in %s\r\n"; - - sim_printf (msg, function, lib_name); + sim_printf ("Sockets: Failed to find function '%s' in %s\r\n", function, lib_name); lib_loaded = 3; } } @@ -476,9 +474,7 @@ int load_ws2(void) { #endif if (hLib == 0) { /* failed to load DLL */ - char* msg = "Sockets: Failed to load %s\r\n"; - - sim_printf (msg, lib_name); + sim_printf ("Sockets: Failed to load %s\r\n", lib_name); lib_loaded = 2; break; } else {