Skip to content

Commit

Permalink
fix #38 remove alloc_size attribute when compiling with clang
Browse files Browse the repository at this point in the history
  • Loading branch information
Kiko Fernandez Reyes committed Dec 8, 2014
1 parent 91c04b0 commit 9c4d158
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/runtime/pony/inc/pony/pony.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,12 @@ void pony_continuation(pony_actor_t* to, uint64_t id,
* This is garbage collected memory. This can only be done while an actor is
* handling a message, so that there is a current actor.
*/
void* pony_alloc(size_t size) __attribute__((malloc,alloc_size(1)));
void* pony_alloc(size_t size)
#ifdef __clang__
__attribute__((malloc));
#else
__attribute__((malloc, alloc_size(3)));
#endif

// TODO: pony_free() for when escape analysis shows a reference doesn't survive

Expand Down
4 changes: 4 additions & 0 deletions src/runtime/pony/src/mem/heap.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ void heap_init(heap_t* heap);
void heap_destroy(heap_t* heap);

void* heap_alloc(pony_actor_t* actor, heap_t* heap, size_t size)
#ifdef __clang__
__attribute__((malloc));
#else
__attribute__((malloc,alloc_size(3)));
#endif

/**
* Adds to the used memory figure kept by the heap. This allows objects received
Expand Down

0 comments on commit 9c4d158

Please sign in to comment.