mirror of
https://github.com/darlinghq/darling-libobjc2.git
synced 2024-11-27 22:20:35 +00:00
Fix building without GC support. Still need to make sure that some of the GC functions always work, since they are expected to be no-ops in non-GC mode.
This commit is contained in:
parent
01237af0fc
commit
fcc47bc7ce
@ -84,6 +84,7 @@ ifeq ($(boehm_gc), yes)
|
||||
libobjc_C_FILES += gc_boehm.c
|
||||
libobjc_LIBRARIES_DEPEND_UPON += -lgc-threaded
|
||||
libobjc_OBJCFLAGS += -fobjc-gc
|
||||
libobjc_CPPFLAGS += -DENABLE_GC
|
||||
endif
|
||||
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include <stdio.h>
|
||||
#include "gc_ops.h"
|
||||
#define I_HIDE_POINTERS
|
||||
#include <gc.h>
|
||||
#include <gc/gc.h>
|
||||
#include <gc/gc_typed.h>
|
||||
|
||||
#ifndef __clang__
|
||||
|
10
gc_none.c
10
gc_none.c
@ -3,6 +3,7 @@
|
||||
#include "gc_ops.h"
|
||||
#include "class.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static id allocate_class(Class cls, size_t extraBytes)
|
||||
{
|
||||
@ -24,3 +25,12 @@ PRIVATE struct gc_ops *gc = &gc_ops_none;
|
||||
|
||||
PRIVATE BOOL isGCEnabled = NO;
|
||||
|
||||
#ifndef ENABLE_GC
|
||||
PRIVATE void enableGC(BOOL exclusive)
|
||||
{
|
||||
fprintf(stderr, "Attempting to enable garbage collection, but your"
|
||||
"Objective-C runtime was built without garbage collection"
|
||||
"support\n");
|
||||
abort();
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user