Skip to content

Commit 6cd94b7

Browse files
committed
win32: Add/update a handful of defines for Win32 without MinGW/Cygwin.
* Thanks to Windows.h, BOOL must be an int on win32.
1 parent 44988ee commit 6cd94b7

File tree

5 files changed

+9
-3
lines changed

5 files changed

+9
-3
lines changed

legacy_malloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ void *objc_atomic_malloc(size_t size)
1414
return malloc(size);
1515
}
1616

17-
#ifdef __MINGW32__
17+
#if defined(__MINGW32__) || defined(_WINDOWS)
1818
void *objc_valloc(size_t size)
1919
{
2020
return malloc(size);

mutation.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <stdio.h>
22
#include <stdlib.h>
33
#include "objc/runtime.h"
4+
#include "visibility.h"
45

56
static void objc_enumeration_mutation_fallback(id object)
67
{
@@ -13,7 +14,7 @@ static void objc_enumeration_mutation_fallback(id object)
1314
// This function is exported as a weak symbol to enable GNUstep or some other
1415
// framework to replace it trivially. On platforms with linkers that cannot handle weak exports,
1516
// the objc_enumeration_mutation hook is the preferred override point.
16-
void __attribute__((weak)) objc_enumerationMutation(id obj)
17+
void WEAK_EXPORT objc_enumerationMutation(id obj)
1718
{
1819
_objc_enumeration_mutation(obj);
1920
}

objc/runtime.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,11 @@ typedef signed char BOOL;
127127
# ifdef __vxwords
128128
typedef int BOOL;
129129
# else
130+
# if defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
131+
typedef int BOOL;
132+
# else
130133
typedef unsigned char BOOL;
134+
# endif
131135
# endif
132136
# endif
133137

spinlock.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#ifdef __MINGW32__
1+
#if defined(__MINGW32__) || defined(_WINDOWS)
22
#include <windows.h>
33
static unsigned sleep(unsigned seconds)
44
{

visibility.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@
2222

2323
#define LIKELY(x) __builtin_expect(x, 1)
2424
#define UNLIKELY(x) __builtin_expect(x, 0)
25+
#define WEAK_EXPORT __attribute__((weak))

0 commit comments

Comments
 (0)