diff options
Diffstat (limited to 'include/string.h')
| -rw-r--r-- | include/string.h | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/include/string.h b/include/string.h index be8229d..dc7cc19 100644 --- a/include/string.h +++ b/include/string.h | |||
| @@ -53,7 +53,7 @@ _FORTIFY_FN(memcpy) void *memcpy(void *restrict _FORTIFY_POS0 __od, | |||
| 53 | #endif | 53 | #endif |
| 54 | __error_if((__fh_bos(__od, 0) < __n), "'memcpy' called with `n` bigger than the size of `d`.") | 54 | __error_if((__fh_bos(__od, 0) < __n), "'memcpy' called with `n` bigger than the size of `d`.") |
| 55 | { | 55 | { |
| 56 | #if __has_builtin(__builtin___memcpy_chk) && FORTIFY_USE_NATIVE_CHK | 56 | #if __has_builtin(__builtin___memcpy_chk) && defined(FORTIFY_USE_NATIVE_CHK) |
| 57 | return __builtin___memcpy_chk(__od, __os, __n, __fh_bos(__od, 0)); | 57 | return __builtin___memcpy_chk(__od, __os, __n, __fh_bos(__od, 0)); |
| 58 | #else | 58 | #else |
| 59 | #if defined FORTIFY_PEDANTIC_CHECKS | 59 | #if defined FORTIFY_PEDANTIC_CHECKS |
| @@ -80,7 +80,7 @@ __diagnose_as_builtin(__builtin_memmove, 1, 2, 3) | |||
| 80 | _FORTIFY_FN(memmove) void *memmove(void * _FORTIFY_POS0 __d, | 80 | _FORTIFY_FN(memmove) void *memmove(void * _FORTIFY_POS0 __d, |
| 81 | const void * _FORTIFY_POS0 __s, size_t __n) | 81 | const void * _FORTIFY_POS0 __s, size_t __n) |
| 82 | { | 82 | { |
| 83 | #if __has_builtin(__builtin___memmove_chk) && FORTIFY_USE_NATIVE_CHK | 83 | #if __has_builtin(__builtin___memmove_chk) && defined(FORTIFY_USE_NATIVE_CHK) |
| 84 | return __builtin___memmove_chk(__d, __s, __n, __fh_bos(__d, 0)); | 84 | return __builtin___memmove_chk(__d, __s, __n, __fh_bos(__d, 0)); |
| 85 | #else | 85 | #else |
| 86 | #if defined FORTIFY_PEDANTIC_CHECKS | 86 | #if defined FORTIFY_PEDANTIC_CHECKS |
| @@ -104,7 +104,7 @@ __diagnose_as_builtin(__builtin_memset, 1, 2, 3) | |||
| 104 | _FORTIFY_FN(memset) void *memset(void * _FORTIFY_POS0 __d, int __c, size_t __n) | 104 | _FORTIFY_FN(memset) void *memset(void * _FORTIFY_POS0 __d, int __c, size_t __n) |
| 105 | __warning_if(__c != 0 && __n == 0, "'memset' will set `0` bytes; did you invert the arguments?") | 105 | __warning_if(__c != 0 && __n == 0, "'memset' will set `0` bytes; did you invert the arguments?") |
| 106 | { | 106 | { |
| 107 | #if __has_builtin(__builtin___memset_chk) && FORTIFY_USE_NATIVE_CHK | 107 | #if __has_builtin(__builtin___memset_chk) && defined(FORTIFY_USE_NATIVE_CHK) |
| 108 | return __builtin___memset_chk(__d, __c, __n, __fh_bos(__d, 0)); | 108 | return __builtin___memset_chk(__d, __c, __n, __fh_bos(__d, 0)); |
| 109 | #else | 109 | #else |
| 110 | #if defined FORTIFY_PEDANTIC_CHECKS | 110 | #if defined FORTIFY_PEDANTIC_CHECKS |
| @@ -126,7 +126,7 @@ __diagnose_as_builtin(__builtin_memchr, 1, 2, 3) | |||
| 126 | #endif | 126 | #endif |
| 127 | _FORTIFY_FN(memchr) void *memchr(const void * _FORTIFY_POS0 __d, int __c, size_t __n) | 127 | _FORTIFY_FN(memchr) void *memchr(const void * _FORTIFY_POS0 __d, int __c, size_t __n) |
| 128 | { | 128 | { |
| 129 | #if __has_builtin(__builtin___memchr_chk) && FORTIFY_USE_NATIVE_CHK | 129 | #if __has_builtin(__builtin___memchr_chk) && defined(FORTIFY_USE_NATIVE_CHK) |
| 130 | return __builtin___memchr_chk(__d, __c, __n, __fh_bos(__d, 0)); | 130 | return __builtin___memchr_chk(__d, __c, __n, __fh_bos(__d, 0)); |
| 131 | #else | 131 | #else |
| 132 | #if defined FORTIFY_PEDANTIC_CHECKS | 132 | #if defined FORTIFY_PEDANTIC_CHECKS |
| @@ -147,7 +147,7 @@ _FORTIFY_FN(memchr) void *memchr(const void * _FORTIFY_POS0 __d, int __c, size_t | |||
| 147 | __fh_access(read_only, 1, 2) | 147 | __fh_access(read_only, 1, 2) |
| 148 | _FORTIFY_FN(strchr) char *strchr(const char * _FORTIFY_POS0 __s, int __c) | 148 | _FORTIFY_FN(strchr) char *strchr(const char * _FORTIFY_POS0 __s, int __c) |
| 149 | { | 149 | { |
| 150 | #if __has_builtin(__builtin___strchr_chk) && FORTIFY_USE_NATIVE_CHK | 150 | #if __has_builtin(__builtin___strchr_chk) && defined(FORTIFY_USE_NATIVE_CHK) |
| 151 | return __builtin___strchr_chk(__s, __c, __fh_bos(__s, 0)); | 151 | return __builtin___strchr_chk(__s, __c, __fh_bos(__s, 0)); |
| 152 | #else | 152 | #else |
| 153 | __fh_size_t __b = __fh_bos(__s, 0); | 153 | __fh_size_t __b = __fh_bos(__s, 0); |
| @@ -162,7 +162,7 @@ _FORTIFY_FN(strchr) char *strchr(const char * _FORTIFY_POS0 __s, int __c) | |||
| 162 | __fh_access(read_only, 1, 2) | 162 | __fh_access(read_only, 1, 2) |
| 163 | _FORTIFY_FN(strrchr) char *strrchr(const char * _FORTIFY_POS0 __s, int __c) | 163 | _FORTIFY_FN(strrchr) char *strrchr(const char * _FORTIFY_POS0 __s, int __c) |
| 164 | { | 164 | { |
| 165 | #if __has_builtin(__builtin___strrchr_chk) && FORTIFY_USE_NATIVE_CHK | 165 | #if __has_builtin(__builtin___strrchr_chk) && defined(FORTIFY_USE_NATIVE_CHK) |
| 166 | return __builtin___strrchr_chk(__s, __c, __fh_bos(__s, 0)); | 166 | return __builtin___strrchr_chk(__s, __c, __fh_bos(__s, 0)); |
| 167 | #else | 167 | #else |
| 168 | __fh_size_t __b = __fh_bos(__s, 0); | 168 | __fh_size_t __b = __fh_bos(__s, 0); |
| @@ -186,7 +186,7 @@ __diagnose_as_builtin(__builtin_stpcpy, 1, 2) | |||
| 186 | #endif | 186 | #endif |
| 187 | _FORTIFY_FN(stpcpy) char *stpcpy(char * _FORTIFY_POS0 __d, const char *__s) | 187 | _FORTIFY_FN(stpcpy) char *stpcpy(char * _FORTIFY_POS0 __d, const char *__s) |
| 188 | { | 188 | { |
| 189 | #if __has_builtin(__builtin___stpcpy_chk) && FORTIFY_USE_NATIVE_CHK | 189 | #if __has_builtin(__builtin___stpcpy_chk) && defined(FORTIFY_USE_NATIVE_CHK) |
| 190 | return __builtin___stpcpy_chk(__d, __s, __fh_bos(__d, 0)); | 190 | return __builtin___stpcpy_chk(__d, __s, __fh_bos(__d, 0)); |
| 191 | #else | 191 | #else |
| 192 | __fh_size_t __n = strlen(__s) + 1; | 192 | __fh_size_t __n = strlen(__s) + 1; |
| @@ -210,7 +210,7 @@ __diagnose_as_builtin(__builtin_stpncpy, 1, 2, 3) | |||
| 210 | _FORTIFY_FN(stpncpy) char *stpncpy(char * _FORTIFY_POS0 __d, const char *__s, | 210 | _FORTIFY_FN(stpncpy) char *stpncpy(char * _FORTIFY_POS0 __d, const char *__s, |
| 211 | size_t __n) | 211 | size_t __n) |
| 212 | { | 212 | { |
| 213 | #if __has_builtin(__builtin___stpncpy_chk) && FORTIFY_USE_NATIVE_CHK | 213 | #if __has_builtin(__builtin___stpncpy_chk) && defined(FORTIFY_USE_NATIVE_CHK) |
| 214 | return __builtin___stpncpy_chk(__d, __s, __n, __fh_bos(__d, 0)); | 214 | return __builtin___stpncpy_chk(__d, __s, __n, __fh_bos(__d, 0)); |
| 215 | #else | 215 | #else |
| 216 | // If the length strlen(src) is smaller than n, the remaining | 216 | // If the length strlen(src) is smaller than n, the remaining |
| @@ -232,7 +232,7 @@ __diagnose_as_builtin(__builtin_strcat, 1, 2) | |||
| 232 | #endif | 232 | #endif |
| 233 | _FORTIFY_FN(strcat) char *strcat(char * _FORTIFY_POS0 __d, const char *__s) | 233 | _FORTIFY_FN(strcat) char *strcat(char * _FORTIFY_POS0 __d, const char *__s) |
| 234 | { | 234 | { |
| 235 | #if __has_builtin(__builtin___strcat_chk) && FORTIFY_USE_NATIVE_CHK | 235 | #if __has_builtin(__builtin___strcat_chk) && defined(FORTIFY_USE_NATIVE_CHK) |
| 236 | return __builtin___strcat_chk(__d, __s, __fh_bos(__d, 0)); | 236 | return __builtin___strcat_chk(__d, __s, __fh_bos(__d, 0)); |
| 237 | #else | 237 | #else |
| 238 | __fh_size_t __b = __fh_bos(__d, 0); | 238 | __fh_size_t __b = __fh_bos(__d, 0); |
| @@ -250,7 +250,7 @@ __diagnose_as_builtin(__builtin_strcpy, 1, 2) | |||
| 250 | #endif | 250 | #endif |
| 251 | _FORTIFY_FN(strcpy) char *strcpy(char * _FORTIFY_POS0 __d, const char *__s) | 251 | _FORTIFY_FN(strcpy) char *strcpy(char * _FORTIFY_POS0 __d, const char *__s) |
| 252 | { | 252 | { |
| 253 | #if __has_builtin(__builtin___strcpy_chk) && FORTIFY_USE_NATIVE_CHK | 253 | #if __has_builtin(__builtin___strcpy_chk) && defined(FORTIFY_USE_NATIVE_CHK) |
| 254 | return __builtin___strcpy_chk(__d, __s, __fh_bos(__d, 0)); | 254 | return __builtin___strcpy_chk(__d, __s, __fh_bos(__d, 0)); |
| 255 | #else | 255 | #else |
| 256 | __fh_size_t __n = strlen(__s) + 1; | 256 | __fh_size_t __n = strlen(__s) + 1; |
| @@ -271,7 +271,7 @@ __diagnose_as_builtin(__builtin_strlen, 1) | |||
| 271 | #endif | 271 | #endif |
| 272 | _FORTIFY_FN(strlen) size_t strlen(const char * _FORTIFY_POS0 __s) | 272 | _FORTIFY_FN(strlen) size_t strlen(const char * _FORTIFY_POS0 __s) |
| 273 | { | 273 | { |
| 274 | #if __has_builtin(__builtin___strlen_chk) && FORTIFY_USE_NATIVE_CHK | 274 | #if __has_builtin(__builtin___strlen_chk) && defined(FORTIFY_USE_NATIVE_CHK) |
| 275 | return __builtin___strlen_chk(__s, __fh_bos(__s, 0)); | 275 | return __builtin___strlen_chk(__s, __fh_bos(__s, 0)); |
| 276 | #else | 276 | #else |
| 277 | __fh_size_t ret = __orig_strlen(__s); | 277 | __fh_size_t ret = __orig_strlen(__s); |
| @@ -289,7 +289,7 @@ __diagnose_as_builtin(__builtin_strncat, 1, 2, 3) | |||
| 289 | _FORTIFY_FN(strncat) char *strncat(char * _FORTIFY_POS0 __d, const char *__s, | 289 | _FORTIFY_FN(strncat) char *strncat(char * _FORTIFY_POS0 __d, const char *__s, |
| 290 | size_t __n) | 290 | size_t __n) |
| 291 | { | 291 | { |
| 292 | #if __has_builtin(__builtin___strncat_chk) && FORTIFY_USE_NATIVE_CHK | 292 | #if __has_builtin(__builtin___strncat_chk) && defined(FORTIFY_USE_NATIVE_CHK) |
| 293 | return __builtin___strncat_chk(__d, __s, __n, __fh_bos(__d, 0)); | 293 | return __builtin___strncat_chk(__d, __s, __n, __fh_bos(__d, 0)); |
| 294 | #else | 294 | #else |
| 295 | #if 0 // strlen(__s) isn't guaranteed to be valid. | 295 | #if 0 // strlen(__s) isn't guaranteed to be valid. |
| @@ -316,7 +316,7 @@ __diagnose_as_builtin(__builtin_strncpy, 1, 2, 3) | |||
| 316 | _FORTIFY_FN(strncpy) char *strncpy(char * _FORTIFY_POS0 __d, | 316 | _FORTIFY_FN(strncpy) char *strncpy(char * _FORTIFY_POS0 __d, |
| 317 | const char *__s, size_t __n) | 317 | const char *__s, size_t __n) |
| 318 | { | 318 | { |
| 319 | #if __has_builtin(__builtin___strncpy_chk) && FORTIFY_USE_NATIVE_CHK | 319 | #if __has_builtin(__builtin___strncpy_chk) && defined(FORTIFY_USE_NATIVE_CHK) |
| 320 | return __builtin___strncpy_chk(__d, __s, __n, __fh_bos(__d, 0)); | 320 | return __builtin___strncpy_chk(__d, __s, __n, __fh_bos(__d, 0)); |
| 321 | #else | 321 | #else |
| 322 | // If the length of src is less than n, strncpy() writes additional | 322 | // If the length of src is less than n, strncpy() writes additional |
| @@ -339,7 +339,7 @@ __diagnose_as_builtin(__builtin_mempcpy, 1, 2, 3) | |||
| 339 | _FORTIFY_FN(mempcpy) void *mempcpy(void * _FORTIFY_POS0 __d, | 339 | _FORTIFY_FN(mempcpy) void *mempcpy(void * _FORTIFY_POS0 __d, |
| 340 | const void * _FORTIFY_POS0 __s, size_t __n) | 340 | const void * _FORTIFY_POS0 __s, size_t __n) |
| 341 | { | 341 | { |
| 342 | #if __has_builtin(__builtin___mempcpy_chk) && FORTIFY_USE_NATIVE_CHK | 342 | #if __has_builtin(__builtin___mempcpy_chk) && defined(FORTIFY_USE_NATIVE_CHK) |
| 343 | return __builtin___mempcpy_chk(__d, __s, __n, __fh_bos(__d, 0)); | 343 | return __builtin___mempcpy_chk(__d, __s, __n, __fh_bos(__d, 0)); |
| 344 | #else | 344 | #else |
| 345 | if (!__d || !__s) | 345 | if (!__d || !__s) |
| @@ -366,7 +366,7 @@ __diagnose_as_builtin(__builtin_strlcat, 1, 2, 3) | |||
| 366 | _FORTIFY_FN(strlcat) size_t strlcat(char * _FORTIFY_POS0 __d, | 366 | _FORTIFY_FN(strlcat) size_t strlcat(char * _FORTIFY_POS0 __d, |
| 367 | const char *__s, size_t __n) | 367 | const char *__s, size_t __n) |
| 368 | { | 368 | { |
| 369 | #if __has_builtin(__builtin___strlcat_chk) && FORTIFY_USE_NATIVE_CHK | 369 | #if __has_builtin(__builtin___strlcat_chk) && defined(FORTIFY_USE_NATIVE_CHK) |
| 370 | return __builtin___strlcat_chk(__d, __s, __n, __fh_bos(__d, 0)); | 370 | return __builtin___strlcat_chk(__d, __s, __n, __fh_bos(__d, 0)); |
| 371 | #else | 371 | #else |
| 372 | __fh_size_t __b = __fh_bos(__d, 0); | 372 | __fh_size_t __b = __fh_bos(__d, 0); |
| @@ -385,7 +385,7 @@ __diagnose_as_builtin(__builtin_strlcpy, 1, 2, 3) | |||
| 385 | _FORTIFY_FN(strlcpy) size_t strlcpy(char * _FORTIFY_POS0 __d, | 385 | _FORTIFY_FN(strlcpy) size_t strlcpy(char * _FORTIFY_POS0 __d, |
| 386 | const char *__s, size_t __n) | 386 | const char *__s, size_t __n) |
| 387 | { | 387 | { |
| 388 | #if __has_builtin(__builtin___strlcpy_chk) && FORTIFY_USE_NATIVE_CHK | 388 | #if __has_builtin(__builtin___strlcpy_chk) && defined(FORTIFY_USE_NATIVE_CHK) |
| 389 | return __builtin___strlcpy_chk(__d, __s, __n, __fh_bos(__d, 0)); | 389 | return __builtin___strlcpy_chk(__d, __s, __n, __fh_bos(__d, 0)); |
| 390 | #else | 390 | #else |
| 391 | __fh_size_t __b = __fh_bos(__d, 0); | 391 | __fh_size_t __b = __fh_bos(__d, 0); |
