Skip to content

Commit

Permalink
Add attributes
Browse files Browse the repository at this point in the history
Signed-off-by: Ran Benita <[email protected]>
  • Loading branch information
bluetech committed Jan 28, 2025
1 parent c10c9f2 commit 8a02e6c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/bump.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ align_up(char *ptr, size_t alignment)
return ptr + (aligned_addr - addr);
}

ATTR_NOINLINE static void *
ATTR_NOINLINE ATTR_MALLOC ATTR_ALLOC_ALIGN(2) static void *
bump_aligned_alloc_slow(struct bump *bump, size_t alignment, size_t size)
{
struct bump_chunk *prev_chunk = bump->current;
Expand All @@ -65,7 +65,7 @@ bump_aligned_alloc_slow(struct bump *bump, size_t alignment, size_t size)
return ptr;
}

void *
ATTR_MALLOC ATTR_ALLOC_ALIGN(2) void *
bump_aligned_alloc(struct bump *bump, size_t alignment, size_t size)
{
struct bump_chunk *chunk = bump->current;
Expand Down
6 changes: 6 additions & 0 deletions src/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,12 @@ open_file(const char *path);
#define ATTR_NOINLINE
#endif

#if defined(__GNUC__)
#define ATTR_ALLOC_ALIGN(position) __attribute__((alloc_align(position)))
#else
#define ATTR_ALLOC_ALIGN(position)
#endif

#if !(defined(HAVE_ASPRINTF) && HAVE_ASPRINTF)
XKB_EXPORT_PRIVATE int asprintf(char **strp, const char *fmt, ...) ATTR_PRINTF(2, 3);
# if !(defined(HAVE_VASPRINTF) && HAVE_VASPRINTF)
Expand Down

0 comments on commit 8a02e6c

Please sign in to comment.