From 39b5c6f45e6b84861e5edeaef323ebdf9238eaf0 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Tue, 16 Apr 2024 12:34:33 +0200 Subject: Annotate some extra functions with nodiscard --- include/alloc.h | 6 +++--- include/errors.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/alloc.h b/include/alloc.h index 0237334..01863aa 100644 --- a/include/alloc.h +++ b/include/alloc.h @@ -20,8 +20,8 @@ typedef struct { size_t _init; } arena; -[[gnu::returns_nonnull]] void *bufalloc(void *, size_t, size_t); -void *bufalloc_noterm(void *, size_t, size_t); +[[nodiscard, gnu::returns_nonnull]] void *bufalloc(void *, size_t, size_t); +[[nodiscard]] void *bufalloc_noterm(void *, size_t, size_t); [[_mlib_pure, _mlib_inline]] static inline arena @@ -30,7 +30,7 @@ mkarena(size_t n) return (arena){._init = n ? n : MLIB_ARENA_BLKSIZE}; } -[[gnu::malloc, gnu::alloc_size(2, 3), gnu::alloc_align(4)]] +[[nodiscard, gnu::malloc, gnu::alloc_size(2, 3), gnu::alloc_align(4)]] void *arena_alloc(arena *, size_t, size_t, size_t); void arena_zero(arena *); diff --git a/include/errors.h b/include/errors.h index 6e8cbce..961ecf1 100644 --- a/include/errors.h +++ b/include/errors.h @@ -15,7 +15,7 @@ extern const char *_mlib_errors_progname; void mlib_setprogname(const char *); -[[_mlib_inline]] +[[nodiscard, _mlib_inline]] static inline const char * mlib_progname(void) { -- cgit v1.2.3