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:
theraven 2011-05-25 12:25:27 +00:00
parent 01237af0fc
commit fcc47bc7ce
4 changed files with 13 additions and 1 deletions

View File

@ -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

View File

@ -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__

View File

@ -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

View File

@ -32,6 +32,7 @@ struct gc_ops
* -release / -autorelease messages become no-ops.
*/
void enableGC(BOOL exclusive);
/**
* The mode for garbage collection
*/