From aa61d87c6d556a1848e41850f12c4c8cd80bcba3 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 18 Aug 2024 09:51:03 +0200 Subject: Add @since for definitions added in version 1.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libsimple.h | 14 +++++++------- libsimple/aligned_realloc.h | 32 ++++++++++++++++++++++++++++++++ libsimple/aligned_strdup.h | 8 ++++++++ libsimple/aligned_strndup.h | 8 ++++++++ libsimple/aligned_wcsdup.h | 8 ++++++++ libsimple/aligned_wcsndup.h | 8 ++++++++ libsimple/aligned_wmemdup.h | 8 ++++++++ libsimple/realloc.h | 14 ++++++++++++++ libsimple/wcsdup.h | 6 ++++++ libsimple/wcsndup.h | 8 ++++++++ libsimple/wmemdup.h | 8 ++++++++ 11 files changed, 115 insertions(+), 7 deletions(-) diff --git a/libsimple.h b/libsimple.h index 28d884c..3ee1e90 100644 --- a/libsimple.h +++ b/libsimple.h @@ -197,20 +197,20 @@ libsimple_unlist(void *__list, size_t __i, size_t *__np, size_t __width) #define _LIBSIMPLE_REMOVE_CONST(X, TYPE, ...) (*(TYPE *)(void *)&(X)) -#define LIBSIMPLE_REMOVE_CONST(...) _LIBSIMPLE_REMOVE_CONST(__VA_ARGS__, void *) /* TODO test, doc, man */ +#define LIBSIMPLE_REMOVE_CONST(...) _LIBSIMPLE_REMOVE_CONST(__VA_ARGS__, void *) /* TODO test, doc, man (since 1.2) */ #ifndef REMOVE_CONST # define REMOVE_CONST(...) LIBSIMPLE_REMOVE_CONST(__VA_ARGS__) #endif -#define LIBSIMPLE_PREFETCH_RDONLY(ADDRESS, LOCALITY) /* void */ /* TODO test, doc, man */\ +#define LIBSIMPLE_PREFETCH_RDONLY(ADDRESS, LOCALITY) /* void */ /* TODO test, doc, man (since 1.2) */\ _LIBSIMPLE_GCC_ONLY(__builtin_prefetch(ADDRESS, 0, LOCALITY)) #ifndef PREFETCH_RDONLY # define PREFETCH_RDONLY(...) LIBSIMPLE_PREFETCH_RDONLY(__VA_ARGS__) #endif -#define LIBSIMPLE_PREFETCH_RDWR(ADDRESS, LOCALITY) /* void */ /* TODO test, doc, man */\ +#define LIBSIMPLE_PREFETCH_RDWR(ADDRESS, LOCALITY) /* void */ /* TODO test, doc, man (since 1.2) */\ _LIBSIMPLE_GCC_ONLY(__builtin_prefetch(ADDRESS, 1, LOCALITY)) #ifndef PREFETCH_RDWR # define PREFETCH_RDWR(...) LIBSIMPLE_PREFETCH_RDWR(__VA_ARGS__) @@ -220,7 +220,7 @@ libsimple_unlist(void *__list, size_t __i, size_t *__np, size_t __width) #define _LIBSIMPLE_ASSUME_ALIGNED(PTR, ALIGNMENT, ...)\ _LIBSIMPLE_GCC_ONLY(__builtin_assume_aligned(PTR, ALIGNMENT)) #if defined(__GNUC__) && !defined(__clang__) -# define LIBSIMPLE_ASSUME_ALIGNED(PTR, ...) /* returns PTR */ /* TODO test, doc, man */\ +# define LIBSIMPLE_ASSUME_ALIGNED(PTR, ...) /* returns PTR */ /* TODO test, doc, man (since 1.2) */\ _LIBSIMPLE_GCC_ONLY(__builtin_assume_aligned(PTR, ##__VA_ARGS__,\ _LIBSIMPLE_C11_ONLY(_Alignof(PTR))\ _LIBSIMPLE_PREC11_ONLY(__alignof(PTR)))) @@ -230,20 +230,20 @@ libsimple_unlist(void *__list, size_t __i, size_t *__np, size_t __width) #endif -#define LIBSIMPLE_ASSUME_MISALIGNED(PTR, ALIGNMENT, OFFSET) /* returns PTR */ /* TODO test, doc, man */\ +#define LIBSIMPLE_ASSUME_MISALIGNED(PTR, ALIGNMENT, OFFSET) /* returns PTR */ /* TODO test, doc, man (since 1.2) */\ __builtin_assume_aligned(PTR, ALIGNMENT, OFFSET) #ifndef ASSUME_MISALIGNED # define ASSUME_MISALIGNED(...) LIBSIMPLE_ASSUME_MISALIGNED(__VA_ARGS__) #endif -#define LIBSIMPLE_UNROLLED(N) _LIBSIMPLE_GCC_ONLY(_LIBSIMPLE_C11_ONLY(_Pragma("GCC unroll "#N))) /* TODO test, doc, man */ +#define LIBSIMPLE_UNROLLED(N) _LIBSIMPLE_GCC_ONLY(_LIBSIMPLE_C11_ONLY(_Pragma("GCC unroll "#N))) /* TODO test, doc, man (since 1.2) */ #ifndef UNROLLED # define UNROLLED(N) LIBSIMPLE_UNROLLED(N) #endif -#define LIBSIMPLE_SIMDLOOP _LIBSIMPLE_GCC_ONLY(_LIBSIMPLE_C11_ONLY(_Pragma("GCC ivdep"))) /* TODO test, doc, man */ +#define LIBSIMPLE_SIMDLOOP _LIBSIMPLE_GCC_ONLY(_LIBSIMPLE_C11_ONLY(_Pragma("GCC ivdep"))) /* TODO test, doc, man (since 1.2) */ #ifndef SIMDLOOP # define SIMDLOOP LIBSIMPLE_SIMDLOOP #endif diff --git a/libsimple/aligned_realloc.h b/libsimple/aligned_realloc.h index 1da7ba7..b4926e4 100644 --- a/libsimple/aligned_realloc.h +++ b/libsimple/aligned_realloc.h @@ -26,6 +26,8 @@ * @throws EINVAL `alignment` is not a valid alignment * @throws ENOMEM Could not allocated enough memory * @throws ENOSYS Not implemented (requires non-standard libc functions) + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__alloc_align__(2), __alloc_size__(3), __warn_unused_result__))) #if defined(__GLIBC__) @@ -88,6 +90,8 @@ libsimple_aligned_realloc(void *__ptr, size_t __alignment, size_t __n) * this function is unspecified for the value 0 * @return Either `ptr` or a unique pointer with at least * the specified size + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__alloc_align__(3), __alloc_size__(4), __warn_unused_result__, __returns_nonnull__))) void *libsimple_enaligned_realloc(int, void *, size_t, size_t); @@ -120,6 +124,8 @@ void *libsimple_enaligned_realloc(int, void *, size_t, size_t); * this function is unspecified for the value 0 * @return Either `ptr` or a unique pointer with at least * the specified size + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__alloc_align__(2), __alloc_size__(3), __warn_unused_result__, __returns_nonnull__))) static inline void *libsimple_ealigned_realloc(void *__ptr, size_t __alignment, size_t __n) @@ -154,6 +160,8 @@ static inline void *libsimple_ealigned_realloc(void *__ptr, size_t __alignment, * @throws EINVAL `n` is 0 * @throws EINVAL `alignment` is not a valid alignment * @throws ENOMEM Could not allocated enough memory + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__alloc_align__(2), __alloc_size__(3), __warn_unused_result__))) static inline void * @@ -197,6 +205,8 @@ libsimple_aligned_reallocf(void *__ptr, size_t __alignment, size_t __n) /* TODO * @throws EINVAL `alignment` is not a valid alignment * @throws ENOMEM Could not allocated enough memory * @throws ENOSYS Not implemented (requires non-standard libc functions) + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__alloc_align__(2), __alloc_size__(3, 4), __warn_unused_result__))) static inline void * @@ -241,6 +251,8 @@ libsimple_aligned_reallocarray(void *__ptr, size_t __alignment, size_t __n, size * this function is unspecified for the value 0 * @return Either `ptr` or a unique pointer with at least * the specified size + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__alloc_align__(3), __alloc_size__(4, 5), __warn_unused_result__, __returns_nonnull__))) void *libsimple_enaligned_reallocarray(int, void *, size_t, size_t, size_t); @@ -277,6 +289,8 @@ void *libsimple_enaligned_reallocarray(int, void *, size_t, size_t, size_t); * this function is unspecified for the value 0 * @return Either `ptr` or a unique pointer with at least * the specified size + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__alloc_align__(2), __alloc_size__(3, 4), __warn_unused_result__, __returns_nonnull__))) static inline void *libsimple_ealigned_reallocarray(void *__ptr, size_t __alignment, size_t __n, size_t __m) @@ -310,6 +324,8 @@ static inline void *libsimple_ealigned_reallocarray(void *__ptr, size_t __alignm * @throws EINVAL `alignment` is not a valid alignment * @throws ENOMEM Could not allocated enough memory * @throws ENOSYS Not implemented (requires non-standard libc functions) + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__alloc_align__(2), __alloc_size__(3, 4), __warn_unused_result__))) static inline void * @@ -354,6 +370,8 @@ libsimple_aligned_reallocarrayf(void *__ptr, size_t __alignment, size_t __n, siz * @throws EINVAL `alignment` is not a valid alignment * @throws ENOMEM Could not allocated enough memory * @throws ENOSYS Not implemented (requires non-standard libc functions) + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__alloc_align__(2), __warn_unused_result__))) void *libsimple_valigned_reallocn(void *, size_t, size_t, va_list); @@ -392,6 +410,8 @@ void *libsimple_valigned_reallocn(void *, size_t, size_t, va_list); * list must end with 0 (which is not factor) * @return Either `ptr` or a unique pointer with at least * the specified size + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__alloc_align__(3), __warn_unused_result__, __returns_nonnull__))) void *libsimple_envaligned_reallocn(int, void *, size_t, size_t, va_list); @@ -429,6 +449,8 @@ void *libsimple_envaligned_reallocn(int, void *, size_t, size_t, va_list); * list must end with 0 (which is not factor) * @return Either `ptr` or a unique pointer with at least * the specified size + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__alloc_align__(2), __warn_unused_result__, __returns_nonnull__))) static inline void *libsimple_evaligned_reallocn(void *__ptr, size_t __alignment, size_t __n, va_list __ap) @@ -463,6 +485,8 @@ static inline void *libsimple_evaligned_reallocn(void *__ptr, size_t __alignment * @throws EINVAL `alignment` is not a valid alignment * @throws ENOMEM Could not allocated enough memory * @throws ENOSYS Not implemented (requires non-standard libc functions) + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__alloc_align__(2), __warn_unused_result__))) static inline void * @@ -507,6 +531,8 @@ libsimple_valigned_reallocfn(void *__ptr, size_t __alignment, size_t __n, va_lis * @throws EINVAL `alignment` is not a valid alignment * @throws ENOMEM Could not allocated enough memory * @throws ENOSYS Not implemented (requires non-standard libc functions) + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__alloc_align__(2), __warn_unused_result__))) static inline void * @@ -552,6 +578,8 @@ libsimple_aligned_reallocn(void *__ptr, size_t __alignment, size_t __n, ... /*, * list must end with 0 (which is not factor) * @return Either `ptr` or a unique pointer with at least * the specified size + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__alloc_align__(3), __warn_unused_result__, __returns_nonnull__))) static inline void * @@ -596,6 +624,8 @@ libsimple_enaligned_reallocn(int __status, void *__ptr, size_t __alignment, size * list must end with 0 (which is not factor) * @return Either `ptr` or a unique pointer with at least * the specified size + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__alloc_align__(2), __warn_unused_result__, __returns_nonnull__))) static inline void * @@ -640,6 +670,8 @@ libsimple_ealigned_reallocn(void *__ptr, size_t __alignment, size_t __n, ... /*, * @throws EINVAL `alignment` is not a valid alignment * @throws ENOMEM Could not allocated enough memory * @throws ENOSYS Not implemented (requires non-standard libc functions) + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__alloc_align__(2), __warn_unused_result__))) static inline void * diff --git a/libsimple/aligned_strdup.h b/libsimple/aligned_strdup.h index 07b7edf..44b0b5e 100644 --- a/libsimple/aligned_strdup.h +++ b/libsimple/aligned_strdup.h @@ -7,6 +7,8 @@ * @param s:const char * The string to copy * @param alignment:size_t The alignment of the returned pointer * @return :char * Duplicate of `s` with automatic storage + * + * @since 1.2 */ #if defined(__GNUC__) || defined(__clang__) # define libsimple_aligned_strdupa(s, alignment)\ @@ -35,6 +37,8 @@ * @param s The string to copy * @param alignment The alignment of the returned pointer * @return Duplicate of `s`, `NULL` on failure + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__malloc__, __alloc_align__(2), __nonnull__, __warn_unused_result__))) static inline char *libsimple_aligned_strdup(const char * __s, size_t __alignment) @@ -51,6 +55,8 @@ static inline char *libsimple_aligned_strdup(const char * __s, size_t __alignmen * @param s The string to copy * @param alignment The alignment of the returned pointer * @return Duplicate of `s` + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__malloc__, __alloc_align__(3), __nonnull__, __warn_unused_result__, __returns_nonnull__))) char *libsimple_enaligned_strdup(int, const char *, size_t); @@ -65,6 +71,8 @@ char *libsimple_enaligned_strdup(int, const char *, size_t); * @param s The string to copy * @param alignment The alignment of the returned pointer * @return Duplicate of `s` + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__malloc__, __alloc_align__(2), __nonnull__, __warn_unused_result__, __returns_nonnull__))) static inline char *libsimple_ealigned_strdup(const char *__s, size_t __alignment) diff --git a/libsimple/aligned_strndup.h b/libsimple/aligned_strndup.h index 16a3aac..5a8ca79 100644 --- a/libsimple/aligned_strndup.h +++ b/libsimple/aligned_strndup.h @@ -8,6 +8,8 @@ * @param alignment:size_t The alignment of the returned pointer * @param n:size_t The maximum number of bytes to copy * @return :char * Duplicate of `s` with automatic storage + * + * @since 1.2 */ #if defined(__GNUC__) || defined(__clang__) # define libsimple_aligned_strndupa(s, alignment, n)\ @@ -39,6 +41,8 @@ * @param alignment The alignment of the returned pointer * @param n The maximum number of bytes to copy * @return Duplicate of `s`, `NULL` on failure + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__malloc__, __alloc_align__(2), __nonnull__, __warn_unused_result__))) char *libsimple_aligned_strndup(const char * __s, size_t __alignment, size_t __n); @@ -55,6 +59,8 @@ char *libsimple_aligned_strndup(const char * __s, size_t __alignment, size_t __n * @param alignment The alignment of the returned pointer * @param n The maximum number of bytes to copy * @return Duplicate of `s` + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__malloc__, __alloc_align__(3), __nonnull__, __warn_unused_result__, __returns_nonnull__))) char *libsimple_enaligned_strndup(int, const char *, size_t, size_t); @@ -70,6 +76,8 @@ char *libsimple_enaligned_strndup(int, const char *, size_t, size_t); * @param alignment The alignment of the returned pointer * @param n The maximum number of bytes to copy * @return Duplicate of `s` + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__malloc__, __alloc_align__(2), __nonnull__, __warn_unused_result__, __returns_nonnull__))) static inline char *libsimple_ealigned_strndup(const char *__s, size_t __alignment, size_t __n) diff --git a/libsimple/aligned_wcsdup.h b/libsimple/aligned_wcsdup.h index 527d210..d08bcbf 100644 --- a/libsimple/aligned_wcsdup.h +++ b/libsimple/aligned_wcsdup.h @@ -7,6 +7,8 @@ * @param s:const wchar_t * The string to copy * @param alignment:size_t The alignment of the returned pointer * @return :wchar_t * Duplicate of `s` with automatic storage + * + * @since 1.2 */ #if defined(__GNUC__) || defined(__clang__) # define libsimple_aligned_wcsdupa(s, alignment)\ @@ -35,6 +37,8 @@ * @param s The string to copy * @param alignment The alignment of the returned pointer * @return Duplicate of `s`, `NULL` on failure + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__malloc__, __alloc_align__(2), __nonnull__, __warn_unused_result__))) static inline wchar_t *libsimple_aligned_wcsdup(const wchar_t * __s, size_t __alignment) @@ -51,6 +55,8 @@ static inline wchar_t *libsimple_aligned_wcsdup(const wchar_t * __s, size_t __al * @param s The string to copy * @param alignment The alignment of the returned pointer * @return Duplicate of `s` + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__malloc__, __alloc_align__(3), __nonnull__, __warn_unused_result__, __returns_nonnull__))) wchar_t *libsimple_enaligned_wcsdup(int, const wchar_t *, size_t); @@ -65,6 +71,8 @@ wchar_t *libsimple_enaligned_wcsdup(int, const wchar_t *, size_t); * @param s The string to copy * @param alignment The alignment of the returned pointer * @return Duplicate of `s` + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__malloc__, __alloc_align__(2), __nonnull__, __warn_unused_result__, __returns_nonnull__))) static inline wchar_t *libsimple_ealigned_wcsdup(const wchar_t *__s, size_t __alignment) diff --git a/libsimple/aligned_wcsndup.h b/libsimple/aligned_wcsndup.h index 015d1dc..5982c0b 100644 --- a/libsimple/aligned_wcsndup.h +++ b/libsimple/aligned_wcsndup.h @@ -8,6 +8,8 @@ * @param alignment:size_t The alignment of the returned pointer * @param n:size_t The maximum number of wide characters to copy * @return :wchar_t * Duplicate of `s` with automatic storage + * + * @since 1.2 */ #if defined(__GNUC__) || defined(__clang__) # define libsimple_aligned_wcsndupa(s, alignment, n)\ @@ -39,6 +41,8 @@ * @param alignment The alignment of the returned pointer * @param n The maximum number of wide characters to copy * @return Duplicate of `s`, `NULL` on failure + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__malloc__, __alloc_align__(2), __nonnull__, __warn_unused_result__))) wchar_t *libsimple_aligned_wcsndup(const wchar_t * __s, size_t __alignment, size_t __n); @@ -55,6 +59,8 @@ wchar_t *libsimple_aligned_wcsndup(const wchar_t * __s, size_t __alignment, size * @param alignment The alignment of the returned pointer * @param n The maximum number of wide characters to copy * @return Duplicate of `s` + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__malloc__, __alloc_align__(3), __nonnull__, __warn_unused_result__, __returns_nonnull__))) wchar_t *libsimple_enaligned_wcsndup(int, const wchar_t *, size_t, size_t); @@ -70,6 +76,8 @@ wchar_t *libsimple_enaligned_wcsndup(int, const wchar_t *, size_t, size_t); * @param alignment The alignment of the returned pointer * @param n The maximum number of wide characters to copy * @return Duplicate of `s` + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__malloc__, __alloc_align__(2), __nonnull__, __warn_unused_result__, __returns_nonnull__))) static inline wchar_t *libsimple_ealigned_wcsndup(const wchar_t *__s, size_t __alignment, size_t __n) diff --git a/libsimple/aligned_wmemdup.h b/libsimple/aligned_wmemdup.h index 63a9d40..d19b826 100644 --- a/libsimple/aligned_wmemdup.h +++ b/libsimple/aligned_wmemdup.h @@ -8,6 +8,8 @@ * @param alignment:size_t The alignment of the returned pointer * @param n:size_t The number of wide characters to copy * @return :wchar_t * Duplicate of `s` with automatic storage + * + * @since 1.2 */ #if defined(__GNUC__) || defined(__clang__) # define libsimple_aligned_wmemdupa(s, alignment, n)\ @@ -39,6 +41,8 @@ * @param alignment The alignment of the returned pointer * @param n The number of wide characters to copy * @return Duplicate of `s`, `NULL` on failure + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__malloc__, __alloc_align__(2), __alloc_size__(3), __nonnull__, __warn_unused_result__))) wchar_t *libsimple_aligned_wmemdup(const wchar_t *, size_t, size_t); @@ -55,6 +59,8 @@ wchar_t *libsimple_aligned_wmemdup(const wchar_t *, size_t, size_t); * @param alignment The alignment of the returned pointer * @param n The number of wide characters to copy * @return Duplicate of `s` + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__malloc__, __alloc_align__(3), __alloc_size__(4), __warn_unused_result__, __returns_nonnull__))) wchar_t *libsimple_enaligned_wmemdup(int, const wchar_t *, size_t, size_t); @@ -70,6 +76,8 @@ wchar_t *libsimple_enaligned_wmemdup(int, const wchar_t *, size_t, size_t); * @param alignment The alignment of the returned pointer * @param n The number of wide characters to copy * @return Duplicate of `s` + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__malloc__, __alloc_align__(2), __alloc_size__(3), __warn_unused_result__, __returns_nonnull__))) static inline wchar_t *libsimple_ealigned_wmemdup(const wchar_t *__s, size_t __alignment, size_t __n) diff --git a/libsimple/realloc.h b/libsimple/realloc.h index 32a5f59..0d487f5 100644 --- a/libsimple/realloc.h +++ b/libsimple/realloc.h @@ -322,6 +322,8 @@ libsimple_ereallocn(void *__ptr, size_t __n, ... /*, (size_t)0 */) * `alignof(max_align_t)`; `NULL` on failure * @throws EINVAL `n` is 0 * @throws ENOMEM Could not allocated enough memory + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__alloc_size__(2), __warn_unused_result__))) static inline void * @@ -360,6 +362,8 @@ libsimple_reallocf(void *__ptr, size_t __n) /* TODO test */ * `alignof(max_align_t)`; `NULL` on failure * @throws EINVAL `n` or `m` is 0 * @throws ENOMEM Could not allocated enough memory + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__alloc_size__(2, 3), __warn_unused_result__))) static inline void * @@ -401,6 +405,8 @@ libsimple_reallocarray(void *__ptr, size_t __n, size_t __m) * @return Either `ptr` or a unique pointer with at least * the specified size and with the alignment * `alignof(max_align_t)` + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__alloc_size__(3, 4), __warn_unused_result__, __returns_nonnull__))) void *libsimple_enreallocarray(int, void *, size_t, size_t); @@ -434,6 +440,8 @@ void *libsimple_enreallocarray(int, void *, size_t, size_t); * @return Either `ptr` or a unique pointer with at least * the specified size and with the alignment * `alignof(max_align_t)` + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__alloc_size__(2, 3), __warn_unused_result__, __returns_nonnull__))) static inline void *libsimple_ereallocarray(void *__ptr, size_t __n, size_t __m) @@ -466,6 +474,8 @@ static inline void *libsimple_ereallocarray(void *__ptr, size_t __n, size_t __m) * `alignof(max_align_t)`; `NULL` on failure * @throws EINVAL `n` or `m` is 0 * @throws ENOMEM Could not allocated enough memory + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__alloc_size__(2, 3), __warn_unused_result__))) static inline void * @@ -505,6 +515,8 @@ libsimple_reallocarrayf(void *__ptr, size_t __n, size_t __m) /* TODO test */ * `alignof(max_align_t)`; `NULL` on failure * @throws EINVAL `n` is 0 * @throws ENOMEM Could not allocated enough memory + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__warn_unused_result__))) static inline void * @@ -544,6 +556,8 @@ libsimple_vreallocfn(void *__ptr, size_t __n, va_list __ap) /* TODO test (reallo * `alignof(max_align_t)`; `NULL` on failure * @throws EINVAL `n` is 0 * @throws ENOMEM Could not allocated enough memory + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__warn_unused_result__))) static inline void * diff --git a/libsimple/wcsdup.h b/libsimple/wcsdup.h index b85d265..153d1eb 100644 --- a/libsimple/wcsdup.h +++ b/libsimple/wcsdup.h @@ -6,6 +6,8 @@ * * @param s:const wchar_t * The string to copy * @return :wchar_t * Duplicate of `s` with automatic storage + * + * @since 1.2 */ #if defined(__GNUC__) || defined(__clang__) # define libsimple_wcsdupa(s)\ @@ -27,6 +29,8 @@ * @param status Exit value in case of failure * @param s The string to copy * @return Duplicate of `s` + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__malloc__, _libsimple_assume_aligned_as(wchar_t), __nonnull__, __warn_unused_result__, __returns_nonnull__))) @@ -41,6 +45,8 @@ wchar_t *libsimple_enwcsdup(int, const wchar_t *); * * @param s The string to copy * @return Duplicate of `s` + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__malloc__, _libsimple_assume_aligned_as(wchar_t), __nonnull__, __warn_unused_result__, __returns_nonnull__))) diff --git a/libsimple/wcsndup.h b/libsimple/wcsndup.h index 31e9118..c68da7d 100644 --- a/libsimple/wcsndup.h +++ b/libsimple/wcsndup.h @@ -7,6 +7,8 @@ * @param s:const wchar_t * The string to copy * @param n:size_t The maximum number of wide characters to copy * @return :wchar_t * Duplicate of `s` with automatic storage + * + * @since 1.2 */ #if defined(__GNUC__) || defined(__clang__) # define libsimple_wcsndupa(s, n)\ @@ -31,6 +33,8 @@ * @param s The string to copy * @param n The maximum number of wide characters to copy * @return Duplicate of `s` + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__malloc__, _libsimple_assume_aligned_as(wchar_t), __nonnull__, __warn_unused_result__))) @@ -47,6 +51,8 @@ wchar_t *libsimple_wcsndup(const wchar_t *, size_t); * @param s The string to copy * @param n The maximum number of wide characters to copy * @return Duplicate of `s` + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__malloc__, _libsimple_assume_aligned_as(wchar_t), __nonnull__, __warn_unused_result__, __returns_nonnull__))) @@ -62,6 +68,8 @@ wchar_t *libsimple_enwcsndup(int, const wchar_t *, size_t); * @param s The string to copy * @param n The maximum number of wide characters to copy * @return Duplicate of `s` + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__malloc__, _libsimple_assume_aligned_as(wchar_t), __nonnull__, __warn_unused_result__, __returns_nonnull__))) diff --git a/libsimple/wmemdup.h b/libsimple/wmemdup.h index 2c1f899..2b213cb 100644 --- a/libsimple/wmemdup.h +++ b/libsimple/wmemdup.h @@ -7,6 +7,8 @@ * @param s:const wchar_t * The wide characters to copy * @param n:size_t The number of wide characters to copy * @return :wchar_t * Duplicate of `s` with automatic storage + * + * @since 1.2 */ #if defined(__GNUC__) || defined(__clang__) # define libsimple_wmemdupa(s, n)\ @@ -28,6 +30,8 @@ * @param s The wide characters to copy * @param n The number of wide characters to copy * @return Duplicate of `s`, `NULL` on failure + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__malloc__, _libsimple_assume_aligned_as(wchar_t), __alloc_size__(2), __warn_unused_result__))) wchar_t *libsimple_wmemdup(const wchar_t *, size_t); @@ -43,6 +47,8 @@ wchar_t *libsimple_wmemdup(const wchar_t *, size_t); * @param s The wide characters to copy * @param n The number of wide characters to copy * @return Duplicate of `s` + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__malloc__, _libsimple_assume_aligned_as(wchar_t), __alloc_size__(3), __warn_unused_result__, __returns_nonnull__))) @@ -58,6 +64,8 @@ wchar_t *libsimple_enwmemdup(int, const wchar_t *, size_t); * @param s The wide characters to copy * @param n The number of wide characters to copy * @return Duplicate of `s` + * + * @since 1.2 */ _LIBSIMPLE_GCC_ONLY(__attribute__((__malloc__, _libsimple_assume_aligned_as(wchar_t), __alloc_size__(2), __warn_unused_result__, __returns_nonnull__))) -- cgit v1.2.3-70-g09d2