# endif
#endif /* GC_ADD_CALLER */
-GC_API void * GC_CALL GC_debug_malloc(size_t lb, GC_EXTRA_PARAMS)
+GC_API GC_ATTR_MALLOC void * GC_CALL GC_debug_malloc(size_t lb,
+ GC_EXTRA_PARAMS)
{
void * result;
return (GC_store_debug_info(result, (word)lb, s, i));
}
-GC_API void * GC_CALL GC_debug_malloc_ignore_off_page(size_t lb,
- GC_EXTRA_PARAMS)
+GC_API GC_ATTR_MALLOC void * GC_CALL
+ GC_debug_malloc_ignore_off_page(size_t lb, GC_EXTRA_PARAMS)
{
void * result = GC_malloc_ignore_off_page(lb + DEBUG_BYTES);
return (GC_store_debug_info(result, (word)lb, s, i));
}
-GC_API void * GC_CALL GC_debug_malloc_atomic_ignore_off_page(size_t lb,
- GC_EXTRA_PARAMS)
+GC_API GC_ATTR_MALLOC void * GC_CALL
+ GC_debug_malloc_atomic_ignore_off_page(size_t lb, GC_EXTRA_PARAMS)
{
void * result = GC_malloc_atomic_ignore_off_page(lb + DEBUG_BYTES);
#endif /* DBG_HDRS_ALL */
#ifdef STUBBORN_ALLOC
- GC_API void * GC_CALL GC_debug_malloc_stubborn(size_t lb, GC_EXTRA_PARAMS)
+ GC_API GC_ATTR_MALLOC void * GC_CALL GC_debug_malloc_stubborn(size_t lb,
+ GC_EXTRA_PARAMS)
{
void * result = GC_malloc_stubborn(lb + DEBUG_BYTES);
#else /* !STUBBORN_ALLOC */
- GC_API void * GC_CALL GC_debug_malloc_stubborn(size_t lb, GC_EXTRA_PARAMS)
+ GC_API GC_ATTR_MALLOC void * GC_CALL GC_debug_malloc_stubborn(size_t lb,
+ GC_EXTRA_PARAMS)
{
return GC_debug_malloc(lb, OPT_RA s, i);
}
const void * p GC_ATTR_UNUSED) {}
#endif /* !STUBBORN_ALLOC */
-GC_API void * GC_CALL GC_debug_malloc_atomic(size_t lb, GC_EXTRA_PARAMS)
+GC_API GC_ATTR_MALLOC void * GC_CALL GC_debug_malloc_atomic(size_t lb,
+ GC_EXTRA_PARAMS)
{
void * result = GC_malloc_atomic(lb + DEBUG_BYTES);
return (GC_store_debug_info(result, (word)lb, s, i));
}
-GC_API char * GC_CALL GC_debug_strdup(const char *str, GC_EXTRA_PARAMS)
+GC_API GC_ATTR_MALLOC char * GC_CALL GC_debug_strdup(const char *str,
+ GC_EXTRA_PARAMS)
{
char *copy;
size_t lb;
return copy;
}
-GC_API char * GC_CALL GC_debug_strndup(const char *str, size_t size,
- GC_EXTRA_PARAMS)
+GC_API GC_ATTR_MALLOC char * GC_CALL GC_debug_strndup(const char *str,
+ size_t size, GC_EXTRA_PARAMS)
{
char *copy;
size_t len = strlen(str); /* str is expected to be non-NULL */
#ifdef GC_REQUIRE_WCSDUP
# include <wchar.h> /* for wcslen() */
- GC_API wchar_t * GC_CALL GC_debug_wcsdup(const wchar_t *str, GC_EXTRA_PARAMS)
+ GC_API GC_ATTR_MALLOC wchar_t * GC_CALL GC_debug_wcsdup(const wchar_t *str,
+ GC_EXTRA_PARAMS)
{
size_t lb = (wcslen(str) + 1) * sizeof(wchar_t);
wchar_t *copy = GC_debug_malloc_atomic(lb, OPT_RA s, i);
}
#endif /* GC_REQUIRE_WCSDUP */
-GC_API void * GC_CALL GC_debug_malloc_uncollectable(size_t lb,
- GC_EXTRA_PARAMS)
+GC_API GC_ATTR_MALLOC void * GC_CALL GC_debug_malloc_uncollectable(size_t lb,
+ GC_EXTRA_PARAMS)
{
void * result = GC_malloc_uncollectable(lb + UNCOLLECTABLE_DEBUG_BYTES);
}
#ifdef ATOMIC_UNCOLLECTABLE
- GC_API void * GC_CALL GC_debug_malloc_atomic_uncollectable(size_t lb,
- GC_EXTRA_PARAMS)
+ GC_API GC_ATTR_MALLOC void * GC_CALL
+ GC_debug_malloc_atomic_uncollectable(size_t lb, GC_EXTRA_PARAMS)
{
void * result =
GC_malloc_atomic_uncollectable(lb + UNCOLLECTABLE_DEBUG_BYTES);
return(result);
}
-GC_API void * GC_CALL GC_debug_generic_or_special_malloc(size_t lb, int knd,
- GC_EXTRA_PARAMS)
+GC_API GC_ATTR_MALLOC void * GC_CALL
+ GC_debug_generic_or_special_malloc(size_t lb, int knd, GC_EXTRA_PARAMS)
{
switch (knd) {
# ifdef STUBBORN_ALLOC
#endif /* !GC_NO_FINALIZATION */
-GC_API void * GC_CALL GC_debug_malloc_replacement(size_t lb)
+GC_API GC_ATTR_MALLOC void * GC_CALL GC_debug_malloc_replacement(size_t lb)
{
return GC_debug_malloc(lb, GC_DBG_EXTRAS);
}
STATIC void * GC_core_finalized_malloc(size_t lb,
const struct GC_finalizer_closure *fclos)
#else
- GC_API void * GC_CALL GC_finalized_malloc(size_t lb,
+ GC_API GC_ATTR_MALLOC void * GC_CALL GC_finalized_malloc(size_t lb,
const struct GC_finalizer_closure *fclos)
#endif
{
}
#ifdef THREAD_LOCAL_ALLOC
- GC_API void * GC_CALL GC_finalized_malloc(size_t client_lb,
+ GC_API GC_ATTR_MALLOC void * GC_CALL GC_finalized_malloc(size_t client_lb,
const struct GC_finalizer_closure *fclos)
{
size_t lb = client_lb + sizeof(void *);
GC_INNER void * GC_core_gcj_malloc(size_t lb,
void * ptr_to_struct_containing_descr)
#else
- GC_API void * GC_CALL GC_gcj_malloc(size_t lb,
+ GC_API GC_ATTR_MALLOC void * GC_CALL GC_gcj_malloc(size_t lb,
void * ptr_to_struct_containing_descr)
#endif
{
/* Similar to GC_gcj_malloc, but add debug info. This is allocated */
/* with GC_gcj_debug_kind. */
-GC_API void * GC_CALL GC_debug_gcj_malloc(size_t lb,
+GC_API GC_ATTR_MALLOC void * GC_CALL GC_debug_gcj_malloc(size_t lb,
void * ptr_to_struct_containing_descr, GC_EXTRA_PARAMS)
{
void * result;
}
/* There is no THREAD_LOCAL_ALLOC for GC_gcj_malloc_ignore_off_page(). */
-GC_API void * GC_CALL GC_gcj_malloc_ignore_off_page(size_t lb,
+GC_API GC_ATTR_MALLOC void * GC_CALL GC_gcj_malloc_ignore_off_page(size_t lb,
void * ptr_to_struct_containing_descr)
{
ptr_t op;
size_t GC_dbg_collect_at_malloc_min_lb = (GC_COLLECT_AT_MALLOC);
#endif
-GC_API void * GC_CALL GC_generic_malloc(size_t lb, int k)
+GC_API GC_ATTR_MALLOC void * GC_CALL GC_generic_malloc(size_t lb, int k)
{
void * result;
DCL_LOCK_STATE;
#ifdef THREAD_LOCAL_ALLOC
GC_INNER void * GC_core_malloc_atomic(size_t lb)
#else
- GC_API void * GC_CALL GC_malloc_atomic(size_t lb)
+ GC_API GC_ATTR_MALLOC void * GC_CALL GC_malloc_atomic(size_t lb)
#endif
{
void *op;
#ifdef THREAD_LOCAL_ALLOC
GC_INNER void * GC_core_malloc(size_t lb)
#else
- GC_API void * GC_CALL GC_malloc(size_t lb)
+ GC_API GC_ATTR_MALLOC void * GC_CALL GC_malloc(size_t lb)
#endif
{
void *op;
}
/* Allocate lb bytes of pointerful, traced, but not collectible data. */
-GC_API void * GC_CALL GC_malloc_uncollectable(size_t lb)
+GC_API GC_ATTR_MALLOC void * GC_CALL GC_malloc_uncollectable(size_t lb)
{
void *op;
size_t lg;
return hhdr -> hb_obj_kind;
}
-GC_API void * GC_CALL GC_generic_or_special_malloc(size_t lb, int knd)
+GC_API GC_ATTR_MALLOC void * GC_CALL GC_generic_or_special_malloc(size_t lb,
+ int knd)
{
switch(knd) {
# ifdef STUBBORN_ALLOC
}
} else {
/* grow */
- void * result =
- GC_generic_or_special_malloc((word)lb, obj_kind);
+ void * result = GC_generic_or_special_malloc((word)lb, obj_kind);
if (result == 0) return(0);
BCOPY(p, result, sz);
/* Allocate memory such that only pointers to near the */
/* beginning of the object are considered. */
/* We avoid holding allocation lock while we clear the memory. */
-GC_API void * GC_CALL GC_generic_malloc_ignore_off_page(size_t lb, int k)
+GC_API GC_ATTR_MALLOC void * GC_CALL
+ GC_generic_malloc_ignore_off_page(size_t lb, int k)
{
void *result;
size_t lg;
}
}
-GC_API void * GC_CALL GC_malloc_ignore_off_page(size_t lb)
+GC_API GC_ATTR_MALLOC void * GC_CALL GC_malloc_ignore_off_page(size_t lb)
{
return GC_generic_malloc_ignore_off_page(lb, NORMAL);
}
-GC_API void * GC_CALL GC_malloc_atomic_ignore_off_page(size_t lb)
+GC_API GC_ATTR_MALLOC void * GC_CALL
+ GC_malloc_atomic_ignore_off_page(size_t lb)
{
return GC_generic_malloc_ignore_off_page(lb, PTRFREE);
}
/* Note that the "atomic" version of this would be unsafe, since the */
/* links would not be seen by the collector. */
-GC_API void * GC_CALL GC_malloc_many(size_t lb)
+GC_API GC_ATTR_MALLOC void * GC_CALL GC_malloc_many(size_t lb)
{
void *result;
/* Debug version is tricky and currently missing. */
#include <limits.h>
-GC_API void * GC_CALL GC_memalign(size_t align, size_t lb)
+GC_API GC_ATTR_MALLOC void * GC_CALL GC_memalign(size_t align, size_t lb)
{
size_t new_lb;
size_t offset;
/* Allocate lb bytes of pointer-free, untraced, uncollectible data */
/* This is normally roughly equivalent to the system malloc. */
/* But it may be useful if malloc is redefined. */
- GC_API void * GC_CALL GC_malloc_atomic_uncollectable(size_t lb)
+ GC_API GC_ATTR_MALLOC void * GC_CALL
+ GC_malloc_atomic_uncollectable(size_t lb)
{
void *op;
size_t lg;
/* provide a version of strdup() that uses the collector to allocate the
copy of the string */
-GC_API char * GC_CALL GC_strdup(const char *s)
+GC_API GC_ATTR_MALLOC char * GC_CALL GC_strdup(const char *s)
{
char *copy;
size_t lb;
return copy;
}
-GC_API char * GC_CALL GC_strndup(const char *str, size_t size)
+GC_API GC_ATTR_MALLOC char * GC_CALL GC_strndup(const char *str, size_t size)
{
char *copy;
size_t len = strlen(str); /* str is expected to be non-NULL */
#ifdef GC_REQUIRE_WCSDUP
# include <wchar.h> /* for wcslen() */
- GC_API wchar_t * GC_CALL GC_wcsdup(const wchar_t *str)
+ GC_API GC_ATTR_MALLOC wchar_t * GC_CALL GC_wcsdup(const wchar_t *str)
{
size_t lb = (wcslen(str) + 1) * sizeof(wchar_t);
wchar_t *copy = GC_malloc_atomic(lb);
void GC_dirty(ptr_t p);
- GC_API void * GC_CALL GC_malloc_stubborn(size_t lb)
+ GC_API GC_ATTR_MALLOC void * GC_CALL GC_malloc_stubborn(size_t lb)
{
return(GC_malloc(lb));
}
#else /* !MANUAL_VDB */
- GC_API void * GC_CALL GC_malloc_stubborn(size_t lb)
+ GC_API GC_ATTR_MALLOC void * GC_CALL GC_malloc_stubborn(size_t lb)
{
return(GC_malloc(lb));
}
GC_bool GC_is_thread_tsd_valid(void *tsd);
#endif
-GC_API void * GC_CALL GC_malloc(size_t bytes)
+GC_API GC_ATTR_MALLOC void * GC_CALL GC_malloc(size_t bytes)
{
size_t granules = ROUNDED_UP_GRANULES(bytes);
void *tsd;
return result;
}
-GC_API void * GC_CALL GC_malloc_atomic(size_t bytes)
+GC_API GC_ATTR_MALLOC void * GC_CALL GC_malloc_atomic(size_t bytes)
{
size_t granules = ROUNDED_UP_GRANULES(bytes);
void *tsd;
/* incremental GC should be enabled before we fork a second thread. */
/* Unlike the other thread local allocation calls, we assume that the */
/* collector has been explicitly initialized. */
-GC_API void * GC_CALL GC_gcj_malloc(size_t bytes,
+GC_API GC_ATTR_MALLOC void * GC_CALL GC_gcj_malloc(size_t bytes,
void * ptr_to_struct_containing_descr)
{
if (EXPECT(GC_incremental, FALSE)) {
}
}
-GC_API void * GC_CALL GC_malloc_explicitly_typed(size_t lb, GC_descr d)
+GC_API GC_ATTR_MALLOC void * GC_CALL GC_malloc_explicitly_typed(size_t lb,
+ GC_descr d)
{
ptr_t op;
size_t lg;
return((void *) op);
}
-GC_API void * GC_CALL GC_malloc_explicitly_typed_ignore_off_page(size_t lb,
- GC_descr d)
+GC_API GC_ATTR_MALLOC void * GC_CALL
+ GC_malloc_explicitly_typed_ignore_off_page(size_t lb, GC_descr d)
{
ptr_t op;
size_t lg;
return((void *) op);
}
-GC_API void * GC_CALL GC_calloc_explicitly_typed(size_t n, size_t lb,
- GC_descr d)
+GC_API GC_ATTR_MALLOC void * GC_CALL GC_calloc_explicitly_typed(size_t n,
+ size_t lb, GC_descr d)
{
ptr_t op;
size_t lg;