1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

MinGW: Remove support

This commit is contained in:
reuk 2024-06-26 13:55:00 +01:00
parent 8a4ec206f2
commit 9112911122
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
89 changed files with 337 additions and 1694 deletions

View file

@ -47,10 +47,6 @@
#include <stdarg.h>
#include <inttypes.h>
#if JUCE_MINGW
#undef PRId64
#define PRId64 "lld"
#endif
#include <string.h>
#include <assert.h>

View file

@ -61,18 +61,12 @@
#if JUCE_WINDOWS
#include <ctime>
#if JUCE_MINGW
#include <ws2spi.h>
#include <cstdio>
#include <locale.h>
#else
JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4091)
#include <Dbghelp.h>
JUCE_END_IGNORE_WARNINGS_MSVC
JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4091)
#include <Dbghelp.h>
JUCE_END_IGNORE_WARNINGS_MSVC
#if ! JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
#pragma comment (lib, "DbgHelp.lib")
#endif
#if ! JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
#pragma comment (lib, "DbgHelp.lib")
#endif
#else

View file

@ -55,7 +55,6 @@
OSXFrameworks: Cocoa Foundation IOKit Security
iOSFrameworks: Foundation
linuxLibs: rt dl pthread
mingwLibs: uuid wsock32 wininet version ole32 ws2_32 oleaut32 imm32 comdlg32 shlwapi rpcrt4 winmm
END_JUCE_MODULE_DECLARATION

View file

@ -94,7 +94,7 @@ using uint32 = unsigned int;
using pointer_sized_uint = unsigned int;
#endif
#if JUCE_WINDOWS && ! JUCE_MINGW
#if JUCE_WINDOWS
using ssize_t = pointer_sized_int;
#endif

View file

@ -128,16 +128,8 @@
#include <mmsystem.h>
#include <winioctl.h>
#if JUCE_MINGW
#include <basetyps.h>
#include <sys/time.h>
#ifndef alloca
#define alloca __builtin_alloca
#endif
#else
#include <crtdbg.h>
#include <comutil.h>
#endif
#include <crtdbg.h>
#include <comutil.h>
#ifndef S_FALSE
#define S_FALSE (1) // (apparently some obscure win32 dev environments don't define this)
@ -150,7 +142,7 @@
#pragma warning (4: 4511 4512 4100)
#endif
#if ! JUCE_MINGW && ! JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
#if ! JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES
#pragma comment (lib, "kernel32.lib")
#pragma comment (lib, "user32.lib")
#pragma comment (lib, "wininet.lib")

View file

@ -35,7 +35,7 @@
namespace juce
{
#if (JUCE_MINGW && JUCE_32BIT) || (! defined (_MSC_VER) && ! defined (__uuidof))
#if ! defined (_MSC_VER) && ! defined (__uuidof)
#ifdef __uuidof
#undef __uuidof
#endif

View file

@ -547,13 +547,8 @@ namespace MACAddressHelpers
static void split (const sockaddr_in6* sa_in6, int off, uint8* split)
{
#if JUCE_MINGW
split[0] = sa_in6->sin6_addr._S6_un._S6_u8[off + 1];
split[1] = sa_in6->sin6_addr._S6_un._S6_u8[off];
#else
split[0] = sa_in6->sin6_addr.u.Byte[off + 1];
split[1] = sa_in6->sin6_addr.u.Byte[off];
#endif
}
static IPAddress createAddress (const sockaddr_in6* sa_in6)

View file

@ -48,13 +48,6 @@ void Logger::outputDebugString (const String& text)
static int findNumberOfPhysicalCores() noexcept
{
#if JUCE_MINGW
// Not implemented in MinGW
jassertfalse;
return 1;
#else
DWORD bufferSize = 0;
GetLogicalProcessorInformation (nullptr, &bufferSize);
@ -78,8 +71,6 @@ static int findNumberOfPhysicalCores() noexcept
{
return info.Relationship == RelationProcessorCore;
});
#endif // JUCE_MINGW
}
//==============================================================================
@ -89,7 +80,7 @@ static int findNumberOfPhysicalCores() noexcept
#pragma intrinsic (__rdtsc)
#endif
#if JUCE_MINGW || JUCE_CLANG
#if JUCE_CLANG
static void callCPUID (int result[4], uint32 type)
{
uint32 la = (uint32) result[0], lb = (uint32) result[1],
@ -253,66 +244,34 @@ static DebugFlagsInitialiser debugFlagsInitialiser;
#endif
//==============================================================================
#if JUCE_MINGW
static uint64 getWindowsVersion()
{
auto filename = _T ("kernel32.dll");
DWORD handle = 0;
RTL_OSVERSIONINFOW getWindowsVersionInfo();
RTL_OSVERSIONINFOW getWindowsVersionInfo()
{
RTL_OSVERSIONINFOW versionInfo = {};
if (auto size = GetFileVersionInfoSize (filename, &handle))
{
HeapBlock<char> data (size);
if (auto* moduleHandle = ::GetModuleHandleW (L"ntdll.dll"))
{
using RtlGetVersion = LONG (WINAPI*) (PRTL_OSVERSIONINFOW);
if (GetFileVersionInfo (filename, handle, size, data))
{
VS_FIXEDFILEINFO* info = nullptr;
UINT verSize = 0;
if (auto* rtlGetVersion = (RtlGetVersion) ::GetProcAddress (moduleHandle, "RtlGetVersion"))
{
versionInfo.dwOSVersionInfoSize = sizeof (versionInfo);
LONG STATUS_SUCCESS = 0;
if (VerQueryValue (data, (LPCTSTR) _T ("\\"), (void**) &info, &verSize))
if (size > 0 && info != nullptr && info->dwSignature == 0xfeef04bd)
return ((uint64) info->dwFileVersionMS << 32) | (uint64) info->dwFileVersionLS;
}
}
if (rtlGetVersion (&versionInfo) != STATUS_SUCCESS)
versionInfo = {};
}
}
return 0;
}
#else
RTL_OSVERSIONINFOW getWindowsVersionInfo();
RTL_OSVERSIONINFOW getWindowsVersionInfo()
{
RTL_OSVERSIONINFOW versionInfo = {};
if (auto* moduleHandle = ::GetModuleHandleW (L"ntdll.dll"))
{
using RtlGetVersion = LONG (WINAPI*) (PRTL_OSVERSIONINFOW);
if (auto* rtlGetVersion = (RtlGetVersion) ::GetProcAddress (moduleHandle, "RtlGetVersion"))
{
versionInfo.dwOSVersionInfoSize = sizeof (versionInfo);
LONG STATUS_SUCCESS = 0;
if (rtlGetVersion (&versionInfo) != STATUS_SUCCESS)
versionInfo = {};
}
}
return versionInfo;
}
#endif
return versionInfo;
}
SystemStats::OperatingSystemType SystemStats::getOperatingSystemType()
{
#if JUCE_MINGW
const auto v = getWindowsVersion();
const auto major = (v >> 48) & 0xffff;
const auto minor = (v >> 32) & 0xffff;
const auto build = (v >> 16) & 0xffff;
#else
const auto versionInfo = getWindowsVersionInfo();
const auto major = versionInfo.dwMajorVersion;
const auto minor = versionInfo.dwMinorVersion;
const auto build = versionInfo.dwBuildNumber;
#endif
jassert (major <= 10); // need to add support for new version!

View file

@ -338,7 +338,7 @@ namespace SocketHelpers
auto h = handle.load();
#if JUCE_WINDOWS || JUCE_MINGW
#if JUCE_WINDOWS
struct timeval timeout;
struct timeval* timeoutp;

View file

@ -160,7 +160,7 @@
/** Quote the argument, turning it into a string. */
#define JUCE_TO_STRING(x) #x
#if JUCE_CLANG || JUCE_GCC || JUCE_MINGW
#if JUCE_CLANG || JUCE_GCC
#define JUCE_IGNORE_GCC_IMPL_(compiler, warning)
#define JUCE_IGNORE_GCC_IMPL_0(compiler, warning)
#define JUCE_IGNORE_GCC_IMPL_1(compiler, warning) \

View file

@ -128,11 +128,6 @@ JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4514 4245 4100)
JUCE_END_IGNORE_WARNINGS_MSVC
#if JUCE_MINGW
#include <cstring>
#include <sys/types.h>
#endif
#if JUCE_ANDROID
#include <cstring>
#include <byteswap.h>

View file

@ -190,7 +190,7 @@ String SystemStats::getStackBacktrace()
{
String result;
#if JUCE_ANDROID || JUCE_MINGW || JUCE_WASM
#if JUCE_ANDROID || JUCE_WASM
jassertfalse; // sorry, not implemented yet!
#elif JUCE_WINDOWS

View file

@ -111,6 +111,7 @@
#ifdef __MINGW32__
#define JUCE_MINGW 1
#warning Support for MinGW has been removed. Please use an alternative compiler.
#ifdef __MINGW64__
#define JUCE_64BIT 1
#else

View file

@ -275,7 +275,7 @@ public:
int compareIgnoreCase (const CharPointer_ASCII other) const
{
#if JUCE_MINGW || (JUCE_WINDOWS && JUCE_CLANG)
#if JUCE_WINDOWS && JUCE_CLANG
return CharacterFunctions::compareIgnoreCase (*this, other);
#elif JUCE_WINDOWS
return stricmp (data, other.data);
@ -345,7 +345,7 @@ public:
/** Parses this string as a 64-bit integer. */
int64 getIntValue64() const noexcept
{
#if JUCE_LINUX || JUCE_BSD || JUCE_ANDROID || JUCE_MINGW
#if JUCE_LINUX || JUCE_BSD || JUCE_ANDROID
return atoll (data);
#elif JUCE_WINDOWS
return _atoi64 (data);

View file

@ -478,7 +478,7 @@ public:
/** Parses this string as a 64-bit integer. */
int64 getIntValue64() const noexcept
{
#if JUCE_WINDOWS && ! JUCE_MINGW
#if JUCE_WINDOWS
return _atoi64 (data);
#else
return atoll (data);

View file

@ -447,8 +447,6 @@ public:
CHARPTR_DOUBLE_PAIR_COMBOS (1.7976931348623157e+308),
CHARPTR_DOUBLE_PAIR_COMBOS (2.2250738585072014e-308),
// Too many sig figs. The parsing routine on MinGW gets the last
// significant figure wrong.
CHARPTR_DOUBLE_PAIR_COMBOS (17654321098765432.9),
CHARPTR_DOUBLE_PAIR_COMBOS (183456789012345678.9),
CHARPTR_DOUBLE_PAIR_COMBOS (1934567890123456789.9),

View file

@ -161,12 +161,11 @@ public:
constexpr auto inf = std::numeric_limits<double>::infinity();
bool isNegative = false;
#if ! JUCE_MINGW
constexpr const int maxSignificantDigits = 17 + 1; // An additional digit for rounding
constexpr const int bufferSize = maxSignificantDigits + 7 + 1; // -.E-XXX and a trailing null-terminator
char buffer[(size_t) bufferSize] = {};
char* writePtr = &(buffer[0]);
#endif
const auto endOfWhitspace = text.findEndOfWhitespace();
text = endOfWhitspace;
@ -177,9 +176,7 @@ public:
{
case '-':
isNegative = true;
#if ! JUCE_MINGW
*writePtr++ = '-';
#endif
JUCE_FALLTHROUGH
case '+':
c = *++text;
@ -220,113 +217,6 @@ public:
break;
}
#if JUCE_MINGW
// MinGW does not have access to the locale functions required for strtold, so we parse the doubles
// ourselves. There are some edge cases where the least significant digit will be wrong!
double result[3] = { 0 }, accumulator[2] = { 0 };
int exponentAdjustment[2] = { 0 }, exponentAccumulator[2] = { -1, -1 };
int exponent = 0, decPointIndex = 0, digit = 0;
int lastDigit = 0, numSignificantDigits = 0;
bool digitsFound = false;
constexpr const int maxSignificantDigits = 17 + 1;
for (;;)
{
if (text.isDigit())
{
lastDigit = digit;
digit = (int) text.getAndAdvance() - '0';
digitsFound = true;
if (decPointIndex != 0)
exponentAdjustment[1]++;
if (numSignificantDigits == 0 && digit == 0)
continue;
if (++numSignificantDigits > maxSignificantDigits)
{
if (digit > 5)
++accumulator [decPointIndex];
else if (digit == 5 && (lastDigit & 1) != 0)
++accumulator [decPointIndex];
if (decPointIndex > 0)
exponentAdjustment[1]--;
else
exponentAdjustment[0]++;
while (text.isDigit())
{
++text;
if (decPointIndex == 0)
exponentAdjustment[0]++;
}
}
else
{
const auto maxAccumulatorValue = (double) ((std::numeric_limits<unsigned int>::max() - 9) / 10);
if (accumulator [decPointIndex] > maxAccumulatorValue)
{
result [decPointIndex] = mulexp10 (result [decPointIndex], exponentAccumulator [decPointIndex])
+ accumulator [decPointIndex];
accumulator [decPointIndex] = 0;
exponentAccumulator [decPointIndex] = 0;
}
accumulator [decPointIndex] = accumulator[decPointIndex] * 10 + digit;
exponentAccumulator [decPointIndex]++;
}
}
else if (decPointIndex == 0 && *text == '.')
{
++text;
decPointIndex = 1;
if (numSignificantDigits > maxSignificantDigits)
{
while (text.isDigit())
++text;
break;
}
}
else
{
break;
}
}
result[0] = mulexp10 (result[0], exponentAccumulator[0]) + accumulator[0];
if (decPointIndex != 0)
result[1] = mulexp10 (result[1], exponentAccumulator[1]) + accumulator[1];
c = *text;
if ((c == 'e' || c == 'E') && digitsFound)
{
auto negativeExponent = false;
switch (*++text)
{
case '-': negativeExponent = true; JUCE_FALLTHROUGH
case '+': ++text;
}
while (text.isDigit())
exponent = (exponent * 10) + ((int) text.getAndAdvance() - '0');
if (negativeExponent)
exponent = -exponent;
}
auto r = mulexp10 (result[0], exponent + exponentAdjustment[0]);
if (decPointIndex != 0)
r += mulexp10 (result[1], exponent - exponentAdjustment[1]);
return isNegative ? -r : r;
#else // ! JUCE_MINGW
int numSigFigs = 0, extraExponent = 0;
bool decimalPointFound = false, leadingZeros = false;
@ -460,8 +350,6 @@ public:
return strtod_l (&buffer[0], nullptr, locale);
#endif
#endif
#endif // JUCE_MINGW
}
/** Parses a character string, to read a floating-point value. */

View file

@ -39,11 +39,7 @@ namespace TimeHelpers
{
static std::tm millisToLocal (int64 millis) noexcept
{
#if JUCE_WINDOWS && JUCE_MINGW
auto now = (time_t) (millis / 1000);
return *localtime (&now);
#elif JUCE_WINDOWS
#if JUCE_WINDOWS
std::tm result;
millis /= 1000;
@ -65,11 +61,7 @@ namespace TimeHelpers
static std::tm millisToUTC (int64 millis) noexcept
{
#if JUCE_WINDOWS && JUCE_MINGW
auto now = (time_t) (millis / 1000);
return *gmtime (&now);
#elif JUCE_WINDOWS
#if JUCE_WINDOWS
std::tm result;
millis /= 1000;
@ -231,7 +223,7 @@ Time::Time (int year, int month, int day,
//==============================================================================
int64 Time::currentTimeMillis() noexcept
{
#if JUCE_WINDOWS && ! JUCE_MINGW
#if JUCE_WINDOWS
struct _timeb t;
_ftime_s (&t);
return ((int64) t.time) * 1000 + t.millitm;