Remove __overloadable/__RENAME_CLANG
Now that we have a clang that supports transparent overloads, we can
kill all of this cruft, and restore our upstream sources to their
untouched glory. Woohoo!
Bug: 12231437
Test: Built aosp_marlin; no obvious patch-related aosp_mips issues.
Change-Id: I520a19d014f12137f80e43f973dccd6711c571cd
diff --git a/libc/include/fcntl.h b/libc/include/fcntl.h
index 4852f5f..1c5d64c 100644
--- a/libc/include/fcntl.h
+++ b/libc/include/fcntl.h
@@ -71,9 +71,9 @@
int creat(const char* __path, mode_t __mode);
int creat64(const char* __path, mode_t __mode) __INTRODUCED_IN(21);
-int openat(int __dir_fd, const char* __path, int __flags, ...) __overloadable __RENAME_CLANG(openat);
+int openat(int __dir_fd, const char* __path, int __flags, ...);
int openat64(int __dir_fd, const char* __path, int __flags, ...) __INTRODUCED_IN(21);
-int open(const char* __path, int __flags, ...) __overloadable __RENAME_CLANG(open);
+int open(const char* __path, int __flags, ...);
int open64(const char* __path, int __flags, ...) __INTRODUCED_IN(21);
ssize_t splice(int __in_fd, off64_t* __in_offset, int __out_fd, off64_t* __out_offset, size_t __length, unsigned int __flags) __INTRODUCED_IN(21);
ssize_t tee(int __in_fd, int __out_fd, size_t __length, unsigned int __flags) __INTRODUCED_IN(21);
diff --git a/libc/include/poll.h b/libc/include/poll.h
index 9ca1cf8..6a8f757 100644
--- a/libc/include/poll.h
+++ b/libc/include/poll.h
@@ -38,8 +38,8 @@
typedef unsigned int nfds_t;
-int poll(struct pollfd* __fds, nfds_t __count, int __timeout_ms) __overloadable __RENAME_CLANG(poll);
-int ppoll(struct pollfd* __fds, nfds_t __count, const struct timespec* __timeout, const sigset_t* __mask) __overloadable __RENAME_CLANG(ppoll) __INTRODUCED_IN(21);
+int poll(struct pollfd* __fds, nfds_t __count, int __timeout_ms);
+int ppoll(struct pollfd* __fds, nfds_t __count, const struct timespec* __timeout, const sigset_t* __mask) __INTRODUCED_IN(21);
int ppoll64(struct pollfd* __fds, nfds_t __count, const struct timespec* __timeout, const sigset64_t* __mask) __INTRODUCED_IN(28);
#if defined(__BIONIC_INCLUDE_FORTIFY_HEADERS)
diff --git a/libc/include/stdio.h b/libc/include/stdio.h
index 2d9cc31..8bd690f 100644
--- a/libc/include/stdio.h
+++ b/libc/include/stdio.h
@@ -109,13 +109,13 @@
int ferror(FILE* __fp);
int fflush(FILE* __fp);
int fgetc(FILE* __fp);
-char* fgets(char* __buf, int __size, FILE* __fp) __overloadable __RENAME_CLANG(fgets);
+char* fgets(char* __buf, int __size, FILE* __fp);
int fprintf(FILE* __fp , const char* __fmt, ...) __printflike(2, 3);
int fputc(int __ch, FILE* __fp);
int fputs(const char* __s, FILE* __fp);
-size_t fread(void* __buf, size_t __size, size_t __count, FILE* __fp) __overloadable __RENAME_CLANG(fread);
+size_t fread(void* __buf, size_t __size, size_t __count, FILE* __fp);
int fscanf(FILE* __fp, const char* __fmt, ...) __scanflike(2, 3);
-size_t fwrite(const void* __buf, size_t __size, size_t __count, FILE* __fp) __overloadable __RENAME_CLANG(fwrite);
+size_t fwrite(const void* __buf, size_t __size, size_t __count, FILE* __fp);
int getc(FILE* __fp);
int getchar(void);
ssize_t getdelim(char** __line_ptr, size_t* __line_length_ptr, int __delimiter, FILE* __fp) __INTRODUCED_IN(18);
@@ -156,11 +156,9 @@
char* gets(char* __buf) __attribute__((deprecated("gets is unsafe, use fgets instead")));
#endif
int sprintf(char* __s, const char* __fmt, ...)
- __printflike(2, 3) __warnattr_strict("sprintf is often misused; please use snprintf")
- __overloadable __RENAME_CLANG(sprintf);
+ __printflike(2, 3) __warnattr_strict("sprintf is often misused; please use snprintf");
int vsprintf(char* __s, const char* __fmt, va_list __args)
- __overloadable __printflike(2, 0) __RENAME_CLANG(vsprintf)
- __warnattr_strict("vsprintf is often misused; please use vsnprintf");
+ __printflike(2, 0) __warnattr_strict("vsprintf is often misused; please use vsnprintf");
char* tmpnam(char* __s)
__warnattr("tempnam is unsafe, use mkstemp or tmpfile instead");
#define P_tmpdir "/tmp/" /* deprecated */
@@ -218,12 +216,10 @@
FILE* tmpfile(void);
FILE* tmpfile64(void) __INTRODUCED_IN(24);
-int snprintf(char* __buf, size_t __size, const char* __fmt, ...)
- __printflike(3, 4) __overloadable __RENAME_CLANG(snprintf);
+int snprintf(char* __buf, size_t __size, const char* __fmt, ...) __printflike(3, 4);
int vfscanf(FILE* __fp, const char* __fmt, va_list __args) __scanflike(2, 0);
int vscanf(const char* __fmt , va_list __args) __scanflike(1, 0);
-int vsnprintf(char* __buf, size_t __size, const char* __fmt, va_list __args)
- __printflike(3, 0) __overloadable __RENAME_CLANG(vsnprintf);
+int vsnprintf(char* __buf, size_t __size, const char* __fmt, va_list __args) __printflike(3, 0);
int vsscanf(const char* __s, const char* __fmt, va_list __args) __scanflike(2, 0);
#define L_ctermid 1024 /* size for ctermid() */
diff --git a/libc/include/string.h b/libc/include/string.h
index 226566c..54d5e1c 100644
--- a/libc/include/string.h
+++ b/libc/include/string.h
@@ -42,24 +42,23 @@
#endif
void* memccpy(void* __dst, const void* __src, int __stop_char, size_t __n);
-void* memchr(const void* __s, int __ch, size_t __n) __attribute_pure__ __overloadable __RENAME_CLANG(memchr);
+void* memchr(const void* __s, int __ch, size_t __n) __attribute_pure__;
#if defined(__cplusplus)
extern "C++" void* memrchr(void* __s, int __ch, size_t __n) __RENAME(memrchr) __attribute_pure__;
extern "C++" const void* memrchr(const void* __s, int __ch, size_t __n) __RENAME(memrchr) __attribute_pure__;
#else
-void* memrchr(const void* __s, int __ch, size_t __n) __attribute_pure__ __overloadable __RENAME_CLANG(memrchr);
+void* memrchr(const void* __s, int __ch, size_t __n) __attribute_pure__;
#endif
int memcmp(const void* __lhs, const void* __rhs, size_t __n) __attribute_pure__;
-void* memcpy(void*, const void*, size_t)
- __overloadable __RENAME_CLANG(memcpy);
+void* memcpy(void*, const void*, size_t);
#if defined(__USE_GNU)
void* mempcpy(void* __dst, const void* __src, size_t __n) __INTRODUCED_IN(23);
#endif
-void* memmove(void* __dst, const void* __src, size_t __n) __overloadable __RENAME_CLANG(memmove);
-void* memset(void* __dst, int __ch, size_t __n) __overloadable __RENAME_CLANG(memset);
+void* memmove(void* __dst, const void* __src, size_t __n);
+void* memset(void* __dst, int __ch, size_t __n);
void* memmem(const void* __haystack, size_t __haystack_size, const void* __needle, size_t __needle_size) __attribute_pure__;
-char* strchr(const char* __s, int __ch) __attribute_pure__ __overloadable __RENAME_CLANG(strchr);
+char* strchr(const char* __s, int __ch) __attribute_pure__;
char* __strchr_chk(const char* __s, int __ch, size_t __n) __INTRODUCED_IN(18);
#if defined(__USE_GNU)
#if defined(__cplusplus)
@@ -70,16 +69,16 @@
#endif
#endif
-char* strrchr(const char* __s, int __ch) __attribute_pure__ __overloadable __RENAME_CLANG(strrchr);
+char* strrchr(const char* __s, int __ch) __attribute_pure__;
char* __strrchr_chk(const char* __s, int __ch, size_t __n) __INTRODUCED_IN(18);
-size_t strlen(const char* __s) __attribute_pure__ __overloadable __RENAME_CLANG(strlen);
+size_t strlen(const char* __s) __attribute_pure__;
size_t __strlen_chk(const char* __s, size_t __n) __INTRODUCED_IN(17);
int strcmp(const char* __lhs, const char* __rhs) __attribute_pure__;
-char* stpcpy(char* __dst, const char* __src) __overloadable __RENAME_CLANG(stpcpy) __INTRODUCED_IN(21);
-char* strcpy(char* __dst, const char* __src) __overloadable __RENAME_CLANG(strcpy);
-char* strcat(char* __dst, const char* __src) __overloadable __RENAME_CLANG(strcat);
+char* stpcpy(char* __dst, const char* __src) __INTRODUCED_IN(21);
+char* strcpy(char* __dst, const char* __src);
+char* strcat(char* __dst, const char* __src);
char* strdup(const char* __s);
char* strstr(const char* __haystack, const char* __needle) __attribute_pure__;
@@ -101,14 +100,14 @@
#endif
size_t strnlen(const char* __s, size_t __n) __attribute_pure__;
-char* strncat(char* __dst, const char* __src, size_t __n) __overloadable __RENAME_CLANG(strncat);
+char* strncat(char* __dst, const char* __src, size_t __n);
char* strndup(const char* __s, size_t __n);
int strncmp(const char* __lhs, const char* __rhs, size_t __n) __attribute_pure__;
-char* stpncpy(char* __dst, const char* __src, size_t __n) __overloadable __RENAME_CLANG(stpncpy) __INTRODUCED_IN(21);
-char* strncpy(char* __dst, const char* __src, size_t __n) __overloadable __RENAME_CLANG(strncpy);
+char* stpncpy(char* __dst, const char* __src, size_t __n) __INTRODUCED_IN(21);
+char* strncpy(char* __dst, const char* __src, size_t __n);
-size_t strlcat(char* __dst, const char* __src, size_t __n) __overloadable __RENAME_CLANG(strlcat);
-size_t strlcpy(char* __dst, const char* __src, size_t __n) __overloadable __RENAME_CLANG(strlcpy);
+size_t strlcat(char* __dst, const char* __src, size_t __n);
+size_t strlcpy(char* __dst, const char* __src, size_t __n);
size_t strcspn(const char* __s, const char* __reject) __attribute_pure__;
char* strpbrk(const char* __s, const char* __accept) __attribute_pure__;
diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h
index be07007..27952b9 100644
--- a/libc/include/sys/cdefs.h
+++ b/libc/include/sys/cdefs.h
@@ -348,11 +348,8 @@
*/
#if defined(__clang__) && defined(__BIONIC_FORTIFY)
# define __overloadable __attribute__((overloadable))
-/* We don't use __RENAME directly because on gcc this could result in unnecessary renames. */
-# define __RENAME_CLANG(x) __RENAME(x)
#else
# define __overloadable
-# define __RENAME_CLANG(x)
#endif
/* Used to tag non-static symbols that are private and never exposed by the shared library. */
diff --git a/libc/include/sys/socket.h b/libc/include/sys/socket.h
index 152f39d..bbde88b 100644
--- a/libc/include/sys/socket.h
+++ b/libc/include/sys/socket.h
@@ -315,12 +315,11 @@
__socketcall int socket(int __af, int __type, int __protocol);
__socketcall int socketpair(int __af, int __type, int __protocol, int __fds[2]);
-ssize_t recv(int __fd, void* __buf, size_t __n, int __flags) __overloadable __RENAME_CLANG(recv);
-ssize_t send(int __fd, const void* __buf, size_t __n, int __flags) __overloadable __RENAME_CLANG(send);
+ssize_t recv(int __fd, void* __buf, size_t __n, int __flags);
+ssize_t send(int __fd, const void* __buf, size_t __n, int __flags);
-__socketcall ssize_t sendto(int __fd, const void* __buf, size_t __n, int __flags, const struct sockaddr* __dst_addr, socklen_t __dst_addr_length)
- __overloadable __RENAME_CLANG(sendto);
-__socketcall ssize_t recvfrom(int __fd, void* __buf, size_t __n, int __flags, struct sockaddr* __src_addr, socklen_t* __src_addr_length) __overloadable __RENAME_CLANG(recvfrom);
+__socketcall ssize_t sendto(int __fd, const void* __buf, size_t __n, int __flags, const struct sockaddr* __dst_addr, socklen_t __dst_addr_length);
+__socketcall ssize_t recvfrom(int __fd, void* __buf, size_t __n, int __flags, struct sockaddr* __src_addr, socklen_t* __src_addr_length);
#if defined(__BIONIC_INCLUDE_FORTIFY_HEADERS)
#include <bits/fortify/socket.h>
diff --git a/libc/include/sys/stat.h b/libc/include/sys/stat.h
index 14b5224..6fce0a5 100644
--- a/libc/include/sys/stat.h
+++ b/libc/include/sys/stat.h
@@ -165,7 +165,7 @@
int stat64(const char* __path, struct stat64* __buf) __INTRODUCED_IN(21);
int mknod(const char* __path, mode_t __mode, dev_t __dev);
-mode_t umask(mode_t __mask) __overloadable __RENAME_CLANG(umask);
+mode_t umask(mode_t __mask);
#if defined(__BIONIC_INCLUDE_FORTIFY_HEADERS)
#include <bits/fortify/stat.h>
diff --git a/libc/include/unistd.h b/libc/include/unistd.h
index f191028..e0f8b43 100644
--- a/libc/include/unistd.h
+++ b/libc/include/unistd.h
@@ -140,15 +140,14 @@
int chroot(const char* __path);
int symlink(const char* __old_path, const char* __new_path);
int symlinkat(const char* __old_path, int __new_dir_fd, const char* __new_path) __INTRODUCED_IN(21);
-ssize_t readlink(const char* __path, char* __buf, size_t __buf_size)
- __overloadable __RENAME_CLANG(readlink);
+ssize_t readlink(const char* __path, char* __buf, size_t __buf_size);
ssize_t readlinkat(int __dir_fd, const char* __path, char* __buf, size_t __buf_size)
- __INTRODUCED_IN(21) __overloadable __RENAME_CLANG(readlinkat);
+ __INTRODUCED_IN(21);
int chown(const char* __path, uid_t __owner, gid_t __group);
int fchown(int __fd, uid_t __owner, gid_t __group);
int fchownat(int __dir_fd, const char* __path, uid_t __owner, gid_t __group, int __flags);
int lchown(const char* __path, uid_t __owner, gid_t __group);
-char* getcwd(char* __buf, size_t __size) __overloadable __RENAME_CLANG(getcwd);
+char* getcwd(char* __buf, size_t __size);
void sync(void);
#if defined(__USE_GNU)
@@ -157,10 +156,8 @@
int close(int __fd);
-ssize_t read(int __fd, void* __buf, size_t __count) __overloadable
- __RENAME_CLANG(read);
-ssize_t write(int __fd, const void* __buf, size_t __count) __overloadable
- __RENAME_CLANG(write);
+ssize_t read(int __fd, void* __buf, size_t __count);
+ssize_t write(int __fd, const void* __buf, size_t __count);
int dup(int __old_fd);
int dup2(int __old_fd, int __new_fd);
@@ -173,26 +170,22 @@
int truncate(const char* __path, off_t __length) __RENAME(truncate64) __INTRODUCED_IN(21);
off_t lseek(int __fd, off_t __offset, int __whence) __RENAME(lseek64);
ssize_t pread(int __fd, void* __buf, size_t __count, off_t __offset)
- __overloadable __RENAME(pread64) __INTRODUCED_IN(12);
+ __RENAME(pread64) __INTRODUCED_IN(12);
ssize_t pwrite(int __fd, const void* __buf, size_t __count, off_t __offset)
- __overloadable __RENAME(pwrite64) __INTRODUCED_IN(12);
+ __RENAME(pwrite64) __INTRODUCED_IN(12);
int ftruncate(int __fd, off_t __length) __RENAME(ftruncate64) __INTRODUCED_IN(12);
#else
int truncate(const char* __path, off_t __length);
off_t lseek(int __fd, off_t __offset, int __whence);
-ssize_t pread(int __fd, void* __buf, size_t __count, off_t __offset)
- __overloadable __RENAME_CLANG(pread);
-ssize_t pwrite(int __fd, const void* __buf, size_t __count, off_t __offset)
- __overloadable __RENAME_CLANG(pwrite);
+ssize_t pread(int __fd, void* __buf, size_t __count, off_t __offset);
+ssize_t pwrite(int __fd, const void* __buf, size_t __count, off_t __offset);
int ftruncate(int __fd, off_t __length);
#endif
int truncate64(const char* __path, off64_t __length) __INTRODUCED_IN(21);
off64_t lseek64(int __fd, off64_t __offset, int __whence);
-ssize_t pread64(int __fd, void* __buf, size_t __count, off64_t __offset)
- __INTRODUCED_IN(12) __overloadable __RENAME_CLANG(pread64);
-ssize_t pwrite64(int __fd, const void* __buf, size_t __count, off64_t __offset)
- __INTRODUCED_IN(12) __overloadable __RENAME_CLANG(pwrite64);
+ssize_t pread64(int __fd, void* __buf, size_t __count, off64_t __offset) __INTRODUCED_IN(12);
+ssize_t pwrite64(int __fd, const void* __buf, size_t __count, off64_t __offset) __INTRODUCED_IN(12);
int ftruncate64(int __fd, off64_t __length) __INTRODUCED_IN(12);
int pause(void);