diff options
| author | jvoisin | 2023-08-20 20:50:31 +0200 |
|---|---|---|
| committer | jvoisin | 2023-08-20 21:09:05 +0200 |
| commit | bfbaa577f6fc46ebb965724e0f261e79e26ec9fb (patch) | |
| tree | 65e422e5f76c71d250dcdb5bd1537ea4c560fae4 /include/string.h | |
| parent | d6afda7207b7a8a144923ab5813d8a0816813907 (diff) | |
Make use of __diagnose_as_builtin
Diffstat (limited to 'include/string.h')
| -rw-r--r-- | include/string.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/string.h b/include/string.h index 4a3426a..2c11e5e 100644 --- a/include/string.h +++ b/include/string.h | |||
| @@ -40,6 +40,7 @@ extern "C" { | |||
| 40 | 40 | ||
| 41 | __access(write_only, 1, 3) | 41 | __access(write_only, 1, 3) |
| 42 | __access(read_only, 2, 3) | 42 | __access(read_only, 2, 3) |
| 43 | __diagnose_as_builtin(__builtin_memcpy, 1, 2, 3) | ||
| 43 | _FORTIFY_FN(memcpy) void *memcpy(void * _FORTIFY_POS0 __od, | 44 | _FORTIFY_FN(memcpy) void *memcpy(void * _FORTIFY_POS0 __od, |
| 44 | const void * _FORTIFY_POS0 __os, size_t __n) | 45 | const void * _FORTIFY_POS0 __os, size_t __n) |
| 45 | { | 46 | { |
| @@ -60,6 +61,7 @@ _FORTIFY_FN(memcpy) void *memcpy(void * _FORTIFY_POS0 __od, | |||
| 60 | 61 | ||
| 61 | __access(write_only, 1, 3) | 62 | __access(write_only, 1, 3) |
| 62 | __access(read_only, 2, 3) | 63 | __access(read_only, 2, 3) |
| 64 | __diagnose_as_builtin(__builtin_memmove, 1, 2, 3) | ||
| 63 | _FORTIFY_FN(memmove) void *memmove(void * _FORTIFY_POS0 __d, | 65 | _FORTIFY_FN(memmove) void *memmove(void * _FORTIFY_POS0 __d, |
| 64 | const void * _FORTIFY_POS0 __s, size_t __n) | 66 | const void * _FORTIFY_POS0 __s, size_t __n) |
| 65 | { | 67 | { |
| @@ -72,6 +74,7 @@ _FORTIFY_FN(memmove) void *memmove(void * _FORTIFY_POS0 __d, | |||
| 72 | } | 74 | } |
| 73 | 75 | ||
| 74 | __access(write_only, 1, 3) | 76 | __access(write_only, 1, 3) |
| 77 | __diagnose_as_builtin(__builtin_memset, 1, 2, 3) | ||
| 75 | _FORTIFY_FN(memset) void *memset(void * _FORTIFY_POS0 __d, int __c, size_t __n) | 78 | _FORTIFY_FN(memset) void *memset(void * _FORTIFY_POS0 __d, int __c, size_t __n) |
| 76 | { | 79 | { |
| 77 | size_t __b = __bos(__d, 0); | 80 | size_t __b = __bos(__d, 0); |
| @@ -82,6 +85,7 @@ _FORTIFY_FN(memset) void *memset(void * _FORTIFY_POS0 __d, int __c, size_t __n) | |||
| 82 | } | 85 | } |
| 83 | 86 | ||
| 84 | __access(read_only, 1, 3) | 87 | __access(read_only, 1, 3) |
| 88 | __diagnose_as_builtin(__builtin_memchr, 1, 2, 3) | ||
| 85 | _FORTIFY_FN(memchr) void *memchr(const void * _FORTIFY_POS0 __d, int __c, size_t __n) | 89 | _FORTIFY_FN(memchr) void *memchr(const void * _FORTIFY_POS0 __d, int __c, size_t __n) |
| 86 | { | 90 | { |
| 87 | size_t __b = __bos(__d, 0); | 91 | size_t __b = __bos(__d, 0); |
| @@ -92,6 +96,7 @@ _FORTIFY_FN(memchr) void *memchr(const void * _FORTIFY_POS0 __d, int __c, size_t | |||
| 92 | } | 96 | } |
| 93 | 97 | ||
| 94 | __access(read_only, 1, 2) | 98 | __access(read_only, 1, 2) |
| 99 | __diagnose_as_builtin(__builtin_strchr, 1, 2, 3) | ||
| 95 | _FORTIFY_FN(strchr) char *strchr(const char * _FORTIFY_POS0 __s, int __c) | 100 | _FORTIFY_FN(strchr) char *strchr(const char * _FORTIFY_POS0 __s, int __c) |
| 96 | { | 101 | { |
| 97 | size_t __b = __bos(__s, 0); | 102 | size_t __b = __bos(__s, 0); |
| @@ -103,6 +108,7 @@ _FORTIFY_FN(strchr) char *strchr(const char * _FORTIFY_POS0 __s, int __c) | |||
| 103 | } | 108 | } |
| 104 | 109 | ||
| 105 | __access(read_only, 1, 2) | 110 | __access(read_only, 1, 2) |
| 111 | __diagnose_as_builtin(__builtin_strrchr, 1, 2, 3) | ||
| 106 | _FORTIFY_FN(strrchr) char *strrchr(const char * _FORTIFY_POS0 __s, int __c) | 112 | _FORTIFY_FN(strrchr) char *strrchr(const char * _FORTIFY_POS0 __s, int __c) |
| 107 | { | 113 | { |
| 108 | size_t __b = __bos(__s, 0); | 114 | size_t __b = __bos(__s, 0); |
| @@ -119,6 +125,7 @@ _FORTIFY_FN(strrchr) char *strrchr(const char * _FORTIFY_POS0 __s, int __c) | |||
| 119 | #undef stpcpy | 125 | #undef stpcpy |
| 120 | __access(write_only, 1) | 126 | __access(write_only, 1) |
| 121 | __access(read_only, 2) | 127 | __access(read_only, 2) |
| 128 | __diagnose_as_builtin(__builtin_stpcpy, 1, 2) | ||
| 122 | _FORTIFY_FN(stpcpy) char *stpcpy(char * _FORTIFY_POS0 __d, const char *__s) | 129 | _FORTIFY_FN(stpcpy) char *stpcpy(char * _FORTIFY_POS0 __d, const char *__s) |
| 123 | { | 130 | { |
| 124 | size_t __n = strlen(__s) + 1; | 131 | size_t __n = strlen(__s) + 1; |
| @@ -138,6 +145,7 @@ _FORTIFY_FN(stpcpy) char *stpcpy(char * _FORTIFY_POS0 __d, const char *__s) | |||
| 138 | #undef stpncpy | 145 | #undef stpncpy |
| 139 | __access(write_only, 1) | 146 | __access(write_only, 1) |
| 140 | __access(read_only, 2, 3) | 147 | __access(read_only, 2, 3) |
| 148 | __diagnose_as_builtin(__builtin_stpncpy, 1, 2, 3) | ||
| 141 | _FORTIFY_FN(stpncpy) char *stpncpy(char * _FORTIFY_POS0 __d, const char *__s, | 149 | _FORTIFY_FN(stpncpy) char *stpncpy(char * _FORTIFY_POS0 __d, const char *__s, |
| 142 | size_t __n) | 150 | size_t __n) |
| 143 | { | 151 | { |
| @@ -156,6 +164,7 @@ _FORTIFY_FN(stpncpy) char *stpncpy(char * _FORTIFY_POS0 __d, const char *__s, | |||
| 156 | 164 | ||
| 157 | __access (read_write, 1) | 165 | __access (read_write, 1) |
| 158 | __access (read_only, 2) | 166 | __access (read_only, 2) |
| 167 | __diagnose_as_builtin(__builtin_strcat, 1, 2) | ||
| 159 | _FORTIFY_FN(strcat) char *strcat(char * _FORTIFY_POS0 __d, const char *__s) | 168 | _FORTIFY_FN(strcat) char *strcat(char * _FORTIFY_POS0 __d, const char *__s) |
| 160 | { | 169 | { |
| 161 | size_t __b = __bos(__d, 0); | 170 | size_t __b = __bos(__d, 0); |
| @@ -167,6 +176,7 @@ _FORTIFY_FN(strcat) char *strcat(char * _FORTIFY_POS0 __d, const char *__s) | |||
| 167 | 176 | ||
| 168 | __access (write_only, 1) | 177 | __access (write_only, 1) |
| 169 | __access (read_only, 2) | 178 | __access (read_only, 2) |
| 179 | __diagnose_as_builtin(__builtin_strcpy, 1, 2) | ||
| 170 | _FORTIFY_FN(strcpy) char *strcpy(char * _FORTIFY_POS0 __d, const char *__s) | 180 | _FORTIFY_FN(strcpy) char *strcpy(char * _FORTIFY_POS0 __d, const char *__s) |
| 171 | { | 181 | { |
| 172 | size_t __n = strlen(__s) + 1; | 182 | size_t __n = strlen(__s) + 1; |
| @@ -185,6 +195,7 @@ _FORTIFY_FN(strcpy) char *strcpy(char * _FORTIFY_POS0 __d, const char *__s) | |||
| 185 | 195 | ||
| 186 | __access (read_write, 1) | 196 | __access (read_write, 1) |
| 187 | __access (read_only, 2, 3) | 197 | __access (read_only, 2, 3) |
| 198 | __diagnose_as_builtin(__builtin_strncat, 1, 2, 3) | ||
| 188 | _FORTIFY_FN(strncat) char *strncat(char * _FORTIFY_POS0 __d, const char *__s, | 199 | _FORTIFY_FN(strncat) char *strncat(char * _FORTIFY_POS0 __d, const char *__s, |
| 189 | size_t __n) | 200 | size_t __n) |
| 190 | { | 201 | { |
| @@ -203,6 +214,7 @@ _FORTIFY_FN(strncat) char *strncat(char * _FORTIFY_POS0 __d, const char *__s, | |||
| 203 | 214 | ||
| 204 | __access (write_only, 1) | 215 | __access (write_only, 1) |
| 205 | __access (read_only, 2, 3) | 216 | __access (read_only, 2, 3) |
| 217 | __diagnose_as_builtin(__builtin_strncpy, 1, 2, 3) | ||
| 206 | _FORTIFY_FN(strncpy) char *strncpy(char * _FORTIFY_POS0 __d, | 218 | _FORTIFY_FN(strncpy) char *strncpy(char * _FORTIFY_POS0 __d, |
| 207 | const char *__s, size_t __n) | 219 | const char *__s, size_t __n) |
| 208 | { | 220 | { |
| @@ -222,6 +234,7 @@ _FORTIFY_FN(strncpy) char *strncpy(char * _FORTIFY_POS0 __d, | |||
| 222 | #undef mempcpy | 234 | #undef mempcpy |
| 223 | __access(write_only, 1) | 235 | __access(write_only, 1) |
| 224 | __access(read_only, 2, 3) | 236 | __access(read_only, 2, 3) |
| 237 | __diagnose_as_builtin(__builtin_mempcpy, 1, 2, 3) | ||
| 225 | _FORTIFY_FN(mempcpy) void *mempcpy(void * _FORTIFY_POS0 __d, | 238 | _FORTIFY_FN(mempcpy) void *mempcpy(void * _FORTIFY_POS0 __d, |
| 226 | const void * _FORTIFY_POS0 __s, size_t __n) | 239 | const void * _FORTIFY_POS0 __s, size_t __n) |
| 227 | { | 240 | { |
| @@ -239,6 +252,7 @@ _FORTIFY_FN(mempcpy) void *mempcpy(void * _FORTIFY_POS0 __d, | |||
| 239 | #undef strlcpy | 252 | #undef strlcpy |
| 240 | __access (read_write, 1) | 253 | __access (read_write, 1) |
| 241 | __access (read_only, 2, 3) | 254 | __access (read_only, 2, 3) |
| 255 | __diagnose_as_builtin(__builtin_strlcat, 1, 2, 3) | ||
| 242 | _FORTIFY_FN(strlcat) size_t strlcat(char * _FORTIFY_POS0 __d, | 256 | _FORTIFY_FN(strlcat) size_t strlcat(char * _FORTIFY_POS0 __d, |
| 243 | const char *__s, size_t __n) | 257 | const char *__s, size_t __n) |
| 244 | { | 258 | { |
| @@ -251,6 +265,7 @@ _FORTIFY_FN(strlcat) size_t strlcat(char * _FORTIFY_POS0 __d, | |||
| 251 | 265 | ||
| 252 | __access (write_only, 1) | 266 | __access (write_only, 1) |
| 253 | __access (read_only, 2, 3) | 267 | __access (read_only, 2, 3) |
| 268 | __diagnose_as_builtin(__builtin_strlcpy, 1, 2, 3) | ||
| 254 | _FORTIFY_FN(strlcpy) size_t strlcpy(char * _FORTIFY_POS0 __d, | 269 | _FORTIFY_FN(strlcpy) size_t strlcpy(char * _FORTIFY_POS0 __d, |
| 255 | const char *__s, size_t __n) | 270 | const char *__s, size_t __n) |
| 256 | { | 271 | { |
