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.

main
theraven 15 years ago
parent 01237af0fc
commit fcc47bc7ce

@ -84,6 +84,7 @@ ifeq ($(boehm_gc), yes)
libobjc_C_FILES += gc_boehm.c libobjc_C_FILES += gc_boehm.c
libobjc_LIBRARIES_DEPEND_UPON += -lgc-threaded libobjc_LIBRARIES_DEPEND_UPON += -lgc-threaded
libobjc_OBJCFLAGS += -fobjc-gc libobjc_OBJCFLAGS += -fobjc-gc
libobjc_CPPFLAGS += -DENABLE_GC
endif endif

@ -10,7 +10,7 @@
#include <stdio.h> #include <stdio.h>
#include "gc_ops.h" #include "gc_ops.h"
#define I_HIDE_POINTERS #define I_HIDE_POINTERS
#include <gc.h> #include <gc/gc.h>
#include <gc/gc_typed.h> #include <gc/gc_typed.h>
#ifndef __clang__ #ifndef __clang__

@ -3,6 +3,7 @@
#include "gc_ops.h" #include "gc_ops.h"
#include "class.h" #include "class.h"
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
static id allocate_class(Class cls, size_t extraBytes) 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; 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

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

Loading…
Cancel
Save