From bfbaa577f6fc46ebb965724e0f261e79e26ec9fb Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sun, 20 Aug 2023 20:50:31 +0200 Subject: Make use of __diagnose_as_builtin --- include/stdlib.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/stdlib.h') diff --git a/include/stdlib.h b/include/stdlib.h index 3f3c3ba..4efdb82 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -42,18 +42,21 @@ extern "C" { __malloc(malloc (free, 1)) __alloc_size(1) +__diagnose_as_builtin(__builtin_malloc, 1) _FORTIFY_FN(malloc) void *malloc(size_t __s) { return __orig_malloc(__s); } __alloc_size(2) +__diagnose_as_builtin(__builtin_realloc, 1, 2) _FORTIFY_FN(realloc) void *realloc(void *__p, size_t __s) { return __orig_realloc(__p, __s); } __alloc_size(1, 2) +__diagnose_as_builtin(__builtin_calloc, 1, 2) _FORTIFY_FN(calloc) void *calloc(size_t __n, size_t __s) { return __orig_calloc(__n, __s); @@ -62,6 +65,7 @@ _FORTIFY_FN(calloc) void *calloc(size_t __n, size_t __s) #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #undef reallocarray __alloc_size (2, 3) +__diagnose_as_builtin(__builtin_reallocarray, 1, 2, 3) _FORTIFY_FN(reallocarray) void* reallocarray(void* __p, size_t __n, size_t __s) { return __orig_reallocarray(__p, __n, __s); @@ -71,6 +75,7 @@ _FORTIFY_FN(reallocarray) void* reallocarray(void* __p, size_t __n, size_t __s) /* FIXME clang */ #if (defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)) && !defined(__clang__) #undef realpath +__diagnose_as_builtin(__builtin_realpath, 1, 2) _FORTIFY_FN(realpath) char *realpath(const char *__p, char *__r) { #ifndef PATH_MAX -- cgit v1.3