diff options
author | Elliott Hughes <enh@google.com> | 2017-08-01 08:28:46 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2017-08-01 08:28:46 -0700 |
commit | ec6850d849746ffbafaaf9b993c5dbb74a014b3f (patch) | |
tree | 61861bc94bfe8ebb50cfb263610f7d47d367b769 /libc | |
parent | c2a10f7f1bc23e81a49bcf4e98989042865261b3 (diff) |
Remove restrict/__restrict.
We've never really used __restrict: only <string.h> and <stdio.h> (which
are still very similar to upstream BSD headers) consistently have these
annotations. Neither clang nor GCC warns for trivial cases, and there's
little obvious documentation benefit.
Bug: http://b/30833514
Test: builds
Change-Id: I3e4384281865475d0c55d764b546d8166419ee31
Diffstat (limited to 'libc')
-rw-r--r-- | libc/SECCOMP_WHITELIST.TXT | 6 | ||||
-rw-r--r-- | libc/bionic/fortify.cpp | 24 | ||||
-rw-r--r-- | libc/include/bits/fortify/stdio.h | 55 | ||||
-rw-r--r-- | libc/include/bits/fortify/string.h | 40 | ||||
-rw-r--r-- | libc/include/inttypes.h | 8 | ||||
-rw-r--r-- | libc/include/search.h | 2 | ||||
-rw-r--r-- | libc/include/stdio.h | 64 | ||||
-rw-r--r-- | libc/include/string.h | 32 | ||||
-rw-r--r-- | libc/include/sys/statvfs.h | 6 | ||||
-rw-r--r-- | libc/include/uchar.h | 10 | ||||
-rw-r--r-- | libc/stdio/local.h | 6 |
11 files changed, 116 insertions, 137 deletions
diff --git a/libc/SECCOMP_WHITELIST.TXT b/libc/SECCOMP_WHITELIST.TXT index 0b9dad3ff..9e417c457 100644 --- a/libc/SECCOMP_WHITELIST.TXT +++ b/libc/SECCOMP_WHITELIST.TXT @@ -63,7 +63,7 @@ int pipe:pipe(int pipefd[2]) arm,x86,mips # b/34651972 int access:access(const char *pathname, int mode) arm,x86,mips -int stat64:stat64(const char *restrict path, struct stat64 *restrict buf) arm,x86,mips +int stat64:stat64(const char*, struct stat64*) arm,x86,mips # b/34813887 int open:open(const char *path, int oflag, ... ) arm,x86,mips @@ -88,7 +88,7 @@ int creat:creat(const char *pathname, mode_t mode) arm,x86,mips int unlink:unlink(const char *pathname) arm,x86,mips # b/35059702 -int lstat64:lstat64(const char *restrict path, struct stat64 *restrict buf) arm,x86,mips +int lstat64:lstat64(const char*, struct stat64*) arm,x86,mips # b/35217603 int fcntl:fcntl(int fd, int cmd, ... /* arg */ ) arm,x86,mips @@ -126,4 +126,4 @@ int dup2(int oldfd, int newfd) arm,x86,mips int compat_select:_newselect(int n, unsigned long* inp, unsigned long* outp, unsigned long* exp, struct timeval* timeout) arm,x86,mips # b/62090571 -int mkdir(const char *pathname, mode_t mode) arm,x86,mips
\ No newline at end of file +int mkdir(const char *pathname, mode_t mode) arm,x86,mips diff --git a/libc/bionic/fortify.cpp b/libc/bionic/fortify.cpp index 4a7ff1367..eaf538742 100644 --- a/libc/bionic/fortify.cpp +++ b/libc/bionic/fortify.cpp @@ -103,8 +103,7 @@ char* __fgets_chk(char* dst, int supplied_size, FILE* stream, size_t dst_len_fro return fgets(dst, supplied_size, stream); } -size_t __fread_chk(void* __restrict buf, size_t size, size_t count, - FILE* __restrict stream, size_t buf_size) { +size_t __fread_chk(void* buf, size_t size, size_t count, FILE* stream, size_t buf_size) { size_t total; if (__predict_false(__size_mul_overflow(size, count, &total))) { // overflow: trigger the error path in fread @@ -114,8 +113,7 @@ size_t __fread_chk(void* __restrict buf, size_t size, size_t count, return fread(buf, size, count, stream); } -size_t __fwrite_chk(const void* __restrict buf, size_t size, size_t count, - FILE* __restrict stream, size_t buf_size) { +size_t __fwrite_chk(const void* buf, size_t size, size_t count, FILE* stream, size_t buf_size) { size_t total; if (__predict_false(__size_mul_overflow(size, count, &total))) { // overflow: trigger the error path in fwrite @@ -239,8 +237,7 @@ extern "C" char* __stpcpy_chk(char* dst, const char* src, size_t dst_len) { } // Runtime implementation of __builtin____stpncpy_chk (used directly by compiler, not in headers). -extern "C" char* __stpncpy_chk(char* __restrict dst, const char* __restrict src, - size_t len, size_t dst_len) { +extern "C" char* __stpncpy_chk(char* dst, const char* src, size_t len, size_t dst_len) { __check_buffer_access("stpncpy", "write into", len, dst_len); return stpncpy(dst, src, len); } @@ -249,8 +246,7 @@ extern "C" char* __stpncpy_chk(char* __restrict dst, const char* __restrict src, // sure we don't read beyond the end of "src". The code for this is // based on the original version of stpncpy, but modified to check // how much we read from "src" at the end of the copy operation. -char* __stpncpy_chk2(char* __restrict dst, const char* __restrict src, - size_t n, size_t dst_len, size_t src_len) { +char* __stpncpy_chk2(char* dst, const char* src, size_t n, size_t dst_len, size_t src_len) { __check_buffer_access("stpncpy", "write into", n, dst_len); if (n != 0) { char* d = dst; @@ -325,8 +321,7 @@ size_t __strlen_chk(const char* s, size_t s_len) { } // Runtime implementation of __builtin____strncat_chk (used directly by compiler, not in headers). -extern "C" char* __strncat_chk(char* __restrict dst, const char* __restrict src, - size_t len, size_t dst_buf_size) { +extern "C" char* __strncat_chk(char* dst, const char* src, size_t len, size_t dst_buf_size) { if (len == 0) { return dst; } @@ -353,8 +348,7 @@ extern "C" char* __strncat_chk(char* __restrict dst, const char* __restrict src, } // Runtime implementation of __builtin____strncpy_chk (used directly by compiler, not in headers). -extern "C" char* __strncpy_chk(char* __restrict dst, const char* __restrict src, - size_t len, size_t dst_len) { +extern "C" char* __strncpy_chk(char* dst, const char* src, size_t len, size_t dst_len) { __check_buffer_access("strncpy", "write into", len, dst_len); return strncpy(dst, src, len); } @@ -363,8 +357,7 @@ extern "C" char* __strncpy_chk(char* __restrict dst, const char* __restrict src, // sure we don't read beyond the end of "src". The code for this is // based on the original version of strncpy, but modified to check // how much we read from "src" at the end of the copy operation. -char* __strncpy_chk2(char* __restrict dst, const char* __restrict src, - size_t n, size_t dst_len, size_t src_len) { +char* __strncpy_chk2(char* dst, const char* src, size_t n, size_t dst_len, size_t src_len) { __check_buffer_access("strncpy", "write into", n, dst_len); if (n != 0) { char* d = dst; @@ -459,8 +452,7 @@ ssize_t __write_chk(int fd, const void* buf, size_t count, size_t buf_size) { #if !defined(NO___STRCAT_CHK) // Runtime implementation of __builtin____strcat_chk (used directly by compiler, not in headers). -extern "C" char* __strcat_chk(char* __restrict dst, const char* __restrict src, - size_t dst_buf_size) { +extern "C" char* __strcat_chk(char* dst, const char* src, size_t dst_buf_size) { char* save = dst; size_t dst_len = __strlen_chk(dst, dst_buf_size); diff --git a/libc/include/bits/fortify/stdio.h b/libc/include/bits/fortify/stdio.h index dce056a31..22dc2174f 100644 --- a/libc/include/bits/fortify/stdio.h +++ b/libc/include/bits/fortify/stdio.h @@ -31,10 +31,8 @@ #endif char* __fgets_chk(char*, int, FILE*, size_t) __INTRODUCED_IN(17); -size_t __fread_chk(void* __restrict, size_t, size_t, FILE* __restrict, size_t) - __INTRODUCED_IN(24); -size_t __fwrite_chk(const void* __restrict, size_t, size_t, FILE* __restrict, size_t) - __INTRODUCED_IN(24); +size_t __fread_chk(void*, size_t, size_t, FILE*, size_t) __INTRODUCED_IN(24); +size_t __fwrite_chk(const void*, size_t, size_t, FILE*, size_t) __INTRODUCED_IN(24); #if defined(__BIONIC_FORTIFY) && !defined(__BIONIC_NO_STDIO_FORTIFY) @@ -59,7 +57,7 @@ int vsprintf(char *const __pass_object_size dest, const char *_Nonnull format, * its length to the length of `dest` */ __BIONIC_ERROR_FUNCTION_VISIBILITY -int snprintf(char *__restrict dest, size_t size, const char *__restrict format) +int snprintf(char* dest, size_t size, const char* format) __overloadable __enable_if(__bos(dest) != __BIONIC_FORTIFY_UNKNOWN_SIZE && __bos(dest) < __builtin_strlen(format), @@ -68,8 +66,8 @@ int snprintf(char *__restrict dest, size_t size, const char *__restrict format) __BIONIC_FORTIFY_INLINE __printflike(3, 4) -int snprintf(char *__restrict const __pass_object_size dest, - size_t size, const char *__restrict format, ...) __overloadable { +int snprintf(char* const __pass_object_size dest, + size_t size, const char* format, ...) __overloadable { va_list va; va_start(va, format); int result = __builtin___vsnprintf_chk(dest, size, 0, __bos(dest), format, va); @@ -78,7 +76,7 @@ int snprintf(char *__restrict const __pass_object_size dest, } __BIONIC_ERROR_FUNCTION_VISIBILITY -int sprintf(char *__restrict dest, const char *__restrict format) __overloadable +int sprintf(char* dest, const char* format) __overloadable __enable_if(__bos(dest) != __BIONIC_FORTIFY_UNKNOWN_SIZE && __bos(dest) < __builtin_strlen(format), "format string will always overflow destination buffer") @@ -86,8 +84,7 @@ int sprintf(char *__restrict dest, const char *__restrict format) __overloadable __BIONIC_FORTIFY_INLINE __printflike(2, 3) -int sprintf(char *__restrict const __pass_object_size dest, - const char *__restrict format, ...) __overloadable { +int sprintf(char* const __pass_object_size dest, const char* format, ...) __overloadable { va_list va; va_start(va, format); int result = __builtin___vsprintf_chk(dest, 0, __bos(dest), format, va); @@ -98,22 +95,21 @@ int sprintf(char *__restrict const __pass_object_size dest, #if __ANDROID_API__ >= __ANDROID_API_N__ __BIONIC_FORTIFY_INLINE -size_t fread(void *__restrict buf, size_t size, size_t count, - FILE *__restrict stream) __overloadable +size_t fread(void* buf, size_t size, size_t count, + FILE* stream) __overloadable __enable_if(__unsafe_check_mul_overflow(size, count), "size * count overflows") __errorattr("size * count overflows"); __BIONIC_FORTIFY_INLINE -size_t fread(void *__restrict buf, size_t size, size_t count, - FILE *__restrict stream) __overloadable +size_t fread(void* buf, size_t size, size_t count, FILE* stream) __overloadable __enable_if(!__unsafe_check_mul_overflow(size, count), "no overflow") __enable_if(__bos(buf) != __BIONIC_FORTIFY_UNKNOWN_SIZE && size * count > __bos(buf), "size * count is too large") __errorattr("size * count is too large"); __BIONIC_FORTIFY_INLINE -size_t fread(void *__restrict const __pass_object_size0 buf, size_t size, - size_t count, FILE *__restrict stream) __overloadable { +size_t fread(void* const __pass_object_size0 buf, size_t size, + size_t count, FILE* stream) __overloadable { size_t bos = __bos0(buf); if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) { @@ -123,22 +119,19 @@ size_t fread(void *__restrict const __pass_object_size0 buf, size_t size, return __fread_chk(buf, size, count, stream, bos); } -size_t fwrite(const void * __restrict buf, size_t size, - size_t count, FILE * __restrict stream) __overloadable +size_t fwrite(const void* buf, size_t size, size_t count, FILE* stream) __overloadable __enable_if(__unsafe_check_mul_overflow(size, count), "size * count overflows") __errorattr("size * count overflows"); -size_t fwrite(const void * __restrict buf, size_t size, - size_t count, FILE * __restrict stream) __overloadable +size_t fwrite(const void* buf, size_t size, size_t count, FILE* stream) __overloadable __enable_if(!__unsafe_check_mul_overflow(size, count), "no overflow") __enable_if(__bos(buf) != __BIONIC_FORTIFY_UNKNOWN_SIZE && size * count > __bos(buf), "size * count is too large") __errorattr("size * count is too large"); __BIONIC_FORTIFY_INLINE -size_t fwrite(const void * __restrict const __pass_object_size0 buf, - size_t size, size_t count, FILE * __restrict stream) +size_t fwrite(const void* const __pass_object_size0 buf, size_t size, size_t count, FILE* stream) __overloadable { size_t bos = __bos0(buf); @@ -152,7 +145,7 @@ size_t fwrite(const void * __restrict const __pass_object_size0 buf, #if __ANDROID_API__ >= __ANDROID_API_J_MR1__ __BIONIC_ERROR_FUNCTION_VISIBILITY -char *fgets(char* __restrict dest, int size, FILE* stream) __overloadable +char *fgets(char* dest, int size, FILE* stream) __overloadable __enable_if(size < 0, "size is negative") __errorattr("size is negative"); @@ -163,8 +156,7 @@ char *fgets(char* dest, int size, FILE* stream) __overloadable __errorattr("size is larger than the destination buffer"); __BIONIC_FORTIFY_INLINE -char *fgets(char* __restrict const __pass_object_size dest, - int size, FILE* stream) __overloadable { +char *fgets(char* const __pass_object_size dest, int size, FILE* stream) __overloadable { size_t bos = __bos(dest); if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) { @@ -177,7 +169,7 @@ char *fgets(char* __restrict const __pass_object_size dest, #else /* defined(__clang__) */ -size_t __fread_real(void * __restrict, size_t, size_t, FILE * __restrict) __RENAME(fread); +size_t __fread_real(void*, size_t, size_t, FILE*) __RENAME(fread); __errordecl(__fread_too_big_error, "fread called with size * count bigger than buffer"); __errordecl(__fread_overflow, "fread called with overflowing size * count"); @@ -185,21 +177,20 @@ char* __fgets_real(char*, int, FILE*) __RENAME(fgets); __errordecl(__fgets_too_big_error, "fgets called with size bigger than buffer"); __errordecl(__fgets_too_small_error, "fgets called with size less than zero"); -size_t __fwrite_real(const void * __restrict, size_t, size_t, FILE * __restrict) __RENAME(fwrite); +size_t __fwrite_real(const void*, size_t, size_t, FILE*) __RENAME(fwrite); __errordecl(__fwrite_too_big_error, "fwrite called with size * count bigger than buffer"); __errordecl(__fwrite_overflow, "fwrite called with overflowing size * count"); #if __ANDROID_API__ >= __ANDROID_API_J_MR1__ __BIONIC_FORTIFY_INLINE __printflike(3, 4) -int snprintf(char *__restrict dest, size_t size, const char* _Nonnull format, ...) -{ +int snprintf(char* dest, size_t size, const char* _Nonnull format, ...) { return __builtin___snprintf_chk(dest, size, 0, __bos(dest), format, __builtin_va_arg_pack()); } __BIONIC_FORTIFY_INLINE __printflike(2, 3) -int sprintf(char *__restrict dest, const char* _Nonnull format, ...) { +int sprintf(char* dest, const char* _Nonnull format, ...) { return __builtin___sprintf_chk(dest, 0, __bos(dest), format, __builtin_va_arg_pack()); } @@ -207,7 +198,7 @@ int sprintf(char *__restrict dest, const char* _Nonnull format, ...) { #if __ANDROID_API__ >= __ANDROID_API_N__ __BIONIC_FORTIFY_INLINE -size_t fread(void *__restrict buf, size_t size, size_t count, FILE * __restrict stream) { +size_t fread(void* buf, size_t size, size_t count, FILE* stream) { size_t bos = __bos0(buf); if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) { @@ -231,7 +222,7 @@ size_t fread(void *__restrict buf, size_t size, size_t count, FILE * __restrict } __BIONIC_FORTIFY_INLINE -size_t fwrite(const void * __restrict buf, size_t size, size_t count, FILE * __restrict stream) { +size_t fwrite(const void* buf, size_t size, size_t count, FILE* stream) { size_t bos = __bos0(buf); if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) { diff --git a/libc/include/bits/fortify/string.h b/libc/include/bits/fortify/string.h index 74e87a42a..2fe48d4a5 100644 --- a/libc/include/bits/fortify/string.h +++ b/libc/include/bits/fortify/string.h @@ -32,12 +32,12 @@ void* __memchr_chk(const void* _Nonnull, int, size_t, size_t) __INTRODUCED_IN(23); void* __memrchr_chk(const void* _Nonnull, int, size_t, size_t) __INTRODUCED_IN(23); -char* __stpncpy_chk2(char* _Nonnull __restrict, const char* _Nonnull __restrict, size_t, size_t, size_t) +char* __stpncpy_chk2(char* _Nonnull, const char* _Nonnull, size_t, size_t, size_t) __INTRODUCED_IN(21); -char* __strncpy_chk2(char* _Nonnull __restrict, const char* _Nonnull __restrict, size_t, size_t, size_t) +char* __strncpy_chk2(char* _Nonnull, const char* _Nonnull, size_t, size_t, size_t) __INTRODUCED_IN(21); -size_t __strlcpy_chk(char* _Nonnull __restrict, const char* _Nonnull __restrict, size_t, size_t) __INTRODUCED_IN(17); -size_t __strlcat_chk(char* _Nonnull __restrict, const char* _Nonnull __restrict, size_t, size_t) __INTRODUCED_IN(17); +size_t __strlcpy_chk(char* _Nonnull, const char* _Nonnull, size_t, size_t) __INTRODUCED_IN(17); +size_t __strlcat_chk(char* _Nonnull, const char* _Nonnull, size_t, size_t) __INTRODUCED_IN(17); /* Only used with FORTIFY, but some headers that need it undef FORTIFY, so we * have the definition out here. @@ -49,7 +49,7 @@ struct __bionic_zero_size_is_okay_t {}; // trickery... #if __ANDROID_API__ >= __ANDROID_API_J_MR1__ __BIONIC_FORTIFY_INLINE -void* memcpy(void* _Nonnull __restrict const dst __pass_object_size0, const void* _Nonnull __restrict src, size_t copy_amount) +void* memcpy(void* _Nonnull const dst __pass_object_size0, const void* _Nonnull src, size_t copy_amount) __overloadable { return __builtin___memcpy_chk(dst, src, copy_amount, __bos0(dst)); } @@ -63,7 +63,7 @@ void* memmove(void* const _Nonnull dst __pass_object_size0, const void* _Nonnull #if __ANDROID_API__ >= __ANDROID_API_L__ __BIONIC_FORTIFY_INLINE -char* stpcpy(char* _Nonnull __restrict const dst __pass_object_size, const char* _Nonnull __restrict src) +char* stpcpy(char* _Nonnull const dst __pass_object_size, const char* _Nonnull src) __overloadable { return __builtin___stpcpy_chk(dst, src, __bos(dst)); } @@ -71,19 +71,19 @@ char* stpcpy(char* _Nonnull __restrict const dst __pass_object_size, const char* #if __ANDROID_API__ >= __ANDROID_API_J_MR1__ __BIONIC_FORTIFY_INLINE -char* strcpy(char* _Nonnull __restrict const dst __pass_object_size, const char* _Nonnull __restrict src) +char* strcpy(char* _Nonnull const dst __pass_object_size, const char* _Nonnull src) __overloadable { return __builtin___strcpy_chk(dst, src, __bos(dst)); } __BIONIC_FORTIFY_INLINE -char* strcat(char* _Nonnull __restrict const dst __pass_object_size, const char* _Nonnull __restrict src) +char* strcat(char* _Nonnull const dst __pass_object_size, const char* _Nonnull src) __overloadable { return __builtin___strcat_chk(dst, src, __bos(dst)); } __BIONIC_FORTIFY_INLINE -char* strncat(char* const _Nonnull __restrict dst __pass_object_size, const char* _Nonnull __restrict src, size_t n) +char* strncat(char* const _Nonnull dst __pass_object_size, const char* _Nonnull src, size_t n) __overloadable { return __builtin___strncat_chk(dst, src, n, __bos(dst)); } @@ -154,7 +154,7 @@ void* memrchr(const void* const _Nonnull s __pass_object_size, int c, size_t n) #if __ANDROID_API__ >= __ANDROID_API_L__ __BIONIC_FORTIFY_INLINE -char* stpncpy(char* __restrict const _Nonnull dst __pass_object_size, const char* __restrict const _Nonnull src __pass_object_size, size_t n) +char* stpncpy(char* const _Nonnull dst __pass_object_size, const char* const _Nonnull src __pass_object_size, size_t n) __overloadable { size_t bos_dst = __bos(dst); size_t bos_src = __bos(src); @@ -168,7 +168,7 @@ char* stpncpy(char* __restrict const _Nonnull dst __pass_object_size, const char } __BIONIC_FORTIFY_INLINE -char* strncpy(char* __restrict const _Nonnull dst __pass_object_size, const char* __restrict const _Nonnull src __pass_object_size, size_t n) +char* strncpy(char* const _Nonnull dst __pass_object_size, const char* const _Nonnull src __pass_object_size, size_t n) __overloadable { size_t bos_dst = __bos(dst); size_t bos_src = __bos(src); @@ -184,7 +184,7 @@ char* strncpy(char* __restrict const _Nonnull dst __pass_object_size, const char #if __ANDROID_API__ >= __ANDROID_API_J_MR1__ __BIONIC_FORTIFY_INLINE -size_t strlcpy(char* const _Nonnull __restrict dst __pass_object_size, const char *_Nonnull __restrict src, size_t size) +size_t strlcpy(char* const _Nonnull dst __pass_object_size, const char *_Nonnull src, size_t size) __overloadable { size_t bos = __bos(dst); @@ -196,7 +196,7 @@ size_t strlcpy(char* const _Nonnull __restrict dst __pass_object_size, const cha } __BIONIC_FORTIFY_INLINE -size_t strlcat(char* const _Nonnull __restrict dst __pass_object_size, const char* _Nonnull __restrict src, size_t size) +size_t strlcat(char* const _Nonnull dst __pass_object_size, const char* _Nonnull src, size_t size) __overloadable { size_t bos = __bos(dst); @@ -293,11 +293,11 @@ void* memset(void* _Nonnull s, int c, size_t n) __overloadable #undef __error_zero_size #undef __error_if_overflows_dst #else // defined(__clang__) -extern char* __strncpy_real(char* __restrict, const char*, size_t) __RENAME(strncpy); +extern char* __strncpy_real(char*, const char*, size_t) __RENAME(strncpy); extern void* __memrchr_real(const void*, int, size_t) __RENAME(memrchr); -extern size_t __strlcpy_real(char* __restrict, const char* __restrict, size_t) +extern size_t __strlcpy_real(char*, const char*, size_t) __RENAME(strlcpy); -extern size_t __strlcat_real(char* __restrict, const char* __restrict, size_t) +extern size_t __strlcat_real(char*, const char*, size_t) __RENAME(strlcat); __errordecl(__memchr_buf_size_error, "memchr called with size bigger than buffer"); @@ -345,7 +345,7 @@ void* memrchr(const void* s, int c, size_t n) { #if __ANDROID_API__ >= __ANDROID_API_L__ __BIONIC_FORTIFY_INLINE -char* stpncpy(char* _Nonnull __restrict dst, const char* _Nonnull __restrict src, size_t n) { +char* stpncpy(char* _Nonnull dst, const char* _Nonnull src, size_t n) { size_t bos_dst = __bos(dst); size_t bos_src = __bos(src); @@ -366,7 +366,7 @@ char* stpncpy(char* _Nonnull __restrict dst, const char* _Nonnull __restrict src } __BIONIC_FORTIFY_INLINE -char* strncpy(char* _Nonnull __restrict dst, const char* _Nonnull __restrict src, size_t n) { +char* strncpy(char* _Nonnull dst, const char* _Nonnull src, size_t n) { size_t bos_dst = __bos(dst); size_t bos_src = __bos(src); @@ -389,7 +389,7 @@ char* strncpy(char* _Nonnull __restrict dst, const char* _Nonnull __restrict src #if __ANDROID_API__ >= __ANDROID_API_J_MR1__ __BIONIC_FORTIFY_INLINE -size_t strlcpy(char* _Nonnull __restrict dst __pass_object_size, const char* _Nonnull __restrict src, size_t size) { +size_t strlcpy(char* _Nonnull dst __pass_object_size, const char* _Nonnull src, size_t size) { size_t bos = __bos(dst); // Compiler doesn't know destination size. Don't call __strlcpy_chk @@ -407,7 +407,7 @@ size_t strlcpy(char* _Nonnull __restrict dst __pass_object_size, const char* _No } __BIONIC_FORTIFY_INLINE -size_t strlcat(char* _Nonnull __restrict dst, const char* _Nonnull __restrict src, size_t size) { +size_t strlcat(char* _Nonnull dst, const char* _Nonnull src, size_t size) { size_t bos = __bos(dst); // Compiler doesn't know destination size. Don't call __strlcat_chk diff --git a/libc/include/inttypes.h b/libc/include/inttypes.h index f74afa38f..43474df18 100644 --- a/libc/include/inttypes.h +++ b/libc/include/inttypes.h @@ -257,10 +257,10 @@ typedef struct { __BEGIN_DECLS intmax_t imaxabs(intmax_t) __attribute_const__ __INTRODUCED_IN(19); imaxdiv_t imaxdiv(intmax_t, intmax_t) __attribute_const__ __INTRODUCED_IN(19); -intmax_t strtoimax(const char *, char **, int); -uintmax_t strtoumax(const char *, char **, int); -intmax_t wcstoimax(const wchar_t* __restrict, wchar_t** __restrict, int) __INTRODUCED_IN(21); -uintmax_t wcstoumax(const wchar_t* __restrict, wchar_t** __restrict, int) __INTRODUCED_IN(21); +intmax_t strtoimax(const char*, char**, int); +uintmax_t strtoumax(const char*, char**, int); +intmax_t wcstoimax(const wchar_t*, wchar_t**, int) __INTRODUCED_IN(21); +uintmax_t wcstoumax(const wchar_t*, wchar_t**, int) __INTRODUCED_IN(21); __END_DECLS #endif /* _INTTYPES_H_ */ diff --git a/libc/include/search.h b/libc/include/search.h index dc160e932..46998d913 100644 --- a/libc/include/search.h +++ b/libc/include/search.h @@ -37,7 +37,7 @@ void* lfind(const void*, const void*, size_t*, size_t, int (*)(const void*, cons void* lsearch(const void*, void*, size_t*, size_t, int (*)(const void*, const void*)) __INTRODUCED_IN(21); -void* tdelete(const void* __restrict, void** __restrict, int (*)(const void*, const void*)) +void* tdelete(const void*, void**, int (*)(const void*, const void*)) __INTRODUCED_IN(16); void tdestroy(void*, void (*)(void*)) __INTRODUCED_IN(16); void* tfind(const void*, void* const*, int (*)(const void*, const void*)) __INTRODUCED_IN(16); diff --git a/libc/include/stdio.h b/libc/include/stdio.h index 7f0d67e2c..2ac16861c 100644 --- a/libc/include/stdio.h +++ b/libc/include/stdio.h @@ -121,39 +121,39 @@ int feof(FILE *); int ferror(FILE *); int fflush(FILE *); int fgetc(FILE *); -char *fgets(char * __restrict, int, FILE * __restrict) __overloadable +char *fgets(char *, int, FILE *) __overloadable __RENAME_CLANG(fgets); -int fprintf(FILE * __restrict , const char * __restrict _Nonnull, ...) __printflike(2, 3); +int fprintf(FILE * , const char * _Nonnull, ...) __printflike(2, 3); int fputc(int, FILE *); -int fputs(const char * __restrict, FILE * __restrict); -size_t fread(void * __restrict, size_t, size_t, FILE * __restrict) +int fputs(const char *, FILE *); +size_t fread(void *, size_t, size_t, FILE *) __overloadable __RENAME_CLANG(fread); -int fscanf(FILE * __restrict, const char * __restrict _Nonnull, ...) __scanflike(2, 3); -size_t fwrite(const void * __restrict, size_t, size_t, FILE * __restrict) +int fscanf(FILE *, const char * _Nonnull, ...) __scanflike(2, 3); +size_t fwrite(const void *, size_t, size_t, FILE *) __overloadable __RENAME_CLANG(fwrite); int getc(FILE *); int getchar(void); -ssize_t getdelim(char** __restrict, size_t* __restrict, int, FILE* __restrict) __INTRODUCED_IN(18); -ssize_t getline(char** __restrict, size_t* __restrict, FILE* __restrict) __INTRODUCED_IN(18); +ssize_t getdelim(char**, size_t*, int, FILE*) __INTRODUCED_IN(18); +ssize_t getline(char**, size_t*, FILE*) __INTRODUCED_IN(18); void perror(const char *); -int printf(const char * __restrict _Nonnull, ...) __printflike(1, 2); +int printf(const char * _Nonnull, ...) __printflike(1, 2); int putc(int, FILE *); int putchar(int); int puts(const char *); int remove(const char *); void rewind(FILE *); -int scanf(const char * __restrict _Nonnull, ...) __scanflike(1, 2); -void setbuf(FILE * __restrict, char * __restrict); -int setvbuf(FILE * __restrict, char * __restrict, int, size_t); -int sscanf(const char * __restrict, const char * __restrict _Nonnull, ...) __scanflike(2, 3); +int scanf(const char * _Nonnull, ...) __scanflike(1, 2); +void setbuf(FILE *, char *); +int setvbuf(FILE *, char *, int, size_t); +int sscanf(const char *, const char * _Nonnull, ...) __scanflike(2, 3); int ungetc(int, FILE *); -int vfprintf(FILE * __restrict, const char * __restrict _Nonnull, __va_list) __printflike(2, 0); -int vprintf(const char * __restrict _Nonnull, __va_list) __printflike(1, 0); +int vfprintf(FILE *, const char * _Nonnull, __va_list) __printflike(2, 0); +int vprintf(const char * _Nonnull, __va_list) __printflike(1, 0); #if __ANDROID_API__ >= 21 -int dprintf(int, const char* __restrict _Nonnull, ...) __printflike(2, 3) __INTRODUCED_IN(21); -int vdprintf(int, const char* __restrict _Nonnull, __va_list) __printflike(2, 0) __INTRODUCED_IN(21); +int dprintf(int, const char* _Nonnull, ...) __printflike(2, 3) __INTRODUCED_IN(21); +int vdprintf(int, const char* _Nonnull, __va_list) __printflike(2, 0) __INTRODUCED_IN(21); #else /* * Old versions of Android called these fdprintf and vfdprintf out of fears that the glibc names @@ -162,18 +162,18 @@ int vdprintf(int, const char* __restrict _Nonnull, __va_list) __printflike(2, 0) * Allow users to just use dprintf and vfdprintf on any version by renaming those calls to their * legacy equivalents if needed. */ -int dprintf(int, const char* __restrict _Nonnull, ...) __printflike(2, 3) __RENAME(fdprintf); -int vdprintf(int, const char* __restrict _Nonnull, __va_list) __printflike(2, 0) __RENAME(vfdprintf); +int dprintf(int, const char* _Nonnull, ...) __printflike(2, 3) __RENAME(fdprintf); +int vdprintf(int, const char* _Nonnull, __va_list) __printflike(2, 0) __RENAME(vfdprintf); #endif #if (defined(__STDC_VERSION__) && __STDC_VERSION__ < 201112L) || \ (defined(__cplusplus) && __cplusplus <= 201103L) char* gets(char*) __attribute__((deprecated("gets is unsafe, use fgets instead"))); #endif -int sprintf(char* __restrict, const char* __restrict _Nonnull, ...) +int sprintf(char*, const char* _Nonnull, ...) __printflike(2, 3) __warnattr_strict("sprintf is often misused; please use snprintf") __overloadable __RENAME_CLANG(sprintf); -int vsprintf(char* __restrict, const char* __restrict _Nonnull, __va_list) +int vsprintf(char*, const char* _Nonnull, __va_list) __overloadable __printflike(2, 0) __RENAME_CLANG(vsprintf) __warnattr_strict("vsprintf is often misused; please use vsnprintf"); char* tmpnam(char*) @@ -222,21 +222,21 @@ FILE* funopen64(const void*, int (*)(void*, char*, int), int (*)(void*, const ch fpos64_t (*)(void*, fpos64_t, int), int (*)(void*)) __INTRODUCED_IN(24); #endif -FILE* fopen(const char* __restrict, const char* __restrict); -FILE* fopen64(const char* __restrict, const char* __restrict) __INTRODUCED_IN(24); -FILE* freopen(const char* __restrict, const char* __restrict, FILE* __restrict); -FILE* freopen64(const char* __restrict, const char* __restrict, FILE* __restrict) +FILE* fopen(const char*, const char*); +FILE* fopen64(const char*, const char*) __INTRODUCED_IN(24); +FILE* freopen(const char*, const char*, FILE*); +FILE* freopen64(const char*, const char*, FILE*) __INTRODUCED_IN(24); FILE* tmpfile(void); FILE* tmpfile64(void) __INTRODUCED_IN(24); -int snprintf(char* __restrict, size_t, const char* __restrict _Nonnull, ...) +int snprintf(char*, size_t, const char* _Nonnull, ...) __printflike(3, 4) __overloadable __RENAME_CLANG(snprintf); -int vfscanf(FILE* __restrict, const char* __restrict _Nonnull, __va_list) __scanflike(2, 0); +int vfscanf(FILE*, const char* _Nonnull, __va_list) __scanflike(2, 0); int vscanf(const char* _Nonnull , __va_list) __scanflike(1, 0); -int vsnprintf(char* __restrict, size_t, const char* __restrict _Nonnull, __va_list) +int vsnprintf(char*, size_t, const char* _Nonnull, __va_list) __printflike(3, 0) __overloadable __RENAME_CLANG(vsnprintf); -int vsscanf(const char* __restrict _Nonnull, const char* __restrict _Nonnull, __va_list) __scanflike(2, 0); +int vsscanf(const char* _Nonnull, const char* _Nonnull, __va_list) __scanflike(2, 0); #define L_ctermid 1024 /* size for ctermid() */ char* ctermid(char*) __INTRODUCED_IN(26); @@ -257,12 +257,12 @@ FILE* fmemopen(void*, size_t, const char*) __INTRODUCED_IN(23); FILE* open_memstream(char**, size_t*) __INTRODUCED_IN(23); #if defined(__USE_BSD) || defined(__BIONIC__) /* Historically bionic exposed these. */ -int asprintf(char** __restrict, const char* __restrict _Nonnull, ...) __printflike(2, 3); -char* fgetln(FILE* __restrict, size_t* __restrict); +int asprintf(char**, const char* _Nonnull, ...) __printflike(2, 3); +char* fgetln(FILE*, size_t*); int fpurge(FILE*); void setbuffer(FILE*, char*, int); int setlinebuf(FILE*); -int vasprintf(char** __restrict, const char* __restrict _Nonnull, __va_list) __printflike(2, 0); +int vasprintf(char**, const char* _Nonnull, __va_list) __printflike(2, 0); void clearerr_unlocked(FILE*) __INTRODUCED_IN(23); int feof_unlocked(FILE*) __INTRODUCED_IN(23); int ferror_unlocked(FILE*) __INTRODUCED_IN(23); diff --git a/libc/include/string.h b/libc/include/string.h index 81eaccf0f..8b4fa27ce 100644 --- a/libc/include/string.h +++ b/libc/include/string.h @@ -46,16 +46,16 @@ __BEGIN_DECLS #include <strings.h> #endif -void* memccpy(void* _Nonnull __restrict, const void* _Nonnull __restrict, int, size_t); +void* memccpy(void* _Nonnull, const void* _Nonnull, int, size_t); void* memchr(const void* _Nonnull, int, size_t) __attribute_pure__ __overloadable __RENAME_CLANG(memchr); void* memrchr(const void* _Nonnull, int, size_t) __attribute_pure__ __overloadable __RENAME_CLANG(memrchr); int memcmp(const void* _Nonnull, const void* _Nonnull, size_t) __attribute_pure__; -void* memcpy(void* _Nonnull __restrict, const void* _Nonnull __restrict, size_t) +void* memcpy(void* _Nonnull, const void* _Nonnull, size_t) __overloadable __RENAME_CLANG(memcpy); #if defined(__USE_GNU) -void* mempcpy(void* _Nonnull __restrict, const void* _Nonnull __restrict, size_t) __INTRODUCED_IN(23); +void* mempcpy(void* _Nonnull, const void* _Nonnull, size_t) __INTRODUCED_IN(23); #endif void* memmove(void* _Nonnull, const void* _Nonnull, size_t) __overloadable __RENAME_CLANG(memmove); @@ -83,18 +83,18 @@ size_t strlen(const char* _Nonnull) __attribute_pure__ __overloadable size_t __strlen_chk(const char* _Nonnull, size_t) __INTRODUCED_IN(17); int strcmp(const char* _Nonnull, const char* _Nonnull) __attribute_pure__; -char* stpcpy(char* _Nonnull __restrict, const char* _Nonnull __restrict) +char* stpcpy(char* _Nonnull, const char* _Nonnull) __overloadable __RENAME_CLANG(stpcpy) __INTRODUCED_IN(21); -char* strcpy(char* _Nonnull __restrict, const char* _Nonnull __restrict) +char* strcpy(char* _Nonnull, const char* _Nonnull) __overloadable __RENAME_CLANG(strcpy); -char* strcat(char* _Nonnull __restrict, const char* _Nonnull __restrict) +char* strcat(char* _Nonnull, const char* _Nonnull) __overloadable __RENAME_CLANG(strcat); char* strdup(const char* _Nonnull); char* strstr(const char* _Nonnull, const char* _Nonnull) __attribute_pure__; char* strcasestr(const char* _Nonnull, const char* _Nonnull) __attribute_pure__; -char* strtok(char* __restrict, const char* _Nonnull __restrict); -char* strtok_r(char* __restrict, const char* _Nonnull __restrict, char** _Nonnull __restrict); +char* strtok(char*, const char* _Nonnull); +char* strtok_r(char*, const char* _Nonnull, char** _Nonnull); char* strerror(int); char* strerror_l(int, locale_t) __INTRODUCED_IN(23); @@ -105,33 +105,33 @@ int strerror_r(int, char*, size_t); #endif size_t strnlen(const char* _Nonnull, size_t) __attribute_pure__; -char* strncat(char* _Nonnull __restrict, const char* _Nonnull __restrict, size_t) +char* strncat(char* _Nonnull, const char* _Nonnull, size_t) __overloadable __RENAME_CLANG(strncat); char* strndup(const char* _Nonnull, size_t); int strncmp(const char* _Nonnull, const char* _Nonnull, size_t) __attribute_pure__; -char* stpncpy(char* _Nonnull __restrict, const char* _Nonnull __restrict, size_t) +char* stpncpy(char* _Nonnull, const char* _Nonnull, size_t) __overloadable __RENAME_CLANG(stpncpy) __INTRODUCED_IN(21); -char* strncpy(char* _Nonnull __restrict, const char* _Nonnull __restrict, size_t) +char* strncpy(char* _Nonnull, const char* _Nonnull, size_t) __overloadable __RENAME_CLANG(strncpy); -size_t strlcat(char* _Nonnull __restrict, const char* _Nonnull __restrict, size_t) +size_t strlcat(char* _Nonnull, const char* _Nonnull, size_t) __overloadable __RENAME_CLANG(strlcat); -size_t strlcpy(char* _Nonnull __restrict, const char* _Nonnull __restrict, size_t) +size_t strlcpy(char* _Nonnull, const char* _Nonnull, size_t) __overloadable __RENAME_CLANG(strlcpy); size_t strcspn(const char* _Nonnull, const char* _Nonnull) __attribute_pure__; char* strpbrk(const char* _Nonnull, const char* _Nonnull) __attribute_pure__; -char* strsep(char** _Nonnull __restrict, const char* _Nonnull __restrict); +char* strsep(char** _Nonnull, const char* _Nonnull); size_t strspn(const char* _Nonnull, const char* _Nonnull); char* strsignal(int); int strcoll(const char* _Nonnull, const char* _Nonnull) __attribute_pure__; -size_t strxfrm(char* __restrict, const char* _Nonnull __restrict, size_t); +size_t strxfrm(char*, const char* _Nonnull, size_t); #if __ANDROID_API__ >= __ANDROID_API_L__ int strcoll_l(const char* _Nonnull, const char* _Nonnull, locale_t) __attribute_pure__ __INTRODUCED_IN(21); -size_t strxfrm_l(char* __restrict, const char* _Nonnull __restrict, size_t, locale_t) __INTRODUCED_IN(21); +size_t strxfrm_l(char*, const char* _Nonnull, size_t, locale_t) __INTRODUCED_IN(21); #else // Implemented as static inlines before 21. #endif diff --git a/libc/include/sys/statvfs.h b/libc/include/sys/statvfs.h index af1b9c030..5df416072 100644 --- a/libc/include/sys/statvfs.h +++ b/libc/include/sys/statvfs.h @@ -59,10 +59,8 @@ struct statvfs64 { __STATVFS64_BODY }; #define ST_NODIRATIME 0x0800 #define ST_RELATIME 0x1000 -int statvfs(const char* __restrict _Nonnull, struct statvfs* __restrict _Nonnull) - __INTRODUCED_IN(19); -int statvfs64(const char* __restrict _Nonnull, struct statvfs64* __restrict _Nonnull) - __INTRODUCED_IN(21); +int statvfs(const char* _Nonnull, struct statvfs* _Nonnull) __INTRODUCED_IN(19); +int statvfs64(const char* _Nonnull, struct statvfs64* _Nonnull) __INTRODUCED_IN(21); int fstatvfs(int, struct statvfs* _Nonnull) __INTRODUCED_IN(19); int fstatvfs64(int, struct statvfs64* _Nonnull) __INTRODUCED_IN(21); diff --git a/libc/include/uchar.h b/libc/include/uchar.h index 818acb176..ac0cf1d4a 100644 --- a/libc/include/uchar.h +++ b/libc/include/uchar.h @@ -43,12 +43,10 @@ typedef __CHAR32_TYPE__ char32_t; #define __STD_UTF_16__ 1 #define __STD_UTF_32__ 1 -size_t c16rtomb(char* __restrict, char16_t, mbstate_t* __restrict) __INTRODUCED_IN(21); -size_t c32rtomb(char* __restrict, char32_t, mbstate_t* __restrict) __INTRODUCED_IN(21); -size_t mbrtoc16(char16_t* __restrict, const char* __restrict, size_t, mbstate_t* __restrict) - __INTRODUCED_IN(21); -size_t mbrtoc32(char32_t* __restrict, const char* __restrict, size_t, mbstate_t* __restrict) - __INTRODUCED_IN(21); +size_t c16rtomb(char*, char16_t, mbstate_t*) __INTRODUCED_IN(21); +size_t c32rtomb(char*, char32_t, mbstate_t*) __INTRODUCED_IN(21); +size_t mbrtoc16(char16_t*, const char*, size_t, mbstate_t*) __INTRODUCED_IN(21); +size_t mbrtoc32(char32_t*, const char*, size_t, mbstate_t*) __INTRODUCED_IN(21); __END_DECLS diff --git a/libc/stdio/local.h b/libc/stdio/local.h index afb02ca6e..16971161a 100644 --- a/libc/stdio/local.h +++ b/libc/stdio/local.h @@ -202,9 +202,9 @@ int __swhatbuf(FILE *, size_t *, int *); wint_t __fgetwc_unlock(FILE *); wint_t __ungetwc(wint_t, FILE *); int __vfprintf(FILE *, const char *, __va_list); -int __svfscanf(FILE * __restrict, const char * __restrict, __va_list); -int __vfwprintf(FILE * __restrict, const wchar_t * __restrict, __va_list); -int __vfwscanf(FILE * __restrict, const wchar_t * __restrict, __va_list); +int __svfscanf(FILE *, const char *, __va_list); +int __vfwprintf(FILE *, const wchar_t *, __va_list); +int __vfwscanf(FILE *, const wchar_t *, __va_list); /* * Return true if the given FILE cannot be written now. |