diff options
Diffstat (limited to '')
-rw-r--r-- | include/assert.h | 2 | ||||
-rw-r--r-- | include/ctype.h | 70 | ||||
-rw-r--r-- | include/err.h | 8 | ||||
-rw-r--r-- | include/errno.h | 2 | ||||
-rw-r--r-- | include/error.h | 4 | ||||
-rw-r--r-- | include/inttypes.h | 4 | ||||
-rw-r--r-- | include/libgen.h | 4 | ||||
-rw-r--r-- | include/malloc.h | 20 | ||||
-rw-r--r-- | include/slibc-alloc.h | 18 | ||||
-rw-r--r-- | include/slibc-error.h | 4 | ||||
-rw-r--r-- | include/slibc-print.h | 8 | ||||
-rw-r--r-- | include/slibc/attributes.h | 59 | ||||
-rw-r--r-- | include/stdio.h | 132 | ||||
-rw-r--r-- | include/stdlib.h | 26 | ||||
-rw-r--r-- | include/string.h | 110 | ||||
-rw-r--r-- | include/strings.h | 20 | ||||
-rw-r--r-- | include/unistd.h | 40 | ||||
-rw-r--r-- | include/wchar.h | 106 | ||||
-rw-r--r-- | src/slibc-alloc.c | 2 |
19 files changed, 342 insertions, 297 deletions
diff --git a/include/assert.h b/include/assert.h index c4faa58..9f964e0 100644 --- a/include/assert.h +++ b/include/assert.h @@ -100,7 +100,7 @@ * `NULL` if unknown (C99 is required.) */ __noreturn void __assert_fail(const char*, int, const char*, int, const char*) - __GCC_ONLY(__attribute__((nonnull(3, 5)))); + __GCC_ONLY(__attribute__((__nonnull__(3, 5)))); diff --git a/include/ctype.h b/include/ctype.h index 96b94b9..82f13af 100644 --- a/include/ctype.h +++ b/include/ctype.h @@ -41,7 +41,7 @@ * ['0', '9'], ['A', 'Z'], or ['a', 'z']. */ int (isalnum)(int) /* [0x30, 0x39], [0x41, 0x5A], [0x61, 0x7A] */ - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); #if defined (__GNUC__) # define isalnum(c) \ ({ int __c = (c); (isalpha(__c) || isdigit(__c)); }) @@ -56,7 +56,7 @@ int (isalnum)(int) /* [0x30, 0x39], [0x41, 0x5A], [0x61, 0x7A] */ * ['A', 'Z'] or ['a', 'z']. */ int (isalpha)(int) /* [0x41, 0x5A], [0x61, 0x7A] */ - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); #define isalpha(c) (islower(tolower(c))) @@ -71,7 +71,7 @@ int (isalpha)(int) /* [0x41, 0x5A], [0x61, 0x7A] */ * @return Whether the character is a ' ' or a '\t'. */ int (isblank)(int) /* ' ', '\t' */ - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); # if defined(__GNUC__) # define isblank(c) \ ({ int __c = (c); ((__c == ' ') || (__c == '\t')); }) @@ -88,7 +88,7 @@ int (isblank)(int) /* ' ', '\t' */ * or is 0x7F. */ int (iscntrl)(int) /* [0x00, 0x1F], 0x7F */ - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); #if defined(__GNUC__) # define iscntrl(c) \ ({ int __c = (c); (((unsigned)__c < ' ') || (__c == 0x7F)); }) @@ -102,7 +102,7 @@ int (iscntrl)(int) /* [0x00, 0x1F], 0x7F */ * @return Whether the character is in ['0', '9']. */ int (isdigit)(int) /* [0x30, 0x39] */ - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); #define isdigit(c) (int)((unsigned)((c) - '0') < 10) @@ -114,7 +114,7 @@ int (isdigit)(int) /* [0x30, 0x39] */ * than ' ', but is not 0x7F. */ int (isgraph)(int) /* [0x21, 0x7E] */ - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); #define isgraph(c) (int)((unsigned)(c - 0x21) < 0x5E) @@ -126,7 +126,7 @@ int (isgraph)(int) /* [0x21, 0x7E] */ * @return Whether the character is in ['a', 'z']. */ int (islower)(int) /* [0x61, 0x7A] */ - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); #define islower(c) (int)((unsigned)((c) - 'a') < 26) @@ -139,7 +139,7 @@ int (islower)(int) /* [0x61, 0x7A] */ * as great as ' ', but is not 0x7F. */ int (isprint)(int) /* [0x20, 0x7E] */ - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); #define isprint(c) (int)((unsigned)(c - 0x20) < 0x5F) @@ -151,8 +151,8 @@ int (isprint)(int) /* [0x20, 0x7E] */ * @param c The character. * @return Whether the character is a punctuation. */ -int (ispunct)(int) /* isprint && !isalnum && !isspace) */ - __GCC_ONLY(__attribute__((const))); +int (ispunct)(int) /* isprint && !isalnum && !isspace */ + __GCC_ONLY(__attribute__((__const__))); #if defined (__GNUC__) # define ispunk(c) \ ({ int __c = (c); (isprint(__c) && !isalnum(__c) && !isspace(__c)); }) @@ -167,7 +167,7 @@ int (ispunct)(int) /* isprint && !isalnum && !isspace) */ * '\n', '\r', '\t', or '\v'. */ int (isspace)(int) /* 0x20, [0x09, 0x0D] */ - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); #if defined (__GNUC__) # define isspace(c) \ ({ int __c = (c); ((__c == ' ') || ((unsigned)(__c - '\t') < 5)); }) @@ -182,7 +182,7 @@ int (isspace)(int) /* 0x20, [0x09, 0x0D] */ * @return Whether the character is in ['A', 'Z']. */ int (isupper)(int) /* [0x41, 0x5A] */ - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); #define isupper(c) (int)((unsigned)((c) - 'A') < 26) @@ -196,7 +196,7 @@ int (isupper)(int) /* [0x41, 0x5A] */ * ['0', '9'], ['A', 'Z'], or ['a', 'z']. */ int (isxdigit)(int) /* [0x30, 0x39], [0x41, 0x46], [0x61, 0x66] */ - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); #if defined (__GNUC__) # define isxdigit(c) \ ({ int __c = (c); (isdigit(__c) && (tolower(__c) - 'a' < 6)); }) @@ -219,7 +219,7 @@ int (isxdigit)(int) /* [0x30, 0x39], [0x41, 0x46], [0x61, 0x66] */ * character already is in lowercase. */ int (tolower)(int) /* [0x41, 0x5A] -> [0x61, 0x7A] */ - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); #define tolower(c) (int)((unsigned)(c) | 0x20) /** @@ -237,7 +237,7 @@ int (tolower)(int) /* [0x41, 0x5A] -> [0x61, 0x7A] */ * character already is in lowercase. */ int (toupper)(int) /* [0x61, 0x7A] -> [0x41, 0x5A] */ - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); #define toupper(c) (int)((unsigned)(c) & (unsigned)~0x20) @@ -249,7 +249,7 @@ int (toupper)(int) /* [0x61, 0x7A] -> [0x41, 0x5A] */ * @return Whether the character is an ASCII character. */ int (isascii)(int) /* [0x00, 0x7E] */ - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); #define isascii(c) (int)((unsigned)(c) < 0x7F) /** @@ -263,7 +263,7 @@ int (isascii)(int) /* [0x00, 0x7E] */ */ int (toascii)(int) __warning("Using 'toascii' is, generally, unwise.") - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); #if defined(_SLIBC_SUPPRESS_WARNINGS) # define toascii(c) (int)((unsigned)(c) & 0x7F) #endif @@ -274,7 +274,7 @@ int (toascii)(int) */ int _tolower(int) __deprecated("Use 'tolower' instead.") - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); /** * This function is identical to `tolower`. @@ -282,7 +282,7 @@ int _tolower(int) */ int _toupper(int) __deprecated("Use 'toupper' instead.") - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); @@ -297,7 +297,7 @@ int _toupper(int) */ int isalnum_l(int, locale_t) __warning("This function is dangerous, use 'iswalnum_l' instead.") - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); /** * Check whether a character is an alphabetical character. @@ -308,7 +308,7 @@ int isalnum_l(int, locale_t) */ int isalpha_l(int, locale_t) __warning("This function is dangerous, use 'iswalpha_l' instead.") - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); #if defined(__GNU_SOURCE) /** @@ -323,7 +323,7 @@ int isalpha_l(int, locale_t) */ int isblank_l(int, locale_t) __warning("This function is dangerous, use 'iswblank_l' instead.") - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); #endif /** @@ -336,7 +336,7 @@ int isblank_l(int, locale_t) */ int iscntrl_l(int, locale_t) __warning("This function is dangerous, use 'iswcntrl_l' instead.") - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); /** * Check whether a character is a decimal digit. @@ -347,7 +347,7 @@ int iscntrl_l(int, locale_t) */ int isdigit_l(int, locale_t) __warning("This function is dangerous, use 'iswdigit_l' instead.") - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); /** * Check whether a character is has a printable glyph. @@ -358,7 +358,7 @@ int isdigit_l(int, locale_t) */ int isgraph_l(int, locale_t) __warning("This function is dangerous, use 'iswgraph_l' instead.") - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); /** * Check whether a character is a lowercase @@ -370,7 +370,7 @@ int isgraph_l(int, locale_t) */ int islower_l(int, locale_t) __warning("This function is dangerous, use 'iswlower_l' instead.") - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); /** * Check whether a character is has a printable glyph @@ -383,7 +383,7 @@ int islower_l(int, locale_t) */ int isprint_l(int, locale_t) __warning("This function is dangerous, use 'iswprint_l' instead.") - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); /** * Check whether a character is has a punctuation, @@ -396,7 +396,7 @@ int isprint_l(int, locale_t) */ int ispunct_l(int, locale_t) __warning("This function is dangerous, use 'iswpunct_l' instead.") - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); /** * Check whether a character is a whitespace character. @@ -408,7 +408,7 @@ int ispunct_l(int, locale_t) */ int isspace_l(int, locale_t) __warning("This function is dangerous, use 'iswspace_l' instead.") - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); /** * Check whether a character is an uppercase @@ -420,7 +420,7 @@ int isspace_l(int, locale_t) */ int isupper_l(int, locale_t) __warning("This function is dangerous, use 'iswupper_l' instead.") - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); /** * Check whether a character is an ASCII @@ -434,7 +434,7 @@ int isupper_l(int, locale_t) */ int isxdigit_l(int, locale_t) __warning("This function is dangerous, use 'iswxdigit_l' instead.") - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); /** * Check whether a character is an ASCII character. @@ -445,7 +445,7 @@ int isxdigit_l(int, locale_t) */ int isascii_l(int, locale_t) __warning("This function is dangerous, use 'isascii_l' instead.") - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); /** * Remove the 8:th bit from a character. @@ -459,7 +459,7 @@ int isascii_l(int, locale_t) */ int toascii_l(int, locale_t) __warning("This function is dangerous, use 'towascii_l' instead.") - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); /** * Convert a uppercase ASCII character to @@ -479,7 +479,7 @@ int toascii_l(int, locale_t) */ int tolower_l(int, locale_t) __warning("This function is dangerous, use 'iswlower_l' instead.") - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); /** * Convert a lowercase ASCII character to @@ -499,7 +499,7 @@ int tolower_l(int, locale_t) */ int toupper_l(int, locale_t) __warning("This function is dangerous, use 'iswupper_l' instead.") - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); diff --git a/include/err.h b/include/err.h index 7557a04..a603cbb 100644 --- a/include/err.h +++ b/include/err.h @@ -41,7 +41,7 @@ * @param ... Formatting-arguments. */ void warn(const char*, ...) - __GCC_ONLY(__attribute__((format(slibc_printf, 1, 2)))); + __GCC_ONLY(__attribute__((__format__(__slibc_printf__, 1, 2)))); /** * Print a warning to stderr, followed by a description @@ -64,7 +64,7 @@ void vwarn(const char*, va_list); * @param ... Formatting-arguments. */ void warnx(const char*, ...) - __GCC_ONLY(__attribute__((format(slibc_printf, 1, 2)))); + __GCC_ONLY(__attribute__((__format__(__slibc_printf__, 1, 2)))); /** * Print a warning to stderr, but do not print a @@ -88,7 +88,7 @@ void vwarnx(const char*, va_list); * @param ... Formatting-arguments. */ __noreturn void err(int, const char*, ...) - __GCC_ONLY(__attribute__((format(slibc_printf, 2, 3)))); + __GCC_ONLY(__attribute__((__format__(__slibc_printf__, 2, 3)))); /** * Print an error message to stderr, followed by a @@ -113,7 +113,7 @@ __noreturn void verr(int, const char*, va_list); * @param ... Formatting-arguments. */ __noreturn void errx(int, const char*, ...) - __GCC_ONLY(__attribute__((format(slibc_printf, 2, 3)))); + __GCC_ONLY(__attribute__((__format__(__slibc_printf__, 2, 3)))); /** * Print an error message to stderr, but do not print a diff --git a/include/errno.h b/include/errno.h index deb17d8..390c463 100644 --- a/include/errno.h +++ b/include/errno.h @@ -49,7 +49,7 @@ * and supported on all revisions of C. */ volatile int* __errno(void) /* TODO not implemented */ - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); /** diff --git a/include/error.h b/include/error.h index 866690e..d6acb6e 100644 --- a/include/error.h +++ b/include/error.h @@ -45,7 +45,7 @@ * @param args Formatting-arguments for `format`. */ void error(int, int, const char*, ...) - __GCC_ONLY(__attribute__((format(slibc_printf, 3, 4)))); + __GCC_ONLY(__attribute__((__format__(__slibc_printf__, 3, 4)))); /** * Variant of `error` that uses `va_list` instead of variadic arguments. @@ -82,7 +82,7 @@ void verror(int, int, const char*, va_list); * @param args Formatting-arguments for `format`. */ void error_at_line(int, int, const char*, unsigned int, const char*, ...) - __GCC_ONLY(__attribute__((format(slibc_printf, 5, 6)))); + __GCC_ONLY(__attribute__((__format__(__slibc_printf__, 5, 6)))); /** * Variant of `verror` that prints the filename and the line diff --git a/include/inttypes.h b/include/inttypes.h index 4dffb86..5272ebc 100644 --- a/include/inttypes.h +++ b/include/inttypes.h @@ -43,7 +43,7 @@ * the remainder in `.rem`. */ imaxdiv_t imaxdiv(intmax_t, intmax_t) - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); /** * Return the absolute value of an integer. @@ -57,7 +57,7 @@ imaxdiv_t imaxdiv(intmax_t, intmax_t) * @return The absolute value of the integer. */ intmax_t imaxabs(intmax_t) - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); diff --git a/include/libgen.h b/include/libgen.h index b38bc3f..653b1c0 100644 --- a/include/libgen.h +++ b/include/libgen.h @@ -39,7 +39,7 @@ * so it must not freed or edited. */ char* __xpg_basename(char*) - __GCC_ONLY(__attribute__((warn_unused_result))); + __GCC_ONLY(__attribute__((__warn_unused_result__))); #define basename __xpg_basename /** @@ -53,7 +53,7 @@ char* __xpg_basename(char*) * must not freed or edited. */ char* dirname(char*) - __GCC_ONLY(__attribute__((warn_unused_result))); + __GCC_ONLY(__attribute__((__warn_unused_result__))); diff --git a/include/malloc.h b/include/malloc.h index c1d4a85..046cfc3 100644 --- a/include/malloc.h +++ b/include/malloc.h @@ -41,7 +41,7 @@ * @throws ENOMEM The process cannot allocate more memory. */ void* malloc(size_t) - __GCC_ONLY(__attribute__((malloc, warn_unused_result))); + __GCC_ONLY(__attribute__((__malloc__, __warn_unused_result__))); /** * Variant of `malloc` that clears the allocation with zeroes. @@ -61,7 +61,7 @@ void* malloc(size_t) * @throws ENOMEM The process cannot allocate more memory. */ void* calloc(size_t, size_t) - __GCC_ONLY(__attribute__((malloc, warn_unused_result))); + __GCC_ONLY(__attribute__((__malloc__, __warn_unused_result__))); #if !defined(__PORTABLE) /** @@ -85,7 +85,7 @@ void* calloc(size_t, size_t) */ void* zalloc(size_t) __warning("'zalloc' is klibc extension, use 'calloc(1, n)' instead of 'zalloc(n)'.") - __GCC_ONLY(__attribute__((malloc, warn_unused_result))); + __GCC_ONLY(__attribute__((__malloc__, __warn_unused_result__))); #endif /** @@ -109,7 +109,7 @@ void* zalloc(size_t) * @throws ENOMEM The process cannot allocate more memory. */ void* realloc(void*, size_t) - __GCC_ONLY(__attribute__((warn_unused_result))) + __GCC_ONLY(__attribute__((__warn_unused_result__))) __slibc_warning("Use 'fast_realloc', 'secure_realloc' or 'crealloc' instead."); /** @@ -169,7 +169,7 @@ void* memalign(size_t, size_t) # ifdef __C11__ __deprecated("'memalign' has be deprecated by 'aligned_alloc' in C11.") # endif - __GCC_ONLY(__attribute__((malloc, warn_unused_result))); + __GCC_ONLY(__attribute__((__malloc__, __warn_unused_result__))); #endif /** @@ -190,7 +190,7 @@ void* memalign(size_t, size_t) * @throws EINVAL If `boundary` is not a power-of-two multiple of `sizeof(void*)`. */ int posix_memalign(void**, size_t, size_t) - __GCC_ONLY(__attribute__((nonnull))); + __GCC_ONLY(__attribute__((__nonnull__))); #if !defined(__PORTABLE) /** @@ -210,7 +210,7 @@ int posix_memalign(void**, size_t, size_t) * @throws ENOMEM The process cannot allocate more memory. */ void* valloc(size_t) - __GCC_ONLY(__attribute__((malloc, warn_unused_result))) + __GCC_ONLY(__attribute__((__malloc__, __warn_unused_result__))) __deprecated("'valloc' is deprecated, use 'memalign' or 'posix_memalign' instead."); #endif @@ -231,7 +231,7 @@ void* valloc(size_t) * @throws ENOMEM The process cannot allocate more memory. */ void* pvalloc(size_t) - __GCC_ONLY(__attribute__((malloc, warn_unused_result))) + __GCC_ONLY(__attribute__((__malloc__, __warn_unused_result__))) __deprecated("'pvalloc' is deprecated, use 'memalign' or 'posix_memalign' instead."); #endif @@ -260,7 +260,7 @@ void* pvalloc(size_t) * @throws EINVAL If `boundary` is not a power of two. */ void* aligned_alloc(size_t, size_t) - __GCC_ONLY(__attribute__((malloc, warn_unused_result))); + __GCC_ONLY(__attribute__((__malloc__, __warn_unused_result__))); #endif @@ -275,7 +275,7 @@ void* aligned_alloc(size_t, size_t) * @return The size of the memory segment, 0 if `segment` is `NULL`. */ size_t malloc_usable_size(void*) - __GCC_ONLY(__attribute__((warn_unused_result))); + __GCC_ONLY(__attribute__((__warn_unused_result__))); #endif /* TODO add mallopt, M_TRIME_THRESHOLD, M_TOP_PAD, M_MMAP_THRESHOLD, and M_MMAP_MAX */ diff --git a/include/slibc-alloc.h b/include/slibc-alloc.h index 70b1b4c..a36c024 100644 --- a/include/slibc-alloc.h +++ b/include/slibc-alloc.h @@ -85,7 +85,7 @@ void secure_free(void*); * invoked instead. */ size_t allocsize(void*) - __GCC_ONLY(__attribute__((warn_unused_result))); + __GCC_ONLY(__attribute__((__warn_unused_result__))); /** * Variant of `realloc` that overrides newly allocated space @@ -100,7 +100,7 @@ size_t allocsize(void*) * @throws ENOMEM The process cannot allocate more memory. */ void* crealloc(void*, size_t) - __GCC_ONLY(__attribute__((warn_unused_result))); + __GCC_ONLY(__attribute__((__warn_unused_result__))); /** * This function behaves exactly like `realloc`, except it is @@ -113,7 +113,7 @@ void* crealloc(void*, size_t) * @throws ENOMEM The process cannot allocate more memory. */ void* fast_realloc(void*, size_t) - __GCC_ONLY(__attribute__((warn_unused_result))); + __GCC_ONLY(__attribute__((__warn_unused_result__))); /** * This function behaves exactly like `crealloc`, except it @@ -126,7 +126,7 @@ void* fast_realloc(void*, size_t) * @throws ENOMEM The process cannot allocate more memory. */ void* secure_realloc(void*, size_t) - __GCC_ONLY(__attribute__((warn_unused_result))); + __GCC_ONLY(__attribute__((__warn_unused_result__))); /** * This function behaves exactly like `realloc`, @@ -151,7 +151,7 @@ void* secure_realloc(void*, size_t) * @throws ENOMEM The process cannot allocate more memory. */ void* custom_realloc(void*, size_t, int, int, int) - __GCC_ONLY(__attribute__((warn_unused_result))); + __GCC_ONLY(__attribute__((__warn_unused_result__))); /** * This function is similar to `realloc`, however it @@ -177,7 +177,7 @@ void* custom_realloc(void*, size_t, int, int, int) * @throws ENOMEM The process cannot allocate more memory. */ void* extalloc(void*, size_t, enum extalloc_mode) - __GCC_ONLY(__attribute__((nonnull, warn_unused_result))); + __GCC_ONLY(__attribute__((__nonnull__, __warn_unused_result__))); /** * This function behaves exactly like `fast_realloc`, except: @@ -193,10 +193,10 @@ void* extalloc(void*, size_t, enum extalloc_mode) * @throws ENOMEM The process cannot allocate more memory. */ void* naive_realloc(void*, size_t) /* sic! we limit ourself to ASCII */ - __GCC_ONLY(__attribute__((nonnull, warn_unused_result))); + __GCC_ONLY(__attribute__((__nonnull__, __warn_unused_result__))); /** - * This function behaves exactly like `__attribute__`, except + * This function behaves exactly like `naive_realloc`, except * it will return `NULL` with `errno` set to zero, if it is * not possible to perform the shrink or growth without creating * new pointer. @@ -209,7 +209,7 @@ void* naive_realloc(void*, size_t) /* sic! we limit ourself to ASCII */ * @throws ENOMEM The process cannot allocate more memory. */ void* naive_extalloc(void*, size_t) /* sic! we limit ourself to ASCII */ - __GCC_ONLY(__attribute__((nonnull, warn_unused_result))); + __GCC_ONLY(__attribute__((__nonnull__, __warn_unused_result__))); /** diff --git a/include/slibc-error.h b/include/slibc-error.h index 8fc26bc..9c8a895 100644 --- a/include/slibc-error.h +++ b/include/slibc-error.h @@ -199,7 +199,7 @@ * Helper function to keep track of the line of origin, in a * thread-safe manner, without requiring new revisions of C. */ -int* __slibc_error_line(void) __GCC_ONLY(__attribute__((const))); /* TODO not implemented */ +int* __slibc_error_line(void) __GCC_ONLY(__attribute__((__const__))); /* TODO not implemented */ /** * Print a description of an error, and where the error occurred. @@ -222,7 +222,7 @@ int* __slibc_error_line(void) __GCC_ONLY(__attribute__((const))); /* TODO not im * @param ... Formatting-arguments for `format`. */ void slibc_perror(const char*, const char*, int, const char*, int*, const char*, const char*, ...) - __GCC_ONLY(__attribute__((nonnull(2, 4), format(slibc_printf, 7, 8)))); + __GCC_ONLY(__attribute__((__nonnull__(2, 4), __format__(__slibc_printf__, 7, 8)))); diff --git a/include/slibc-print.h b/include/slibc-print.h index b992537..9cb57da 100644 --- a/include/slibc-print.h +++ b/include/slibc-print.h @@ -149,7 +149,7 @@ typedef ssize_t (* generic_wprintf_ext_func_t)(const wchar_t*, intmax_t*, size_t */ int generic_printf(generic_printf_write_func_t, generic_printf_ext_func_t, size_t, int, size_t* restrict, int, void*, const char*, ...) - __GCC_ONLY(__attribute__((nonnull(5, 8), format(slibc_printf, 8, 9), warn_unused_result))); + __GCC_ONLY(__attribute__((__nonnull__(5, 8), __format__(__slibc_printf__, 8, 9), __warn_unused_result__))); /** * Variant of `generic_printf` that uses `va_list` @@ -180,7 +180,7 @@ int generic_printf(generic_printf_write_func_t, generic_printf_ext_func_t, */ int vgeneric_printf(generic_printf_write_func_t, generic_printf_ext_func_t, size_t, int, size_t* restrict, int, void*, const char*, va_list) - __GCC_ONLY(__attribute__((nonnull(5, 8), warn_unused_result))); + __GCC_ONLY(__attribute__((__nonnull__(5, 8), __warn_unused_result__))); /** * Variant of `generic_printf` uses `wchar_t` instead of `char`; @@ -211,7 +211,7 @@ int vgeneric_printf(generic_printf_write_func_t, generic_printf_ext_func_t, */ int generic_wprintf(generic_wprintf_write_func_t, generic_wprintf_ext_func_t, size_t, int, size_t* restrict, int, void*, const wchar_t*, ...) - __GCC_ONLY(__attribute__((nonnull(5, 8), warn_unused_result))); + __GCC_ONLY(__attribute__((__nonnull__(5, 8), __warn_unused_result__))); /** * Variant of `generic_wprintf` that uses `va_list` @@ -243,7 +243,7 @@ int generic_wprintf(generic_wprintf_write_func_t, generic_wprintf_ext_func_t, */ int vgeneric_wprintf(generic_wprintf_write_func_t, generic_wprintf_ext_func_t, size_t, int, size_t* restrict, int, void*, const wchar_t*, va_list) - __GCC_ONLY(__attribute__((nonnull(5, 8), warn_unused_result))); + __GCC_ONLY(__attribute__((__nonnull__(5, 8), __warn_unused_result__))); diff --git a/include/slibc/attributes.h b/include/slibc/attributes.h index 3243ff6..85d247c 100644 --- a/include/slibc/attributes.h +++ b/include/slibc/attributes.h @@ -49,7 +49,7 @@ * the process exits before the function returns. */ #if !defined(__C11__) && defined(__GNUC__) -# define __noreturn __attribute__((noreturn)) +# define __noreturn __attribute__((__noreturn__)) #elif defined(__C11__) # define __noreturn _Noreturn #else @@ -83,7 +83,7 @@ * function is deprecated, or functions to use instead. */ #if !defined(_SLIBC_SUPPRESS_WARNINGS) -# define __deprecated(msg) __GCC_ONLY(__attribute__((deprecated(msg)))) +# define __deprecated(msg) __GCC_ONLY(__attribute__((__deprecated__(msg)))) #else # define __deprecated(msg) /* ignore */ #endif @@ -93,7 +93,7 @@ * Warn if a function, variable or type is used. */ #if !defined(_SLIBC_SUPPRESS_WARNINGS) -# define __warning(msg) __GCC_ONLY(__attribute__((warning(msg)))) +# define __warning(msg) __GCC_ONLY(__attribute__((__warning__(msg)))) # define __slibc_warning(msg) __SLIBC_ONLY(__warning(msg)) #else # define __warning(msg) /* ignore */ @@ -113,19 +113,64 @@ #endif + /** * Format for the `format` GCC function attribute, * for `*printf` functions. */ -#ifndef slibc_printf -# define slibc_printf printf /* TODO write GCC extension */ +#ifdef slibc_printf +# undef slibc_printf +#endif +#if defined(__SLIB_SOURCE) && defined(__GNUC__) +# define __slibc_printf__ __gnu_printf__ /* TODO write GCC extension */ +#elif defined(__GNU_SOURCE) && defined(__GNUC__) +# define __slibc_printf__ __gnu_printf__ +#else +# define __slibc_printf__ __printf__ #endif /** * Format for the `format` GCC function attribute, * for `*scanf` functions. */ -#ifndef slibc_scanf -# define slibc_scanf scanf /* TODO write GCC extension */ +#ifdef slibc_scanf +# undef slibc_scanf +#endif +#if defined(__SLIB_SOURCE) && defined(__GNUC__) +# define __slibc_scanf__ __gnu_scanf__ /* TODO write GCC extension */ +#elif defined(__GNU_SOURCE) && defined(__GNUC__) +# define __slibc_scanf__ __gnu_scanf__ +#else +# define __slibc_scanf__ __scanf__ +#endif + +/** + * Format for the `format` GCC function attribute, + * for `strftime`. + */ +#ifdef slibc_strftime +# undef slibc_strftime +#endif +#if defined(__SLIB_SOURCE) && defined(__GNUC__) +# define __slibc_strftime__ __gnu_strftime__ /* TODO write GCC extension */ +#elif defined(__GNU_SOURCE) && defined(__GNUC__) +# define __slibc_strftime__ __gnu_strftime__ +#else +# define __slibc_strftime__ __strftime__ +#endif + +/** + * Format for the `format` GCC function attribute, + * for `strfmon`. + */ +#ifdef slibc_strfmon +# undef slibc_strfmon +#endif +#if defined(__SLIB_SOURCE) && defined(__GNUC__) +# define __slibc_strfmon__ __strfmon__ /* TODO write GCC extension */ +#elif defined(__GNU_SOURCE) && defined(__GNUC__) +# define __slibc_strfmon__ __strfmon__ +#else +# define __slibc_strfmon__ __strfmon__ #endif diff --git a/include/stdio.h b/include/stdio.h index 8b0f2a4..4dc0e18 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -63,7 +63,7 @@ int fflush(FILE*); * @throws Any error specified for `fwrite`. */ int printf(const char* restrict, ...) - __GCC_ONLY(__attribute__((nonnull(1), format(slibc_printf, 1, 2)))); + __GCC_ONLY(__attribute__((__nonnull__(1), __format__(__slibc_printf__, 1, 2)))); /** * Print a formatted string to a stream. @@ -86,7 +86,7 @@ int printf(const char* restrict, ...) * @throws Any error specified for `fwrite`. */ int fprintf(FILE* restrict, const char* restrict, ...) - __GCC_ONLY(__attribute__((nonnull(1, 2), format(slibc_printf, 2, 3)))); + __GCC_ONLY(__attribute__((__nonnull__(1, 2), __format__(__slibc_printf__, 2, 3)))); #if defined(__SLIBC_SOURCE) /** @@ -111,7 +111,7 @@ int fprintf(FILE* restrict, const char* restrict, ...) * @throws Any error specified for `fwrite_unlocked`. */ int fprintf_unlocked(FILE* restrict, const char* restrict, ...) - __GCC_ONLY(__attribute__((nonnull(1, 2), format(slibc_printf, 2, 3)))); + __GCC_ONLY(__attribute__((__nonnull__(1, 2), __format__(__slibc_printf__, 2, 3)))); #endif /** @@ -136,7 +136,7 @@ int fprintf_unlocked(FILE* restrict, const char* restrict, ...) * @throws Any error specified for `write`. */ int dprintf(int, const char* restrict, ...) - __GCC_ONLY(__attribute__((nonnull(2), format(slibc_printf, 2, 3)))); + __GCC_ONLY(__attribute__((__nonnull__(2), __format__(__slibc_printf__, 2, 3)))); /** * This function is identical to `fprintf`, @@ -160,7 +160,7 @@ int dprintf(int, const char* restrict, ...) * @throws EINVAL `format` contained unsupported formatting codes. */ int sprintf(char* restrict, const char* restrict, ...) - __GCC_ONLY(__attribute__((nonnull(1, 2), format(slibc_printf, 2, 3)))); + __GCC_ONLY(__attribute__((__nonnull__(1, 2), __format__(__slibc_printf__, 2, 3)))); /** * This function is identical to `sprintf`, @@ -184,7 +184,7 @@ int sprintf(char* restrict, const char* restrict, ...) * @throws EINVAL `format` contained unsupported formatting codes. */ int snprintf(char* restrict, size_t, const char* restrict, ...) - __GCC_ONLY(__attribute__((nonnull(3), format(slibc_printf, 3, 4)))); + __GCC_ONLY(__attribute__((__nonnull__(3), __format__(__slibc_printf__, 3, 4)))); #if defined(__GNU_SOURCE) /** @@ -212,7 +212,7 @@ int snprintf(char* restrict, size_t, const char* restrict, ...) * sufficient amount of memory. */ int asprintf(char** restrict, const char* restrict, ...) - __GCC_ONLY(__attribute__((nonnull(1, 2), format(slibc_printf, 2, 3), warn_unused_result))); + __GCC_ONLY(__attribute__((__nonnull__(1, 2), __format__(__slibc_printf__, 2, 3), __warn_unused_result__))); #endif #if defined(__SLIBC_SOURCE) @@ -258,7 +258,7 @@ int asprintf(char** restrict, const char* restrict, ...) * sufficient amount of memory. */ int bprintf(char** restrict, size_t* restrict, size_t, int, const char* restrict, ...) - __GCC_ONLY(__attribute__((nonnull(1, 2, 5), format(slibc_printf, 5, 6), warn_unused_result))); + __GCC_ONLY(__attribute__((__nonnull__(1, 2, 5), __format__(__slibc_printf__, 5, 6), __warn_unused_result__))); #endif @@ -281,7 +281,7 @@ int bprintf(char** restrict, size_t* restrict, size_t, int, const char* restrict * @throws Any error specified for `fwrite`. */ int vprintf(const char* restrict, va_list) - __GCC_ONLY(__attribute__((nonnull(1)))); + __GCC_ONLY(__attribute__((__nonnull__(1)))); /** * This function is identical to `fprintf`, @@ -303,7 +303,7 @@ int vprintf(const char* restrict, va_list) * @throws Any error specified for `fwrite`. */ int vfprintf(FILE* restrict, const char* restrict, va_list) - __GCC_ONLY(__attribute__((nonnull(1, 2)))); + __GCC_ONLY(__attribute__((__nonnull__(1, 2)))); #if defined(__SLIBC_SOURCE) /** @@ -328,7 +328,7 @@ int vfprintf(FILE* restrict, const char* restrict, va_list) * @throws Any error specified for `fwrite_unlocked`. */ int vfprintf_unlocked(FILE* restrict, const char* restrict, va_list) - __GCC_ONLY(__attribute__((nonnull(1, 2)))); + __GCC_ONLY(__attribute__((__nonnull__(1, 2)))); #endif /** @@ -351,7 +351,7 @@ int vfprintf_unlocked(FILE* restrict, const char* restrict, va_list) * @throws Any error specified for `write`. */ int vdprintf(int, const char* restrict, va_list) - __GCC_ONLY(__attribute__((nonnull(2)))); + __GCC_ONLY(__attribute__((__nonnull__(2)))); /** * This function is identical to `sprintf`, @@ -372,7 +372,7 @@ int vdprintf(int, const char* restrict, va_list) * @throws EINVAL `format` contained unsupported formatting codes. */ int vsprintf(char* restrict, const char* restrict, va_list) - __GCC_ONLY(__attribute__((nonnull(1, 2)))); + __GCC_ONLY(__attribute__((__nonnull__(1, 2)))); /** * This function is identical to `snprintf`, @@ -396,7 +396,7 @@ int vsprintf(char* restrict, const char* restrict, va_list) * @throws EINVAL `format` contained unsupported formatting codes. */ int vsnprintf(char* restrict, size_t, const char* restrict, va_list) - __GCC_ONLY(__attribute__((nonnull(1, 3)))); + __GCC_ONLY(__attribute__((__nonnull__(3)))); #if defined(__GNU_SOURCE) /** @@ -423,7 +423,7 @@ int vsnprintf(char* restrict, size_t, const char* restrict, va_list) * sufficient amount of memory. */ int vasprintf(char** restrict, const char* restrict, va_list) - __GCC_ONLY(__attribute__((nonnull(1, 2), warn_unused_result))); + __GCC_ONLY(__attribute__((__nonnull__(1, 2), __warn_unused_result__))); #endif #if defined(__SLIBC_SOURCE) @@ -469,7 +469,7 @@ int vasprintf(char** restrict, const char* restrict, va_list) * sufficient amount of memory. */ int vbprintf(char** restrict, size_t* restrict, size_t, int, const char* restrict, va_list) - __GCC_ONLY(__attribute__((nonnull(1, 2, 5), warn_unused_result))); + __GCC_ONLY(__attribute__((__nonnull__(1, 2, 5), __warn_unused_result__))); #endif @@ -493,7 +493,7 @@ int vbprintf(char** restrict, size_t* restrict, size_t, int, const char* restric * @throws Any error specified for `fwrite`. */ int wprintf(const wchar_t* restrict, ...) - __GCC_ONLY(__attribute__((nonnull(1)))); + __GCC_ONLY(__attribute__((__nonnull__(1)))); /** * This function is identical to `fprintf` except @@ -515,7 +515,7 @@ int wprintf(const wchar_t* restrict, ...) * @throws Any error specified for `fwrite`. */ int fwprintf(FILE* restrict, const wchar_t* restrict, ...) - __GCC_ONLY(__attribute__((nonnull(1, 2)))); + __GCC_ONLY(__attribute__((__nonnull__(1, 2)))); # if defined(__SLIBC_SOURCE) /** @@ -540,7 +540,7 @@ int fwprintf(FILE* restrict, const wchar_t* restrict, ...) * @throws Any error specified for `fwrite_unlocked`. */ int fwprintf_unlocked(FILE* restrict, const wchar_t* restrict, ...) - __GCC_ONLY(__attribute__((nonnull(1, 2)))); + __GCC_ONLY(__attribute__((__nonnull__(1, 2)))); /** * This function is identical to `dprintf` except @@ -564,7 +564,7 @@ int fwprintf_unlocked(FILE* restrict, const wchar_t* restrict, ...) * @throws Any error specified for `write`. */ int dwprintf(int, const wchar_t* restrict, ...) - __GCC_ONLY(__attribute__((nonnull(2)))); + __GCC_ONLY(__attribute__((__nonnull__(2)))); # endif /** @@ -589,7 +589,7 @@ int dwprintf(int, const wchar_t* restrict, ...) * @throws EINVAL `format` contained unsupported formatting codes. */ int swprintf(wchar_t* restrict, size_t, const wchar_t* restrict, ...) - __GCC_ONLY(__attribute__((nonnull(3)))); + __GCC_ONLY(__attribute__((__nonnull__(3)))); # if defined(__GNU_SOURCE) && defined(__SLIBC_SOURCE) /** @@ -617,7 +617,7 @@ int swprintf(wchar_t* restrict, size_t, const wchar_t* restrict, ...) * sufficient amount of memory. */ int aswprintf(wchar_t** restrict, const wchar_t* restrict, ...) - __GCC_ONLY(__attribute__((nonnull(1, 2), warn_unused_result))); + __GCC_ONLY(__attribute__((__nonnull__(1, 2), __warn_unused_result__))); # endif # if defined(__SLIBC_SOURCE) @@ -664,7 +664,7 @@ int aswprintf(wchar_t** restrict, const wchar_t* restrict, ...) * sufficient amount of memory. */ int bwprintf(wchar_t** restrict, size_t* restrict, size_t, int, const wchar_t* restrict, ...) - __GCC_ONLY(__attribute__((nonnull(1, 2, 5), warn_unused_result))); + __GCC_ONLY(__attribute__((__nonnull__(1, 2, 5), __warn_unused_result__))); # endif @@ -687,7 +687,7 @@ int bwprintf(wchar_t** restrict, size_t* restrict, size_t, int, const wchar_t* r * @throws Any error specified for `fwrite`. */ int vwprintf(const wchar_t* restrict, va_list) - __GCC_ONLY(__attribute__((nonnull(1)))); + __GCC_ONLY(__attribute__((__nonnull__(1)))); /** * This function is identical to `fwprintf`, @@ -709,7 +709,7 @@ int vwprintf(const wchar_t* restrict, va_list) * @throws Any error specified for `fwrite`. */ int vfwprintf(FILE* restrict, const wchar_t* restrict, va_list) - __GCC_ONLY(__attribute__((nonnull(1, 2)))); + __GCC_ONLY(__attribute__((__nonnull__(1, 2)))); # if defined(__SLIBC_SOURCE) /** @@ -734,7 +734,7 @@ int vfwprintf(FILE* restrict, const wchar_t* restrict, va_list) * @throws Any error specified for `fwrite_unlocked`. */ int vfwprintf_unlocked(FILE* restrict, const wchar_t* restrict, va_list) - __GCC_ONLY(__attribute__((nonnull(1, 2)))); + __GCC_ONLY(__attribute__((__nonnull__(1, 2)))); /** * This function is identical to `vdprintf`, @@ -758,7 +758,7 @@ int vfwprintf_unlocked(FILE* restrict, const wchar_t* restrict, va_list) * @throws Any error specified for `write`. */ int vdwprintf(int, const wchar_t* restrict, va_list) - __GCC_ONLY(__attribute__((nonnull(2)))); + __GCC_ONLY(__attribute__((__nonnull__(2)))); # endif /** @@ -783,7 +783,7 @@ int vdwprintf(int, const wchar_t* restrict, va_list) * @throws EINVAL `format` contained unsupported formatting codes. */ int vswprintf(wchar_t* restrict, size_t, const wchar_t* restrict, va_list) - __GCC_ONLY(__attribute__((nonnull(3)))); + __GCC_ONLY(__attribute__((__nonnull__(3)))); # if defined(__GNU_SOURCE) && defined(__SLIBC_SOURCE) /** @@ -811,7 +811,7 @@ int vswprintf(wchar_t* restrict, size_t, const wchar_t* restrict, va_list) * sufficient amount of memory. */ int vaswprintf(wchar_t** restrict, const wchar_t* restrict, va_list) - __GCC_ONLY(__attribute__((nonnull(1, 2), warn_unused_result))); + __GCC_ONLY(__attribute__((__nonnull__(1, 2), __warn_unused_result__))); # endif # if defined(__SLIBC_SOURCE) @@ -858,7 +858,7 @@ int vaswprintf(wchar_t** restrict, const wchar_t* restrict, va_list) * sufficient amount of memory. */ int vbwprintf(wchar_t** restrict, size_t* restrict, size_t, int, const wchar_t* restrict, va_list) - __GCC_ONLY(__attribute__((nonnull(1, 2, 5), warn_unused_result))); + __GCC_ONLY(__attribute__((__nonnull__(1, 2, 5), __warn_unused_result__))); # endif #endif @@ -877,7 +877,7 @@ int vbwprintf(wchar_t** restrict, size_t* restrict, size_t, int, const wchar_t* * on error. */ int scanf(const char* restrict, ...) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(1), format(slibc_scanf, 1, 2)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(1), __format__(__slibc_scanf__, 1, 2)))); /** * Parse data from from a text stream. @@ -894,7 +894,7 @@ int scanf(const char* restrict, ...) * on error. */ int fscanf(FILE* restrict, const char* restrict, ...) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(1, 2), format(slibc_scanf, 2, 3)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(1, 2), __format__(__slibc_scanf__, 2, 3)))); /** * This function is identical to `fscanf`, @@ -911,7 +911,7 @@ int fscanf(FILE* restrict, const char* restrict, ...) * on error. */ int sscanf(const char* restrict, const char* restrict, ...) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(1, 2), format(slibc_scanf, 2, 3)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(1, 2), __format__(__slibc_scanf__, 2, 3)))); #if defined(__SLIBC_SOURCE) /** @@ -930,7 +930,7 @@ int sscanf(const char* restrict, const char* restrict, ...) * on error. */ int fscanf_unlocked(FILE* restrict, const char* restrict, ...) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(1, 2), format(slibc_scanf, 2, 3)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(1, 2), __format__(__slibc_scanf__, 2, 3)))); /** * This function is identical to `scanf`, @@ -951,7 +951,7 @@ int fscanf_unlocked(FILE* restrict, const char* restrict, ...) * on error. */ int snscanf(const char* restrict, size_t, const char* restrict, ...) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(3), format(slibc_scanf, 3, 4)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(3), __format__(__slibc_scanf__, 3, 4)))); /** * This function is identical to `fscanf`, @@ -971,7 +971,7 @@ int snscanf(const char* restrict, size_t, const char* restrict, ...) * on error. */ int dscanf(int, const char* restrict, ...) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(2), format(slibc_scanf, 2, 3)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(2), __format__(__slibc_scanf__, 2, 3)))); #endif @@ -988,7 +988,7 @@ int dscanf(int, const char* restrict, ...) * on error. */ int vscanf(const char* restrict, va_list) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(1)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(1)))); /** * This function is identical to `fscanf`, @@ -1004,7 +1004,7 @@ int vscanf(const char* restrict, va_list) * on error. */ int vfscanf(FILE* restrict, const char* restrict, va_list) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(1, 2)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(1, 2)))); /** * This function is identical to `sscanf`, @@ -1020,7 +1020,7 @@ int vfscanf(FILE* restrict, const char* restrict, va_list) * on error. */ int vsscanf(const char* restrict, const char* restrict, va_list) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(1, 2)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(1, 2)))); #if defined(__SLIBC_SOURCE) /** @@ -1039,7 +1039,7 @@ int vsscanf(const char* restrict, const char* restrict, va_list) * on error. */ int vfscanf_unlocked(FILE* restrict, const char* restrict, va_list) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(1, 2)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(1, 2)))); /** * This function is identical to `snscanf`, @@ -1058,7 +1058,7 @@ int vfscanf_unlocked(FILE* restrict, const char* restrict, va_list) * on error. */ int vsnscanf(const char* restrict, size_t, const char* restrict, va_list) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(3)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(3)))); /** * This function is identical to `sscanf`, @@ -1076,7 +1076,7 @@ int vsnscanf(const char* restrict, size_t, const char* restrict, va_list) * on error. */ int vdscanf(int, const char* restrict, va_list) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(2)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(2)))); #endif @@ -1093,7 +1093,7 @@ int vdscanf(int, const char* restrict, va_list) * on error. */ int wscanf(const wchar_t* restrict, ...) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(1)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(1)))); /** * This function is identical to `fscanf`, @@ -1109,7 +1109,7 @@ int wscanf(const wchar_t* restrict, ...) * on error. */ int fwscanf(FILE* restrict, const wchar_t* restrict, ...) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(1, 2)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(1, 2)))); /** * This function is identical to `sscanf`, @@ -1125,7 +1125,7 @@ int fwscanf(FILE* restrict, const wchar_t* restrict, ...) * on error. */ int swscanf(const wchar_t* restrict, const wchar_t* restrict, ...) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(1, 2)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(1, 2)))); #if defined(__SLIBC_SOURCE) /** @@ -1144,7 +1144,7 @@ int swscanf(const wchar_t* restrict, const wchar_t* restrict, ...) * on error. */ int fwscanf_unlocked(FILE* restrict, const wchar_t* restrict, ...) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(1, 2)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(1, 2)))); /** * This function is identical to `snscanf`, @@ -1163,7 +1163,7 @@ int fwscanf_unlocked(FILE* restrict, const wchar_t* restrict, ...) * on error. */ int snwscanf(const wchar_t* restrict, size_t, const wchar_t* restrict, ...) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(3)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(3)))); /** * This function is identical to `dscanf`, @@ -1181,7 +1181,7 @@ int snwscanf(const wchar_t* restrict, size_t, const wchar_t* restrict, ...) * on error. */ int dwscanf(int, const wchar_t* restrict, ...) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(2)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(2)))); #endif @@ -1198,7 +1198,7 @@ int dwscanf(int, const wchar_t* restrict, ...) * on error. */ int vwscanf(const wchar_t* restrict, va_list) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(1)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(1)))); /** * This function is identical to `fwscanf`, @@ -1214,7 +1214,7 @@ int vwscanf(const wchar_t* restrict, va_list) * on error. */ int vfwscanf(FILE* restrict, const wchar_t* restrict, va_list) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(1, 2)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(1, 2)))); /** * This function is identical to `swscanf`, @@ -1230,7 +1230,7 @@ int vfwscanf(FILE* restrict, const wchar_t* restrict, va_list) * on error. */ int vswscanf(const wchar_t* restrict, const wchar_t* restrict, va_list) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(1, 2)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(1, 2)))); #if defined(__SLIBC_SOURCE) /** @@ -1249,7 +1249,7 @@ int vswscanf(const wchar_t* restrict, const wchar_t* restrict, va_list) * on error. */ int vfwscanf_unlocked(FILE* restrict, const wchar_t* restrict, va_list) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(1, 2)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(1, 2)))); /** * This function is identical to `snwscanf`, @@ -1268,7 +1268,7 @@ int vfwscanf_unlocked(FILE* restrict, const wchar_t* restrict, va_list) * on error. */ int vsnwscanf(const wchar_t* restrict, size_t, const wchar_t* restrict, va_list) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(3)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(3)))); /** * This function is identical to `swscanf`, @@ -1286,7 +1286,7 @@ int vsnwscanf(const wchar_t* restrict, size_t, const wchar_t* restrict, va_list) * on error. */ int vdwscanf(int, const wchar_t* restrict, va_list) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(2)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(2)))); #endif @@ -1297,21 +1297,21 @@ int vdwscanf(int, const wchar_t* restrict, va_list) */ int __isoc99_scanf(const char* restrict, ...) __deprecated("Use 'scanf' instead.") - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(1), format(slibc_scanf, 1, 2)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(1), __format__(__slibc_scanf__, 1, 2)))); /** * This function is identical to `fscanf`. */ int __isoc99_fscanf(FILE* restrict, const char* restrict, ...) __deprecated("Use 'fscanf' instead.") - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(1, 2), format(slibc_scanf, 2, 3)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(1, 2), __format__(__slibc_scanf__, 2, 3)))); /** * This function is identical to `sscanf`. */ int __isoc99_sscanf(const char* restrict, const char* restrict, ...) __deprecated("Use 'sscanf' instead.") - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(1, 2), format(slibc_scanf, 2, 3)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(1, 2), __format__(__slibc_scanf__, 2, 3)))); /** @@ -1319,21 +1319,21 @@ int __isoc99_sscanf(const char* restrict, const char* restrict, ...) */ int __isoc99_vscanf(const char* restrict, va_list) __deprecated("Use 'vscanf' instead.") - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(1)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(1)))); /** * This function is identical to `vfscanf`. */ int __isoc99_vfscanf(FILE* restrict, const char* restrict, va_list) __deprecated("Use 'vfscanf' instead.") - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(1, 2)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(1, 2)))); /** * This function is identical to `vsscanf`. */ int __isoc99_vsscanf(const char* restrict, const char* restrict, va_list) __deprecated("Use 'vsscanf' instead.") - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(1, 2)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(1, 2)))); /** @@ -1341,21 +1341,21 @@ int __isoc99_vsscanf(const char* restrict, const char* restrict, va_list) */ int __isoc99_wscanf(const wchar_t* restrict, ...) __deprecated("Use 'wscanf' instead.") - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(1)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(1)))); /** * This function is identical to `fwscanf`. */ int __isoc99_fwscanf(FILE* restrict, const wchar_t* restrict, ...) __deprecated("Use 'fwscanf' instead.") - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(1, 2)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(1, 2)))); /** * This function is identical to `swscanf`. */ int __isoc99_swscanf(const wchar_t* restrict, const wchar_t* restrict, ...) __deprecated("Use 'swscanf' instead.") - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(1, 2)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(1, 2)))); /** @@ -1363,21 +1363,21 @@ int __isoc99_swscanf(const wchar_t* restrict, const wchar_t* restrict, ...) */ int __isoc99_vwscanf(const wchar_t* restrict, va_list) __deprecated("Use 'vwscanf' instead.") - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(1)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(1)))); /** * This function is identical to `vfwscanf`. */ int __isoc99_vfwscanf(FILE* restrict, const wchar_t* restrict, va_list) __deprecated("Use 'vfwscanf' instead.") - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(1, 2)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(1, 2)))); /** * This function is identical to `vswscanf`. */ int __isoc99_vswscanf(const wchar_t* restrict, const wchar_t* restrict, va_list) __deprecated("Use 'vswscanf' instead.") - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(1, 2)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(1, 2)))); #endif diff --git a/include/stdlib.h b/include/stdlib.h index 43f36c6..cfdd0a7 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -66,7 +66,7 @@ * the remainder in `.rem`. */ div_t div(int, int) - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); /** * Perform an integer division and return @@ -78,7 +78,7 @@ div_t div(int, int) * the remainder in `.rem`. */ ldiv_t ldiv(long, long) - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); /** * Perform an integer division and return @@ -90,7 +90,7 @@ ldiv_t ldiv(long, long) * the remainder in `.rem`. */ lldiv_t lldiv(long long, long long) - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); /** @@ -105,7 +105,7 @@ lldiv_t lldiv(long long, long long) * @return The absolute value of the integer. */ int abs(int) - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); /** * Return the absolute value of an integer. @@ -119,7 +119,7 @@ int abs(int) * @return The absolute value of the integer. */ long int labs(long int) - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); /** * Return the absolute value of an integer. @@ -133,7 +133,7 @@ long int labs(long int) * @return The absolute value of the integer. */ long long int llabs(long long int) - __GCC_ONLY(__attribute__((const))); + __GCC_ONLY(__attribute__((__const__))); #if !defined(__PORTABLE) @@ -153,7 +153,7 @@ long long int llabs(long long int) * @throws ENOMEM The process cannot allocate more memory. */ char* abspath(const char*, const char*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(1), malloc))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(1), __malloc__))); /** * Get the relative path of a file. @@ -172,7 +172,7 @@ char* abspath(const char*, const char*) * @throws ENOMEM The process cannot allocate more memory. */ char* relpath(const char*, const char*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(1), malloc))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(1), __malloc__))); #endif @@ -190,7 +190,7 @@ char* relpath(const char*, const char*) * @return The number encoded by the string. */ double atof(const char*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); /** * Convert a string to an integer, @@ -206,7 +206,7 @@ double atof(const char*) * @return The integer encoded by the string. */ int atoi(const char*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); /** * Convert a string to an integer, @@ -222,7 +222,7 @@ int atoi(const char*) * @return The integer encoded by the string. */ long int atol(const char*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); /** * Convert a string to an integer, @@ -238,7 +238,7 @@ long int atol(const char*) * @return The integer encoded by the string. */ long long int atoll(const char*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); #if !defined(__PORTABLE) /** @@ -248,7 +248,7 @@ long long int atoll(const char*) */ long long int atoq(const char*) __deprecated("'atoq' is obsolete and not portable, use 'atoll' instead.") - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); #endif diff --git a/include/string.h b/include/string.h index 92a91c2..fc04dcb 100644 --- a/include/string.h +++ b/include/string.h @@ -61,7 +61,7 @@ * @return A description of the error. */ char* strerror(int) - __GCC_ONLY(__attribute__((returns_nonnull, warn_unused_result))); + __GCC_ONLY(__attribute__((__returns_nonnull__, __warn_unused_result__))); #endif #if _POSIX_C_SOURCE >= 200809L @@ -82,7 +82,7 @@ char* strerror(int) * @return A description of the error. */ char* strerror_l(int, locale_t) - __GCC_ONLY(__attribute__((warn_unused_result))); /* TODO attributes */ + __GCC_ONLY(__attribute__((__warn_unused_result__))); /* TODO attributes */ #endif @@ -141,7 +141,7 @@ char* __gnu_strerror_r(int, char*, size_t); /* GNU-specific strerror_r */ * @return The number of bytes before the first NUL byte. */ size_t strlen(const char*) - __GCC_ONLY(__attribute__((nonnull, warn_unused_result, pure))); + __GCC_ONLY(__attribute__((__nonnull__, __warn_unused_result__, __pure__))); #if defined(__POSIX_SOURCE) || defined(__POSIX_C_SOURCE) || \ defined(__XOPEN_SOURCE) || defined(__GNU_SOURCE) || \ @@ -156,7 +156,7 @@ size_t strlen(const char*) * `maxlen` if no NUL byte was found. */ size_t strnlen(const char*, size_t) - __GCC_ONLY(__attribute__((warn_unused_result, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __pure__))); #endif @@ -265,7 +265,7 @@ void* memcmove(void*, const void*, int, size_t); * @return `whither` is returned. */ char* strcpy(char* restrict, const char* restrict) - __GCC_ONLY(__attribute__((returns_nonnull, nonnull))); + __GCC_ONLY(__attribute__((__returns_nonnull__, __nonnull__))); /** * Copy a memory segment to another, non-overlapping, segment, @@ -276,7 +276,7 @@ char* strcpy(char* restrict, const char* restrict) * @return `whither + strlen(whence)` is returned. */ char* stpcpy(char* restrict, const char* restrict) - __GCC_ONLY(__attribute__((returns_nonnull, nonnull))); + __GCC_ONLY(__attribute__((__returns_nonnull__, __nonnull__))); #if defined(__SLIBC_SOURCE) /** @@ -296,7 +296,7 @@ char* stpcpy(char* restrict, const char* restrict) * character. */ char* strccpy(char* restrict, const char* restrict, int) - __GCC_ONLY(__attribute__((nonnull))); + __GCC_ONLY(__attribute__((__nonnull__))); /** * Copy a memory segment to another, non-overlapping, segment, @@ -315,7 +315,7 @@ char* strccpy(char* restrict, const char* restrict, int) * character. */ char* strstrcpy(char* restrict, const char* restrict, const char* restrict) - __GCC_ONLY(__attribute__((nonnull(1, 2)))); + __GCC_ONLY(__attribute__((__nonnull__(1, 2)))); #endif /** @@ -333,7 +333,7 @@ char* strstrcpy(char* restrict, const char* restrict, const char* restrict) * @return `whither` is returned. */ char* strncpy(char* restrict, const char* restrict, size_t) - __GCC_ONLY(__attribute__((returns_nonnull, nonnull))); + __GCC_ONLY(__attribute__((__returns_nonnull__, __nonnull__))); #if defined(__GNU_SOURCE) /** @@ -354,7 +354,7 @@ char* strncpy(char* restrict, const char* restrict, size_t) * excluding NUL bytes, is returned. */ char* stpncpy(char* restrict, const char* restrict, size_t) - __GCC_ONLY(__attribute__((returns_nonnull, nonnull))); + __GCC_ONLY(__attribute__((__returns_nonnull__, __nonnull__))); # if defined(__SLIBC_SOURCE) /** @@ -381,7 +381,7 @@ char* stpncpy(char* restrict, const char* restrict, size_t) * character. */ char* strcncpy(char* restrict, const char* restrict, int, size_t) - __GCC_ONLY(__attribute__((nonnull))); + __GCC_ONLY(__attribute__((__nonnull__))); /** * Copy a memory segment to another, non-overlapping, segment, @@ -407,7 +407,7 @@ char* strcncpy(char* restrict, const char* restrict, int, size_t) * character. */ char* strstrncpy(char* restrict, const char* restrict, const char* restrict, size_t) - __GCC_ONLY(__attribute__((nonnull(1, 2)))); + __GCC_ONLY(__attribute__((__nonnull__(1, 2)))); # endif #endif @@ -423,7 +423,7 @@ char* strstrncpy(char* restrict, const char* restrict, const char* restrict, siz * @return `whither` is returned. */ char* strmove(char*, const char*) - __GCC_ONLY(__attribute__((returns_nonnull, nonnull))); + __GCC_ONLY(__attribute__((__returns_nonnull__, __nonnull__))); /** * Copy a memory segment to another, possibly overlapping, segment, @@ -436,7 +436,7 @@ char* strmove(char*, const char*) * @return `whither + strlen(whence)` is returned. */ char* stpmove(char*, const char*) - __GCC_ONLY(__attribute__((returns_nonnull, nonnull))); + __GCC_ONLY(__attribute__((__returns_nonnull__, __nonnull__))); /** * Copy a memory segment to another, possibly overlapping, segment, @@ -455,7 +455,7 @@ char* stpmove(char*, const char*) * character. */ char* strcmove(char*, const char*, int) - __GCC_ONLY(__attribute__((nonnull))); + __GCC_ONLY(__attribute__((__nonnull__))); /** * Copy a memory segment to another, possibly overlapping, segment, @@ -474,7 +474,7 @@ char* strcmove(char*, const char*, int) * character. */ char* strstrmove(char*, const char*, const char* restrict) - __GCC_ONLY(__attribute__((nonnull(1, 2)))); + __GCC_ONLY(__attribute__((__nonnull__(1, 2)))); /** * Copy a memory segment to another, possibly overlapping, segment, @@ -491,7 +491,7 @@ char* strstrmove(char*, const char*, const char* restrict) * @return `whither` is returned. */ char* strnmove(char*, const char*, size_t) - __GCC_ONLY(__attribute__((returns_nonnull, nonnull))); + __GCC_ONLY(__attribute__((__returns_nonnull__, __nonnull__))); # if defined(__GNU_SOURCE) /** @@ -513,7 +513,7 @@ char* strnmove(char*, const char*, size_t) * excluding NUL bytes, is returned. */ char* stpnmove(char*, const char*, size_t) - __GCC_ONLY(__attribute__((returns_nonnull, nonnull))); + __GCC_ONLY(__attribute__((__returns_nonnull__, __nonnull__))); /** * Copy a memory segment to another, possibly overlapping, segment, @@ -539,7 +539,7 @@ char* stpnmove(char*, const char*, size_t) * character. */ char* strcnmove(char*, const char*, int, size_t) - __GCC_ONLY(__attribute__((nonnull))); + __GCC_ONLY(__attribute__((__nonnull__))); /** * Copy a memory segment to another, possibly overlapping, segment, @@ -565,7 +565,7 @@ char* strcnmove(char*, const char*, int, size_t) * character. */ char* strstrnmove(char*, const char*, const char* restrict, size_t) - __GCC_ONLY(__attribute__((nonnull(1, 2)))); + __GCC_ONLY(__attribute__((__nonnull__(1, 2)))); # endif #endif @@ -580,7 +580,7 @@ char* strstrnmove(char*, const char*, const char* restrict, size_t) * @return `whither` is returned. */ char* strcat(char* restrict, const char* restrict) - __GCC_ONLY(__attribute__((nonnull))); + __GCC_ONLY(__attribute__((__nonnull__))); /* stpcat does not exsits because use of it would be very inefficient. */ @@ -601,7 +601,7 @@ char* strcat(char* restrict, const char* restrict) * @return `whither` is returned. */ char* strncat(char* restrict, const char* restrict, size_t) - __GCC_ONLY(__attribute__((nonnull))); + __GCC_ONLY(__attribute__((__nonnull__))); /* stpncat does not exsits because use of it would be very inefficient. */ @@ -616,7 +616,7 @@ char* strncat(char* restrict, const char* restrict, size_t) * @throws ENOMEM The process could not allocate sufficient amount of memory. */ char* strdup(const char*) - __GCC_ONLY(__attribute__((malloc, nonnull, warn_unused_result))); + __GCC_ONLY(__attribute__((__malloc__, __nonnull__, __warn_unused_result__))); #if defined(__GNU_SOURCE) /** @@ -634,7 +634,7 @@ char* strdup(const char*) * @throws ENOMEM The process could not allocate sufficient amount of memory. */ char* strndup(const char*, size_t) - __GCC_ONLY(__attribute__((malloc, nonnull, warn_unused_result))); + __GCC_ONLY(__attribute__((__malloc__, __nonnull__, __warn_unused_result__))); #endif #if defined(__SLIBC_SOURCE) @@ -651,7 +651,7 @@ char* strndup(const char*, size_t) * @throws ENOMEM The process could not allocate sufficient amount of memory. */ void* memdup(const void*, size_t) - __GCC_ONLY(__attribute__((malloc, nonnull, warn_unused_result))); + __GCC_ONLY(__attribute__((__malloc__, __nonnull__, __warn_unused_result__))); #endif #if defined (__GNUC__) @@ -730,7 +730,7 @@ void* memdup(const void*, size_t) * see the specifications for `a` and `b`. */ int memcmp(const void*, const void*, size_t) - __GCC_ONLY(__attribute__((warn_unused_result, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __pure__))); #if defined(__SLIBC_SOURCE) /** @@ -746,7 +746,7 @@ int memcmp(const void*, const void*, size_t) * see the specifications for `a` and `b`. */ int memcasecmp(const void*, const void*, size_t) - __GCC_ONLY(__attribute__((warn_unused_result, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __pure__))); #endif /** @@ -758,7 +758,7 @@ int memcasecmp(const void*, const void*, size_t) * see the specifications for `a` and `b`. */ int strcmp(const char*, const char*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); /** * Compare two strings alphabetically in a case sensitive manner. @@ -770,12 +770,12 @@ int strcmp(const char*, const char*) * see the specifications for `a` and `b`. */ int strncmp(const char*, const char*, size_t) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); #if defined(__GNU_SOURCE) int strverscmp(const char*, const char*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); /* TODO document and implement strverscmp */ #endif @@ -790,7 +790,7 @@ int strverscmp(const char*, const char*) * `NULL` if none were found. */ void* memchr(const void*, int, size_t) - __GCC_ONLY(__attribute__((warn_unused_result, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __pure__))); #ifdef __CONST_CORRECT # define memchr(...) (__const_correct(memchr, __VA_ARGS__)) #endif @@ -808,7 +808,7 @@ void* memchr(const void*, int, size_t) * @return Pointer to the first occurrence of `c`. */ void* rawmemchr(const void*, int) - __GCC_ONLY(__attribute__((warn_unused_result, returns_nonnull, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __returns_nonnull__, __nonnull__, __pure__))); # ifdef __CONST_CORRECT # define rawmemchr(...) (__const_correct(rawmemchr, __VA_ARGS__)) # endif @@ -828,7 +828,7 @@ void* rawmemchr(const void*, int) * `NULL` if none were found. */ void* memrchr(const void*, int, size_t) - __GCC_ONLY(__attribute__((warn_unused_result, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __pure__))); #ifdef __CONST_CORRECT # define memrchr(...) (__const_correct(memrchr, __VA_ARGS__)) #endif @@ -847,7 +847,7 @@ void* memrchr(const void*, int, size_t) * `NULL` if none were found. */ char* strchr(const char*, int) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); #ifdef __CONST_CORRECT # define strchr(...) (__const_correct(strchr, __VA_ARGS__)) #endif @@ -868,7 +868,7 @@ char* strchr(const char*, int) * if none were found. */ char* strchrnul(const char*, int) - __GCC_ONLY(__attribute__((warn_unused_result, returns_nonnull, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __returns_nonnull__, __nonnull__, __pure__))); # ifdef __CONST_CORRECT # define strchrnul(...) (__const_correct(strchrnul, __VA_ARGS__)) # endif @@ -889,7 +889,7 @@ char* strchrnul(const char*, int) * `NULL` if none were found. */ char* strrchr(const char*, int) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); #ifdef __CONST_CORRECT # define strrchr(...) (__const_correct(strrchr, __VA_ARGS__)) #endif @@ -905,7 +905,7 @@ char* strrchr(const char*, int) * substring, `NULL` if not found. */ char* strstr(const char*, const char*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); #ifdef __CONST_CORRECT # define strstr(...) (__const_correct(strstr, __VA_ARGS__)) #endif @@ -920,7 +920,7 @@ char* strstr(const char*, const char*) * substring, `NULL` if not found. */ char* strcasestr(const char*, const char*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); #ifdef __CONST_CORRECT # define strcasestr(...) (__const_correct(strcasestr, __VA_ARGS__)) #endif @@ -940,7 +940,7 @@ char* strcasestr(const char*, const char*) * substring, `NULL` if not found. */ char* strnstr(const char*, const char*, size_t) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); # ifdef __CONST_CORRECT # define strnstr(...) (__const_correct(strnstr, __VA_ARGS__)) # endif @@ -958,7 +958,7 @@ char* strnstr(const char*, const char*, size_t) * substring, `NULL` if not found. */ char* strncasestr(const char*, const char*, size_t) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); # ifdef __CONST_CORRECT # define strncasestr(...) (__const_correct(strncasestr, __VA_ARGS__)) # endif @@ -975,7 +975,7 @@ char* strncasestr(const char*, const char*, size_t) * @return Pointer to the first occurrence of the substring. */ char* rawstrstr(const char*, const char*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, returns_nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __returns_nonnull__, __pure__))); # ifdef __CONST_CORRECT # define rawstrstr(...) (__const_correct(rawstrstr, __VA_ARGS__)) # endif @@ -992,7 +992,7 @@ char* rawstrstr(const char*, const char*) * @return Pointer to the first occurrence of the substring. */ char* rawstrcasestr(const char*, const char*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, returns_nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __returns_nonnull__, __pure__))); # ifdef __CONST_CORRECT # define rawstrcasestr(...) (__const_correct(rawstrcasestr, __VA_ARGS__)) # endif @@ -1012,7 +1012,7 @@ char* rawstrcasestr(const char*, const char*) * the substring, `NULL` if not found. */ void* memcasemem(const void*, size_t, const void*, size_t) - __GCC_ONLY(__attribute__((warn_unused_result, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __pure__))); # ifdef __CONST_CORRECT # define memcasemem(...) (__const_correct(memcasemem, __VA_ARGS__)) # endif @@ -1029,7 +1029,7 @@ void* memcasemem(const void*, size_t, const void*, size_t) * `desired`, `NULL` otherwise. */ char* strstarts(const char*, const char*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); # ifdef __CONST_CORRECT # define strstarts(...) (__const_correct(strstarts, __VA_ARGS__)) # endif @@ -1046,7 +1046,7 @@ char* strstarts(const char*, const char*) * `string` ends with `desired`, `NULL` otherwise. */ char* strends(const char*, const char*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); # ifdef __CONST_CORRECT # define strends(...) (__const_correct(strends, __VA_ARGS__)) # endif @@ -1063,7 +1063,7 @@ char* strends(const char*, const char*) * `desired`, `NULL` otherwise. */ char* strcasestarts(const char*, const char*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); # ifdef __CONST_CORRECT # define strcasestarts(...) (__const_correct(strcasestarts, __VA_ARGS__)) # endif @@ -1080,7 +1080,7 @@ char* strcasestarts(const char*, const char*) * `string` ends with `desired`, `NULL` otherwise. */ char* strcaseends(const char*, const char*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); # ifdef __CONST_CORRECT # define strcaseends(...) (__const_correct(strcaseends, __VA_ARGS__)) # endif @@ -1102,7 +1102,7 @@ char* strcaseends(const char*, const char*) * the substring, `NULL` if not found. */ void* memmem(const void*, size_t, const void*, size_t) - __GCC_ONLY(__attribute__((warn_unused_result, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __pure__))); # ifdef __CONST_CORRECT # define memmem(...) (__const_correct(memmem, __VA_ARGS__)) # endif @@ -1122,7 +1122,7 @@ void* memmem(const void*, size_t, const void*, size_t) * @return The length of the substring. */ size_t strspn(const char*, const char*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); /** * Returns length of the initial substring @@ -1134,7 +1134,7 @@ size_t strspn(const char*, const char*) * @return The length of the substring. */ size_t strcspn(const char*, const char*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); /** * This function works like `strcspn`, @@ -1149,7 +1149,7 @@ size_t strcspn(const char*, const char*) * `NULL` is returned if none is found. */ char* strpbrk(const char*, const char*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); #ifdef __CONST_CORRECT # define strpbrk(...) (__const_correct(strpbrk, __VA_ARGS__)) #endif @@ -1171,7 +1171,7 @@ char* strpbrk(const char*, const char*) * are no more tokens. */ char* strtok(char* restrict, const char* restrict) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(2)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(2)))); /** * Tokenise a string. @@ -1193,7 +1193,7 @@ char* strtok(char* restrict, const char* restrict) * are no more tokens. */ char* strtok_r(char* restrict, const char* restrict, char** restrict) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(2, 3)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(2, 3)))); /** * Tokenise a string. @@ -1211,7 +1211,7 @@ char* strtok_r(char* restrict, const char* restrict, char** restrict) * are no more tokens. */ char* strsep(char** restrict, const char* restrict) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__))); #if defined(__GNU_SOURCE) && !defined(basename) @@ -1228,7 +1228,7 @@ char* strsep(char** restrict, const char* restrict) * so it must not freed or edited. */ char* __gnu_basename(const char*) - __GCC_ONLY(__attribute__((warn_unused_result, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __pure__))); # define basename __gnu_basename /* It does not look like it is possible to solve the const-correctness problem here. */ #endif diff --git a/include/strings.h b/include/strings.h index 5ccad5f..fe756d3 100644 --- a/include/strings.h +++ b/include/strings.h @@ -65,7 +65,7 @@ void bcopy(const void*, void*, size_t) */ int bcmp(const void*, const void*, size_t) __deprecated("Use 'memcmp' instead.") - __GCC_ONLY(__attribute__((warn_unused_result, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __pure__))); /** @@ -79,7 +79,7 @@ int bcmp(const void*, const void*, size_t) * see the specifications for `a` and `b`. */ int strcasecmp(const char*, const char*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); /** * Compare two strings alphabetically in a case insensitive manner. @@ -93,7 +93,7 @@ int strcasecmp(const char*, const char*) * see the specifications for `a` and `b`. */ int strncasecmp(const char*, const char*, size_t) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); /** @@ -108,7 +108,7 @@ int strncasecmp(const char*, const char*, size_t) * see the specifications for `a` and `b`. */ int strcasecmp_l(const char*, const char*, locale_t) /* TODO */ - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); /** * Compare two strings alphabetically in a case insensitive manner. @@ -123,7 +123,7 @@ int strcasecmp_l(const char*, const char*, locale_t) /* TODO */ * see the specifications for `a` and `b`. */ int strncasecmp_l(const char*, const char*, size_t, locale_t) /* TODO */ - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); /** @@ -133,7 +133,7 @@ int strncasecmp_l(const char*, const char*, size_t, locale_t) /* TODO */ */ char* index(const char*, int) __deprecated("Use 'strchr' instead.") - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); #ifdef __CONST_CORRECT # define index(...) (__const_correct(index, __VA_ARGS__)) #endif @@ -145,7 +145,7 @@ char* index(const char*, int) */ char* rindex(const char*, int) __deprecated("Use 'strrchr' instead.") - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); #ifdef __CONST_CORRECT # define rindex(...) (__const_correct(rindex, __VA_ARGS__)) #endif @@ -158,7 +158,7 @@ char* rindex(const char*, int) * @return The value of the least significant set bit, zero if none. */ int ffs(int) - __GCC_ONLY(__attribute__((warn_unused_result, const))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __const__))); /** * Find the first set bit in an integer. @@ -167,7 +167,7 @@ int ffs(int) * @return The value of the least significant set bit, zero if none. */ int ffsl(long) - __GCC_ONLY(__attribute__((warn_unused_result, const))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __const__))); /** * Find the first set bit in an integer. @@ -176,7 +176,7 @@ int ffsl(long) * @return The value of the least significant set bit, zero if none. */ int ffsll(long long) - __GCC_ONLY(__attribute__((warn_unused_result, const))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __const__))); diff --git a/include/unistd.h b/include/unistd.h index 5377e28..c3fef03 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -102,7 +102,7 @@ * the data segment to overlap another segment. */ int brk(void*) /* TODO implement brk */ - __GCC_ONLY(__attribute__((warn_unused_result))); + __GCC_ONLY(__attribute__((__warn_unused_result__))); /** * Set and get the current high end of the calling @@ -137,7 +137,7 @@ int brk(void*) /* TODO implement brk */ * the data segment to overlap another segment. */ void* sbrk(ptrdiff_t) /* TODO implement sbrk */ - __GCC_ONLY(__attribute__((warn_unused_result))); + __GCC_ONLY(__attribute__((__warn_unused_result__))); @@ -165,7 +165,7 @@ int isatty(int); * @throws Any error specified for execve(2). */ int execl(const char*, ... /*, NULL */) - __GCC_ONLY(__attribute__((sentinel(0), nonnull(1)))); + __GCC_ONLY(__attribute__((__sentinel__(0), __nonnull__(1)))); /** * Replace the current process image with a new process image. @@ -186,7 +186,7 @@ int execl(const char*, ... /*, NULL */) * @throws Any error specified for execve(2). */ int execlp(const char*, ... /*, NULL */) - __GCC_ONLY(__attribute__((sentinel(0), nonnull(1)))); + __GCC_ONLY(__attribute__((__sentinel__(0), __nonnull__(1)))); /** * Replace the current process image with a new process image. @@ -207,7 +207,7 @@ int execlp(const char*, ... /*, NULL */) * @throws Any error specified for execve(2). */ int execle(const char*, ... /*, NULL, char* const[] */) - __GCC_ONLY(__attribute__((sentinel(1), nonnull(1)))); + __GCC_ONLY(__attribute__((__sentinel__(1), __nonnull__(1)))); #if defined(__SLIBC_SOURCE) /** @@ -235,7 +235,7 @@ int execle(const char*, ... /*, NULL, char* const[] */) * @throws Any error specified for execve(2). */ int execlpe(const char*, ... /*, NULL, char* const[] */) - __GCC_ONLY(__attribute__((sentinel(1), nonnull(1)))); + __GCC_ONLY(__attribute__((__sentinel__(1), __nonnull__(1)))); #endif /** @@ -257,7 +257,7 @@ int execlpe(const char*, ... /*, NULL, char* const[] */) * @throws Any error specified for execve(2). */ int execv(const char*, char* const[]) - __GCC_ONLY(__attribute__((nonnull(1)))); + __GCC_ONLY(__attribute__((__nonnull__(1)))); /** * Replace the current process image with a new process image. @@ -282,7 +282,7 @@ int execv(const char*, char* const[]) * @throws Any error specified for execve(2). */ int execvp(const char*, char* const[]) - __GCC_ONLY(__attribute__((nonnull(1)))); + __GCC_ONLY(__attribute__((__nonnull__(1)))); /** * Replace the current process image with a new process image. @@ -307,7 +307,7 @@ int execvp(const char*, char* const[]) * @throws Any error specified for execve(2). */ int execve(const char*, char* const[], char* const[]) - __GCC_ONLY(__attribute__((nonnull(1)))); + __GCC_ONLY(__attribute__((__nonnull__(1)))); #if defined(__GNU_SOURCE) || defined(__SLIBC_SOURCE) /** @@ -339,7 +339,7 @@ int execve(const char*, char* const[], char* const[]) * @throws Any error specified for execve(2). */ int execvpe(const char*, char* const[], char* const[]) - __GCC_ONLY(__attribute__((nonnull(1)))); + __GCC_ONLY(__attribute__((__nonnull__(1)))); #endif @@ -374,7 +374,7 @@ int execvpe(const char*, char* const[], char* const[]) * @throws Any error specified for execveat(2). */ int execlat(int, const char*, ... /*, NULL, int */) - __GCC_ONLY(__attribute__((sentinel(1), nonnull(2)))); + __GCC_ONLY(__attribute__((__sentinel__(1), __nonnull__(2)))); /** * Replace the current process image with a new process image. @@ -410,7 +410,7 @@ int execlat(int, const char*, ... /*, NULL, int */) * @throws Any error specified for execveat(2). */ int execlpat(int, const char*, ... /*, NULL, int */) - __GCC_ONLY(__attribute__((sentinel(1), nonnull(2)))); + __GCC_ONLY(__attribute__((__sentinel__(1), __nonnull__(2)))); /** * Replace the current process image with a new process image. @@ -446,7 +446,7 @@ int execlpat(int, const char*, ... /*, NULL, int */) * @throws Any error specified for execveat(2). */ int execleat(int, const char*, ... /*, NULL, char* const[], int */) - __GCC_ONLY(__attribute__((sentinel(2), nonnull(2)))); + __GCC_ONLY(__attribute__((__sentinel__(2), __nonnull__(2)))); /** * Replace the current process image with a new process image. @@ -486,7 +486,7 @@ int execleat(int, const char*, ... /*, NULL, char* const[], int */) * @throws Any error specified for execveat(2). */ int execlpeat(int, const char*, ... /*, NULL, char* const[], int */) - __GCC_ONLY(__attribute__((sentinel(2), nonnull(2)))); + __GCC_ONLY(__attribute__((__sentinel__(2), __nonnull__(2)))); /** * Replace the current process image with a new process image. @@ -522,7 +522,7 @@ int execlpeat(int, const char*, ... /*, NULL, char* const[], int */) * @throws Any error specified for execveat(2). */ int execvat(int, const char*, char* const[], int) - __GCC_ONLY(__attribute__((nonnull(2)))); + __GCC_ONLY(__attribute__((__nonnull__(2)))); /** * Replace the current process image with a new process image. @@ -562,7 +562,7 @@ int execvat(int, const char*, char* const[], int) * @throws Any error specified for execveat(2). */ int execvpat(int, const char*, char* const[], int) - __GCC_ONLY(__attribute__((nonnull(2)))); + __GCC_ONLY(__attribute__((__nonnull__(2)))); #endif /** @@ -601,7 +601,7 @@ int execvpat(int, const char*, char* const[], int) * @throws Any error specified for execveat(2). */ int execveat(int, const char*, char* const[], char* const[], int) - __GCC_ONLY(__attribute__((nonnull(2)))); + __GCC_ONLY(__attribute__((__nonnull__(2)))); #if defined(__SLIBC_SOURCE) /** @@ -646,7 +646,7 @@ int execveat(int, const char*, char* const[], char* const[], int) * @throws Any error specified for execveat(2). */ int execvpeat(int, const char*, char* const[], char* const[], int) - __GCC_ONLY(__attribute__((nonnull(2)))); + __GCC_ONLY(__attribute__((__nonnull__(2)))); #endif @@ -668,7 +668,7 @@ int execvpeat(int, const char*, char* const[], char* const[], int) * @throws Any error specified for execve(2). */ int fexecl(int, ... /*, NULL */) - __GCC_ONLY(__attribute__((sentinel(0)))); + __GCC_ONLY(__attribute__((__sentinel__(0)))); /** * Replace the current process image with a new process image. @@ -691,7 +691,7 @@ int fexecl(int, ... /*, NULL */) * @throws Any error specified for execve(2). */ int fexecle(int, ... /*, NULL, char* const[] */) - __GCC_ONLY(__attribute__((sentinel(1)))); + __GCC_ONLY(__attribute__((__sentinel__(1)))); /** * Replace the current process image with a new process image. diff --git a/include/wchar.h b/include/wchar.h index 4437e6d..280bd06 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -64,7 +64,7 @@ * first NUL character. */ size_t wcslen(const wchar_t*) - __GCC_ONLY(__attribute__((nonnull, warn_unused_result, pure))); + __GCC_ONLY(__attribute__((__nonnull__, __warn_unused_result__, __pure__))); /** * `wchar_t` version of `strnlen`. @@ -76,7 +76,7 @@ size_t wcslen(const wchar_t*) * NUL character was found. */ size_t wcsnlen(const wchar_t*, size_t) - __GCC_ONLY(__attribute__((warn_unused_result, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __pure__))); @@ -188,7 +188,7 @@ wchar_t* wmemcmove(wchar_t*, const wchar_t*, wchar_t, size_t); * @return `whither` is returned. */ wchar_t* wcscpy(wchar_t* restrict, const wchar_t* restrict) - __GCC_ONLY(__attribute__((returns_nonnull, nonnull))); + __GCC_ONLY(__attribute__((__returns_nonnull__, __nonnull__))); #if defined(__SLIBC_SOURCE) || defined(__GNU_SOURCE) /** @@ -202,7 +202,7 @@ wchar_t* wcscpy(wchar_t* restrict, const wchar_t* restrict) * @return `whither + wcslen(whence)` is returned. */ wchar_t* wcpcpy(wchar_t* restrict, const wchar_t* restrict) - __GCC_ONLY(__attribute__((returns_nonnull, nonnull))); + __GCC_ONLY(__attribute__((__returns_nonnull__, __nonnull__))); #endif #if defined(__SLIBC_SOURCE) @@ -224,7 +224,7 @@ wchar_t* wcpcpy(wchar_t* restrict, const wchar_t* restrict) * character. */ wchar_t* wcsccpy(wchar_t* restrict, const wchar_t* restrict, wchar_t) - __GCC_ONLY(__attribute__((nonnull))); + __GCC_ONLY(__attribute__((__nonnull__))); /** * Copy a memory segment to another, non-overlapping, segment, @@ -243,7 +243,7 @@ wchar_t* wcsccpy(wchar_t* restrict, const wchar_t* restrict, wchar_t) * character. */ wchar_t* wcsstrcpy(wchar_t* restrict, const wchar_t* restrict, const wchar_t* restrict) - __GCC_ONLY(__attribute__((nonnull(1, 2)))); + __GCC_ONLY(__attribute__((__nonnull__(1, 2)))); #endif /** @@ -261,7 +261,7 @@ wchar_t* wcsstrcpy(wchar_t* restrict, const wchar_t* restrict, const wchar_t* re * @return `whither` is returned. */ wchar_t* wcsncpy(wchar_t* restrict, const wchar_t* restrict, size_t) - __GCC_ONLY(__attribute__((returns_nonnull, nonnull))); + __GCC_ONLY(__attribute__((__returns_nonnull__, __nonnull__))); #if defined(__GNU_SOURCE) /** @@ -282,7 +282,7 @@ wchar_t* wcsncpy(wchar_t* restrict, const wchar_t* restrict, size_t) * excluding NUL characters, is returned. */ wchar_t* wcpncpy(wchar_t* restrict, const wchar_t* restrict, size_t) - __GCC_ONLY(__attribute__((returns_nonnull, nonnull))); + __GCC_ONLY(__attribute__((__returns_nonnull__, __nonnull__))); # if defined(__SLIBC_SOURCE) /** @@ -310,7 +310,7 @@ wchar_t* wcpncpy(wchar_t* restrict, const wchar_t* restrict, size_t) * character. */ wchar_t* wcscncpy(wchar_t* restrict, const wchar_t* restrict, wchar_t, size_t) - __GCC_ONLY(__attribute__((nonnull))); + __GCC_ONLY(__attribute__((__nonnull__))); /** * Copy a memory segment to another, non-overlapping, segment, @@ -336,7 +336,7 @@ wchar_t* wcscncpy(wchar_t* restrict, const wchar_t* restrict, wchar_t, size_t) * character. */ wchar_t* wcsstrncpy(wchar_t* restrict, const wchar_t* restrict, const wchar_t* restrict, size_t) - __GCC_ONLY(__attribute__((nonnull(1, 2)))); + __GCC_ONLY(__attribute__((__nonnull__(1, 2)))); # endif #endif @@ -352,7 +352,7 @@ wchar_t* wcsstrncpy(wchar_t* restrict, const wchar_t* restrict, const wchar_t* r * @return `whither` is returned. */ wchar_t* wcsmove(wchar_t*, const wchar_t*) - __GCC_ONLY(__attribute__((returns_nonnull, nonnull))); + __GCC_ONLY(__attribute__((__returns_nonnull__, __nonnull__))); /** * Copy a memory segment to another, possibly overlapping, segment, @@ -365,7 +365,7 @@ wchar_t* wcsmove(wchar_t*, const wchar_t*) * @return `whither + wcslen(whence)` is returned. */ wchar_t* wcpmove(wchar_t*, const wchar_t*) - __GCC_ONLY(__attribute__((returns_nonnull, nonnull))); + __GCC_ONLY(__attribute__((__returns_nonnull__, __nonnull__))); /** * Copy a memory segment to another, possibly overlapping, segment, @@ -385,7 +385,7 @@ wchar_t* wcpmove(wchar_t*, const wchar_t*) * character. */ wchar_t* wcscmove(wchar_t*, const wchar_t*, wchar_t) - __GCC_ONLY(__attribute__((nonnull))); + __GCC_ONLY(__attribute__((__nonnull__))); /** * Copy a memory segment to another, possibly overlapping, segment, @@ -404,7 +404,7 @@ wchar_t* wcscmove(wchar_t*, const wchar_t*, wchar_t) * character. */ wchar_t* wcsstrmove(wchar_t*, const wchar_t*, const wchar_t* restrict) - __GCC_ONLY(__attribute__((nonnull(1, 2)))); + __GCC_ONLY(__attribute__((__nonnull__(1, 2)))); /** * Copy a memory segment to another, possibly overlapping, segment, @@ -421,7 +421,7 @@ wchar_t* wcsstrmove(wchar_t*, const wchar_t*, const wchar_t* restrict) * @return `whither` is returned. */ wchar_t* wcsnmove(wchar_t*, const wchar_t*, size_t) - __GCC_ONLY(__attribute__((returns_nonnull, nonnull))); + __GCC_ONLY(__attribute__((__returns_nonnull__, __nonnull__))); # if defined(__GNU_SOURCE) /** @@ -443,7 +443,7 @@ wchar_t* wcsnmove(wchar_t*, const wchar_t*, size_t) * excluding NUL characters, is returned. */ wchar_t* wcpnmove(wchar_t*, const wchar_t*, size_t) - __GCC_ONLY(__attribute__((returns_nonnull, nonnull))); + __GCC_ONLY(__attribute__((__returns_nonnull__, __nonnull__))); /** * Copy a memory segment to another, possibly overlapping, segment, @@ -470,7 +470,7 @@ wchar_t* wcpnmove(wchar_t*, const wchar_t*, size_t) * character. */ wchar_t* wcscnmove(wchar_t*, const wchar_t*, wchar_t, size_t) - __GCC_ONLY(__attribute__((nonnull))); + __GCC_ONLY(__attribute__((__nonnull__))); /** * Copy a memory segment to another, possibly overlapping, segment, @@ -496,7 +496,7 @@ wchar_t* wcscnmove(wchar_t*, const wchar_t*, wchar_t, size_t) * character. */ wchar_t* wcsstrnmove(wchar_t*, const wchar_t*, const wchar_t* restrict, size_t) - __GCC_ONLY(__attribute__((nonnull(1, 2)))); + __GCC_ONLY(__attribute__((__nonnull__(1, 2)))); # endif #endif @@ -511,7 +511,7 @@ wchar_t* wcsstrnmove(wchar_t*, const wchar_t*, const wchar_t* restrict, size_t) * @return `whither` is returned. */ wchar_t* wcscat(wchar_t* restrict whither, const wchar_t* restrict whence) - __GCC_ONLY(__attribute__((nonnull))); + __GCC_ONLY(__attribute__((__nonnull__))); /* wcpcat does not exsits because use of it would be very inefficient. */ @@ -532,7 +532,7 @@ wchar_t* wcscat(wchar_t* restrict whither, const wchar_t* restrict whence) * @return `whither` is returned. */ wchar_t* wcsncat(wchar_t* restrict whither, const wchar_t* restrict whence, size_t maxlen) - __GCC_ONLY(__attribute__((nonnull))); + __GCC_ONLY(__attribute__((__nonnull__))); /* wcpncat does not exsits because use of it would be very inefficient. */ @@ -550,7 +550,7 @@ wchar_t* wcsncat(wchar_t* restrict whither, const wchar_t* restrict whence, size * @throws ENOMEM The process could not allocate sufficient amount of memory. */ wchar_t* wcsdup(const wchar_t*) - __GCC_ONLY(__attribute__((malloc, nonnull, warn_unused_result))); + __GCC_ONLY(__attribute__((__malloc__, __nonnull__, __warn_unused_result__))); #endif #if defined(__SLIBC_SOURCE) @@ -571,7 +571,7 @@ wchar_t* wcsdup(const wchar_t*) * @throws ENOMEM The process could not allocate sufficient amount of memory. */ wchar_t* wcsndup(const wchar_t*, size_t) - __GCC_ONLY(__attribute__((malloc, nonnull, warn_unused_result))); + __GCC_ONLY(__attribute__((__malloc__, __nonnull__, __warn_unused_result__))); # endif /** @@ -587,7 +587,7 @@ wchar_t* wcsndup(const wchar_t*, size_t) * @throws ENOMEM The process could not allocate sufficient amount of memory. */ wchar_t* wmemdup(const wchar_t*, size_t) - __GCC_ONLY(__attribute__((malloc, nonnull, warn_unused_result))); + __GCC_ONLY(__attribute__((__malloc__, __nonnull__, __warn_unused_result__))); # if defined(__GNUC__) # if defined(__GNU_SOURCE) @@ -664,7 +664,7 @@ wchar_t* wmemdup(const wchar_t*, size_t) * see the specifications for `a` and `b`. */ int wmemcmp(const wchar_t*, const wchar_t*, size_t) - __GCC_ONLY(__attribute__((warn_unused_result, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __pure__))); #if defined(__SLIBC_SOURCE) /** @@ -680,7 +680,7 @@ int wmemcmp(const wchar_t*, const wchar_t*, size_t) * see the specifications for `a` and `b`. */ int wmemcasecmp(const wchar_t*, const wchar_t*, size_t) - __GCC_ONLY(__attribute__((warn_unused_result, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __pure__))); #endif /** @@ -692,7 +692,7 @@ int wmemcasecmp(const wchar_t*, const wchar_t*, size_t) * see the specifications for `a` and `b`. */ int wcscmp(const wchar_t*, const wchar_t*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); #if defined(__GNU_SOURCE) || defined(__SLIBC_SOURCE) /** @@ -708,7 +708,7 @@ int wcscmp(const wchar_t*, const wchar_t*) * see the specifications for `a` and `b`. */ int wcscasecmp(const wchar_t*, const wchar_t*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); /** * Compare two strings alphabetically in a case sensitive manner. @@ -722,7 +722,7 @@ int wcscasecmp(const wchar_t*, const wchar_t*) * see the specifications for `a` and `b`. */ int wcsncmp(const wchar_t*, const wchar_t*, size_t) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); /** * Compare two strings alphabetically in a case insensitive manner. @@ -738,7 +738,7 @@ int wcsncmp(const wchar_t*, const wchar_t*, size_t) * see the specifications for `a` and `b`. */ int wcsncasecmp(const wchar_t*, const wchar_t*, size_t) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); #endif @@ -753,7 +753,7 @@ int wcsncasecmp(const wchar_t*, const wchar_t*, size_t) * `NULL` if none were found. */ wchar_t* wmemchr(const wchar_t*, wchar_t, size_t) - __GCC_ONLY(__attribute__((warn_unused_result, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __pure__))); #ifdef __CONST_CORRECT # define wmemchr(...) (__const_correct(wmemchr, __VA_ARGS__)) #endif @@ -771,7 +771,7 @@ wchar_t* wmemchr(const wchar_t*, wchar_t, size_t) * @return Pointer to the first occurrence of `c`. */ wchar_t* rawwmemchr(const wchar_t*, wchar_t) - __GCC_ONLY(__attribute__((warn_unused_result, returns_nonnull, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __returns_nonnull__, __nonnull__, __pure__))); #ifdef __CONST_CORRECT # define rawwmemchr(...) (__const_correct(rawwmemchr, __VA_ARGS__)) #endif @@ -793,7 +793,7 @@ wchar_t* rawwmemchr(const wchar_t*, wchar_t) * `NULL` if none were found. */ wchar_t* wmemrchr(const wchar_t*, wchar_t, size_t) - __GCC_ONLY(__attribute__((warn_unused_result, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __pure__))); # ifdef __CONST_CORRECT # define wmemrchr(...) (__const_correct(wmemrchr, __VA_ARGS__)) # endif @@ -810,7 +810,7 @@ wchar_t* wmemrchr(const wchar_t*, wchar_t, size_t) * `NULL` if none were found. */ wchar_t* wcschr(const wchar_t*, wchar_t) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); #ifdef __CONST_CORRECT # define wcschr(...) (__const_correct(wcschr, __VA_ARGS__)) #endif @@ -832,7 +832,7 @@ wchar_t* wcschr(const wchar_t*, wchar_t) * if none were found. */ wchar_t* wcschrnul(const wchar_t*, wchar_t) - __GCC_ONLY(__attribute__((warn_unused_result, returns_nonnull, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __returns_nonnull__, __nonnull__, __pure__))); # ifdef __CONST_CORRECT # define wcschrnul(...) (__const_correct(wcschrnul, __VA_ARGS__)) # endif @@ -853,7 +853,7 @@ wchar_t* wcschrnul(const wchar_t*, wchar_t) * `NULL` if none were found. */ wchar_t* wcsrchr(const wchar_t*, wchar_t) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); #ifdef __CONST_CORRECT # define wcsrchr(...) (__const_correct(wcsrchr, __VA_ARGS__)) #endif @@ -863,7 +863,7 @@ wchar_t* wcsrchr(const wchar_t*, wchar_t) * This function is identical to `wcsstr`. */ wchar_t* wcswcs(const wchar_t*, const wchar_t*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))) + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))) __deprecated("Use 'wcsstr' instead."); #ifdef __CONST_CORRECT # define wcswcs(...) (__const_correct(wcswcs, __VA_ARGS__)) @@ -879,7 +879,7 @@ wchar_t* wcswcs(const wchar_t*, const wchar_t*) * substring, `NULL` if not found. */ wchar_t* wcsstr(const wchar_t*, const wchar_t*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); #ifdef __CONST_CORRECT # define wcsstr(...) (__const_correct(wcsstr, __VA_ARGS__)) #endif @@ -897,7 +897,7 @@ wchar_t* wcsstr(const wchar_t*, const wchar_t*) * substring, `NULL` if not found. */ wchar_t* wcscasestr(const wchar_t*, const wchar_t*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); # ifdef __CONST_CORRECT # define wcscasestr(...) (__const_correct(wcscasestr, __VA_ARGS__)) # endif @@ -916,7 +916,7 @@ wchar_t* wcscasestr(const wchar_t*, const wchar_t*) * substring, `NULL` if not found. */ wchar_t* wcsnstr(const wchar_t*, const wchar_t*, size_t) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); # ifdef __CONST_CORRECT # define wcsnstr(...) (__const_correct(wcsnstr, __VA_ARGS__)) # endif @@ -934,7 +934,7 @@ wchar_t* wcsnstr(const wchar_t*, const wchar_t*, size_t) * substring, `NULL` if not found. */ wchar_t* wcsncasestr(const wchar_t*, const wchar_t*, size_t) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); # ifdef __CONST_CORRECT # define wcsncasestr(...) (__const_correct(wcsncasestr, __VA_ARGS__)) # endif @@ -951,7 +951,7 @@ wchar_t* wcsncasestr(const wchar_t*, const wchar_t*, size_t) * @return Pointer to the first occurrence of the substring. */ wchar_t* rawwcsstr(const wchar_t*, const wchar_t*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, returns_nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __returns_nonnull__, __pure__))); # ifdef __CONST_CORRECT # define rawwcsstr(...) (__const_correct(rawwcsstr, __VA_ARGS__)) # endif @@ -968,7 +968,7 @@ wchar_t* rawwcsstr(const wchar_t*, const wchar_t*) * @return Pointer to the first occurrence of the substring. */ wchar_t* rawwcscasestr(const wchar_t*, const wchar_t*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, returns_nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __returns_nonnull__, __pure__))); # ifdef __CONST_CORRECT # define rawwcscasestr(...) (__const_correct(rawwcscasestr, __VA_ARGS__)) # endif @@ -988,7 +988,7 @@ wchar_t* rawwcscasestr(const wchar_t*, const wchar_t*) * the substring, `NULL` if not found. */ wchar_t* wmemcasemem(const wchar_t*, size_t, const wchar_t*, size_t) - __GCC_ONLY(__attribute__((warn_unused_result, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __pure__))); # ifdef __CONST_CORRECT # define wmemcasemem(...) (__const_correct(wmemcasemem, __VA_ARGS__)) # endif @@ -1005,7 +1005,7 @@ wchar_t* wmemcasemem(const wchar_t*, size_t, const wchar_t*, size_t) * `desired`, `NULL` otherwise. */ wchar_t* wcsstarts(const wchar_t*, const wchar_t*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); # ifdef __CONST_CORRECT # define wcsstarts(...) (__const_correct(wcsstarts, __VA_ARGS__)) # endif @@ -1022,7 +1022,7 @@ wchar_t* wcsstarts(const wchar_t*, const wchar_t*) * `string` ends with `desired`, `NULL` otherwise. */ wchar_t* wcsends(const wchar_t*, const wchar_t*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); # ifdef __CONST_CORRECT # define wcsends(...) (__const_correct(wcsends, __VA_ARGS__)) # endif @@ -1039,7 +1039,7 @@ wchar_t* wcsends(const wchar_t*, const wchar_t*) * `desired`, `NULL` otherwise. */ wchar_t* wcscasestarts(const wchar_t*, const wchar_t*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); # ifdef __CONST_CORRECT # define wcscasestarts(...) (__const_correct(wcscasestarts, __VA_ARGS__)) # endif @@ -1056,7 +1056,7 @@ wchar_t* wcscasestarts(const wchar_t*, const wchar_t*) * `string` ends with `desired`, `NULL` otherwise. */ wchar_t* wcscaseends(const wchar_t*, const wchar_t*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); # ifdef __CONST_CORRECT # define wcscaseends(...) (__const_correct(wcscaseends, __VA_ARGS__)) # endif @@ -1079,7 +1079,7 @@ wchar_t* wcscaseends(const wchar_t*, const wchar_t*) * the substring, `NULL` if not found. */ wchar_t* wmemmem(const wchar_t*, size_t, const wchar_t*, size_t) - __GCC_ONLY(__attribute__((warn_unused_result, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __pure__))); # ifdef __CONST_CORRECT # define wmemmem(...) (__const_correct(wmemmem, __VA_ARGS__)) # endif @@ -1099,7 +1099,7 @@ wchar_t* wmemmem(const wchar_t*, size_t, const wchar_t*, size_t) * @return The length of the substring. */ size_t wcsspn(const wchar_t*, const wchar_t*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); /** * Returns length of the initial substring @@ -1111,7 +1111,7 @@ size_t wcsspn(const wchar_t*, const wchar_t*) * @return The length of the substring. */ size_t wcscspn(const wchar_t*, const wchar_t*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); /** * This function works like `strcspn`, @@ -1126,7 +1126,7 @@ size_t wcscspn(const wchar_t*, const wchar_t*) * `NULL` is returned if none is found. */ wchar_t* wcspbrk(const wchar_t*, const wchar_t*) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__, __pure__))); #ifdef __CONST_CORRECT # define wcspbrk(...) (__const_correct(wcspbrk, __VA_ARGS__)) #endif @@ -1152,7 +1152,7 @@ wchar_t* wcspbrk(const wchar_t*, const wchar_t*) * are no more tokens. */ wchar_t* wcstok(wchar_t* restrict, const wchar_t* restrict, wchar_t** restrict) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull(2, 3)))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__(2, 3)))); #if defined(__SLIBC_SOURCE) /** @@ -1173,7 +1173,7 @@ wchar_t* wcstok(wchar_t* restrict, const wchar_t* restrict, wchar_t** restrict) * are no more tokens. */ wchar_t* wcssep(wchar_t** restrict, const wchar_t* restrict) - __GCC_ONLY(__attribute__((warn_unused_result, nonnull))); + __GCC_ONLY(__attribute__((__warn_unused_result__, __nonnull__))); #endif diff --git a/src/slibc-alloc.c b/src/slibc-alloc.c index 733051c..cad55b0 100644 --- a/src/slibc-alloc.c +++ b/src/slibc-alloc.c @@ -277,7 +277,7 @@ void* naive_realloc(void* ptr, size_t size) /** - * This function behaves exactly like `__attribute__`, except + * This function behaves exactly like `naive_realloc`, except * it will return `NULL` with `errno` set to zero, if it is * not possible to perform the shrink or growth without creating * new pointer. |