summaryrefslogtreecommitdiff
path: root/include/stdlib.h
diff options
context:
space:
mode:
authorjvoisin2023-08-20 20:50:31 +0200
committerjvoisin2023-08-20 21:09:05 +0200
commitbfbaa577f6fc46ebb965724e0f261e79e26ec9fb (patch)
tree65e422e5f76c71d250dcdb5bd1537ea4c560fae4 /include/stdlib.h
parentd6afda7207b7a8a144923ab5813d8a0816813907 (diff)
Make use of __diagnose_as_builtin
Diffstat (limited to 'include/stdlib.h')
-rw-r--r--include/stdlib.h5
1 files changed, 5 insertions, 0 deletions
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" {
42 42
43__malloc(malloc (free, 1)) 43__malloc(malloc (free, 1))
44__alloc_size(1) 44__alloc_size(1)
45__diagnose_as_builtin(__builtin_malloc, 1)
45_FORTIFY_FN(malloc) void *malloc(size_t __s) 46_FORTIFY_FN(malloc) void *malloc(size_t __s)
46{ 47{
47 return __orig_malloc(__s); 48 return __orig_malloc(__s);
48} 49}
49 50
50__alloc_size(2) 51__alloc_size(2)
52__diagnose_as_builtin(__builtin_realloc, 1, 2)
51_FORTIFY_FN(realloc) void *realloc(void *__p, size_t __s) 53_FORTIFY_FN(realloc) void *realloc(void *__p, size_t __s)
52{ 54{
53 return __orig_realloc(__p, __s); 55 return __orig_realloc(__p, __s);
54} 56}
55 57
56__alloc_size(1, 2) 58__alloc_size(1, 2)
59__diagnose_as_builtin(__builtin_calloc, 1, 2)
57_FORTIFY_FN(calloc) void *calloc(size_t __n, size_t __s) 60_FORTIFY_FN(calloc) void *calloc(size_t __n, size_t __s)
58{ 61{
59 return __orig_calloc(__n, __s); 62 return __orig_calloc(__n, __s);
@@ -62,6 +65,7 @@ _FORTIFY_FN(calloc) void *calloc(size_t __n, size_t __s)
62#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) 65#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
63#undef reallocarray 66#undef reallocarray
64__alloc_size (2, 3) 67__alloc_size (2, 3)
68__diagnose_as_builtin(__builtin_reallocarray, 1, 2, 3)
65_FORTIFY_FN(reallocarray) void* reallocarray(void* __p, size_t __n, size_t __s) 69_FORTIFY_FN(reallocarray) void* reallocarray(void* __p, size_t __n, size_t __s)
66{ 70{
67 return __orig_reallocarray(__p, __n, __s); 71 return __orig_reallocarray(__p, __n, __s);
@@ -71,6 +75,7 @@ _FORTIFY_FN(reallocarray) void* reallocarray(void* __p, size_t __n, size_t __s)
71/* FIXME clang */ 75/* FIXME clang */
72#if (defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)) && !defined(__clang__) 76#if (defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)) && !defined(__clang__)
73#undef realpath 77#undef realpath
78__diagnose_as_builtin(__builtin_realpath, 1, 2)
74_FORTIFY_FN(realpath) char *realpath(const char *__p, char *__r) 79_FORTIFY_FN(realpath) char *realpath(const char *__p, char *__r)
75{ 80{
76#ifndef PATH_MAX 81#ifndef PATH_MAX