Skip to content

Commit ba4cac5

Browse files
authored
Merge pull request swiftlang#213 from spevans/pr_unneeded_objc
Remove ObjC support functions not needed on non-ObjC platforms
2 parents 787dd92 + 1ec667a commit ba4cac5

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/BlocksRuntime/runtime.c

+4
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
#include <stdlib.h>
1313
#include <string.h>
1414
#include <stdint.h>
15+
#if HAVE_OBJC
1516
#define __USE_GNU
1617
#include <dlfcn.h>
18+
#endif
1719
#if __has_include(<os/assumes.h>)
1820
#include <os/assumes.h>
1921
#else
@@ -202,6 +204,7 @@ static void (*_Block_memmove)(void *dest, void *src, unsigned long size) = _Bloc
202204
static void (*_Block_destructInstance) (const void *aBlock) = _Block_destructInstance_default;
203205

204206

207+
#if HAVE_OBJC
205208
/**************************************************************************
206209
GC support SPI functions - called from ObjC runtime and CoreFoundation
207210
***************************************************************************/
@@ -252,6 +255,7 @@ void _Block_use_RR( void (*retain)(const void *),
252255
_Block_release_object = release;
253256
_Block_destructInstance = dlsym(RTLD_DEFAULT, "objc_destructInstance");
254257
}
258+
#endif // HAVE_OBJC
255259

256260
// Called from CF to indicate MRR. Newer version uses a versioned structure, so we can add more functions
257261
// without defining a new entry point.

src/Makefile.am

+2
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,10 @@ if BUILD_OWN_BLOCKS_RUNTIME
8888
libdispatch_la_SOURCES+= BlocksRuntime/data.c BlocksRuntime/runtime.c
8989
CBLOCKS_FLAGS+= -I$(top_srcdir)/src/BlocksRuntime
9090
CXXBLOCKS_FLAGS+= -I$(top_srcdir)/src/BlocksRuntime
91+
if USE_OBJC
9192
BLOCKS_RUNTIME_LIBS=-ldl
9293
endif
94+
endif
9395

9496
libdispatch_la_LDFLAGS=-avoid-version
9597
libdispatch_la_LIBADD=$(KQUEUE_LIBS) $(PTHREAD_WORKQUEUE_LIBS) $(BSD_OVERLAY_LIBS) $(BLOCKS_RUNTIME_LIBS)

0 commit comments

Comments
 (0)