From 19710f761b4134d653936fde88f3c4477ab2128e Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Wed, 5 Apr 2017 13:24:05 -0700 Subject: [PATCH] libc: remove newlines in prototypes in string.h This gives more useful diagnostics if clang needs to mention these functions (or a parameter of them). Bug: 36984245 Test: m on bullhead completes successfully. Change-Id: I17c2b624d08bc9dd3f08185b30029ed0c49ebb08 --- libc/include/string.h | 54 +++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 30 deletions(-) diff --git a/libc/include/string.h b/libc/include/string.h index 0cbd61c3f..daa04171f 100644 --- a/libc/include/string.h +++ b/libc/include/string.h @@ -168,48 +168,47 @@ 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) __overloadable { +void* memcpy(void* _Nonnull __restrict const dst __pass_object_size0, const void* _Nonnull __restrict src, size_t copy_amount) + __overloadable { return __builtin___memcpy_chk(dst, src, copy_amount, __bos0(dst)); } __BIONIC_FORTIFY_INLINE -void* memmove(void* const _Nonnull dst __pass_object_size0, - const void* _Nonnull src, size_t len) __overloadable { +void* memmove(void* const _Nonnull dst __pass_object_size0, const void* _Nonnull src, size_t len) + __overloadable { return __builtin___memmove_chk(dst, src, len, __bos0(dst)); } #endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */ #if __ANDROID_API__ >= __ANDROID_API_L__ __BIONIC_FORTIFY_INLINE -char* stpcpy(char* _Nonnull __restrict const dst __pass_object_size, - const char* _Nonnull __restrict src) __overloadable { +char* stpcpy(char* _Nonnull __restrict const dst __pass_object_size, const char* _Nonnull __restrict src) + __overloadable { return __builtin___stpcpy_chk(dst, src, __bos(dst)); } #endif /* __ANDROID_API__ >= __ANDROID_API_L__ */ #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) __overloadable { +char* strcpy(char* _Nonnull __restrict const dst __pass_object_size, const char* _Nonnull __restrict 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) __overloadable { +char* strcat(char* _Nonnull __restrict const dst __pass_object_size, const char* _Nonnull __restrict 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) __overloadable { +char* strncat(char* const _Nonnull __restrict dst __pass_object_size, const char* _Nonnull __restrict src, size_t n) + __overloadable { return __builtin___strncat_chk(dst, src, n, __bos(dst)); } __BIONIC_FORTIFY_INLINE -void* memset(void* const _Nonnull s __pass_object_size0, int c, size_t n) - __overloadable { +void* memset(void* const _Nonnull s __pass_object_size0, int c, size_t n) __overloadable { return __builtin___memset_chk(s, c, n, __bos0(s)); } #endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */ @@ -274,9 +273,8 @@ 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) __overloadable { +char* stpncpy(char* __restrict const _Nonnull dst __pass_object_size, const char* __restrict const _Nonnull src __pass_object_size, size_t n) + __overloadable { size_t bos_dst = __bos(dst); size_t bos_src = __bos(src); @@ -289,9 +287,8 @@ char* stpncpy(char* __restrict const _Nonnull dst __pass_object_size, } __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) __overloadable { +char* strncpy(char* __restrict const _Nonnull dst __pass_object_size, const char* __restrict const _Nonnull src __pass_object_size, size_t n) + __overloadable { size_t bos_dst = __bos(dst); size_t bos_src = __bos(src); @@ -306,8 +303,8 @@ char* strncpy(char* __restrict const _Nonnull dst __pass_object_size, #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) __overloadable { +size_t strlcpy(char* const _Nonnull __restrict dst __pass_object_size, const char *_Nonnull __restrict src, size_t size) + __overloadable { size_t bos = __bos(dst); if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) { @@ -318,8 +315,8 @@ size_t strlcpy(char* const _Nonnull __restrict dst __pass_object_size, } __BIONIC_FORTIFY_INLINE -size_t strlcat(char* const _Nonnull __restrict dst __pass_object_size, - const char* _Nonnull __restrict src, size_t size) __overloadable { +size_t strlcat(char* const _Nonnull __restrict dst __pass_object_size, const char* _Nonnull __restrict src, size_t size) + __overloadable { size_t bos = __bos(dst); if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) { @@ -390,14 +387,12 @@ char* strrchr(const char* const _Nonnull s __pass_object_size, int c) * but we should also provide a FORTIFY'ed escape hatch. */ __BIONIC_ERROR_FUNCTION_VISIBILITY -void* memset(void* _Nonnull s, int c, size_t n, - struct __bionic_zero_size_is_okay_t ok) +void* memset(void* _Nonnull s, int c, size_t n, struct __bionic_zero_size_is_okay_t ok) __overloadable __error_if_overflows_dst(memset, s, n, "size"); __BIONIC_FORTIFY_INLINE -void* memset(void* const _Nonnull s __pass_object_size0, int c, size_t n, - struct __bionic_zero_size_is_okay_t ok __attribute__((unused))) +void* memset(void* const _Nonnull s __pass_object_size0, int c, size_t n, struct __bionic_zero_size_is_okay_t ok __attribute__((unused))) __overloadable { return __builtin___memset_chk(s, c, n, __bos0(s)); } @@ -514,8 +509,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 __restrict dst __pass_object_size, const char* _Nonnull __restrict src, size_t size) { size_t bos = __bos(dst); // Compiler doesn't know destination size. Don't call __strlcpy_chk