Remove __BIONIC_LEGACY_INLINE.
Don't use the same declaration to declare both static and non-static
functions, to make life easier for versioner.
(Also, remove __BIONIC_LEGACY_INLINE from two functions in termios.h
that weren't actually legacy inlines.)
Bug: http://b/30170081
Change-Id: Ibb73377d77a2b4cee016289b7c46a01452e45fae
diff --git a/libc/include/signal.h b/libc/include/signal.h
index 8d9d63f..085f92f 100644
--- a/libc/include/signal.h
+++ b/libc/include/signal.h
@@ -115,15 +115,18 @@
int sigaction(int, const struct sigaction*, struct sigaction*);
-__BIONIC_LEGACY_INLINE sighandler_t signal(int, sighandler_t);
-
int siginterrupt(int, int);
-__BIONIC_LEGACY_INLINE int sigaddset(sigset_t* _Nonnull, int);
-__BIONIC_LEGACY_INLINE int sigdelset(sigset_t* _Nonnull, int);
-__BIONIC_LEGACY_INLINE int sigemptyset(sigset_t* _Nonnull);
-__BIONIC_LEGACY_INLINE int sigfillset(sigset_t* _Nonnull);
-__BIONIC_LEGACY_INLINE int sigismember(const sigset_t* _Nonnull, int);
+#if __ANDROID_API__ >= 21
+sighandler_t signal(int, sighandler_t);
+int sigaddset(sigset_t*, int);
+int sigdelset(sigset_t*, int);
+int sigemptyset(sigset_t*);
+int sigfillset(sigset_t*);
+int sigismember(const sigset_t*, int);
+#else
+// Implemented as static inlines before 21.
+#endif
int sigpending(sigset_t* _Nonnull);
int sigprocmask(int, const sigset_t*, sigset_t*);
diff --git a/libc/include/stdlib.h b/libc/include/stdlib.h
index 65b92a6..28c2132 100644
--- a/libc/include/stdlib.h
+++ b/libc/include/stdlib.h
@@ -74,10 +74,7 @@
extern int posix_memalign(void** memptr, size_t alignment, size_t size) __INTRODUCED_IN(16);
-__BIONIC_LEGACY_INLINE double atof(const char*);
-
extern double strtod(const char*, char**);
-__BIONIC_LEGACY_INLINE float strtof(const char*, char**);
extern long double strtold(const char*, char**) __INTRODUCED_IN(21);
extern long double strtold_l(const char*, char**, locale_t) __INTRODUCED_IN(21);
@@ -88,10 +85,6 @@
extern long atol(const char*) __purefunc;
extern long long atoll(const char*) __purefunc;
-__BIONIC_LEGACY_INLINE int abs(int) __pure2;
-__BIONIC_LEGACY_INLINE long labs(long) __pure2;
-__BIONIC_LEGACY_INLINE long long llabs(long long) __pure2;
-
extern char * realpath(const char *path, char *resolved);
extern int system(const char *string);
@@ -107,9 +100,7 @@
#define RAND_MAX 0x7fffffff
-__BIONIC_LEGACY_INLINE int rand(void);
int rand_r(unsigned int*) __INTRODUCED_IN(21);
-__BIONIC_LEGACY_INLINE void srand(unsigned int);
double drand48(void);
double erand48(unsigned short[3]);
@@ -122,12 +113,9 @@
void srand48(long);
char* initstate(unsigned int, char*, size_t) __INTRODUCED_IN(21);
-__BIONIC_LEGACY_INLINE long random(void);
char* setstate(char*) __INTRODUCED_IN(21);
-__BIONIC_LEGACY_INLINE void srandom(unsigned int);
int getpt(void);
-__BIONIC_LEGACY_INLINE int grantpt(int);
int posix_openpt(int) __INTRODUCED_IN(21);
char* ptsname(int);
int ptsname_r(int, char*, size_t);
@@ -190,6 +178,21 @@
#endif /* defined(__BIONIC_FORTIFY) */
+#if __ANDROID_API__ >= 21
+float strtof(const char*, char**);
+double atof(const char*);
+int abs(int) __pure2;
+long labs(long) __pure2;
+long long llabs(long long) __pure2;
+int rand(void);
+void srand(unsigned int);
+long random(void);
+void srandom(unsigned int);
+int grantpt(int);
+#else
+// Implemented as static inlines before 21.
+#endif
+
__END_DECLS
#include <android/legacy_stdlib_inlines.h>
diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h
index 2688626..e44ba52 100644
--- a/libc/include/sys/cdefs.h
+++ b/libc/include/sys/cdefs.h
@@ -289,12 +289,6 @@
/* Used to rename functions so that the compiler emits a call to 'x' rather than the function this was applied to. */
#define __RENAME(x) __asm__(#x)
-#if __ANDROID_API__ < 21
-#define __BIONIC_LEGACY_INLINE static __inline
-#else
-#define __BIONIC_LEGACY_INLINE extern
-#endif
-
#ifdef __clang__
#define __AVAILABILITY(...) __attribute__((availability(android,__VA_ARGS__)))
#else
diff --git a/libc/include/sys/stat.h b/libc/include/sys/stat.h
index 0a999e4..a65f27a 100644
--- a/libc/include/sys/stat.h
+++ b/libc/include/sys/stat.h
@@ -177,7 +177,12 @@
}
#endif /* defined(__BIONIC_FORTIFY) */
-__BIONIC_LEGACY_INLINE int mkfifo(const char*, mode_t);
+#if __ANDROID_API__ >= 21
+int mkfifo(const char*, mode_t);
+#else
+// Implemented as a static inline before 21.
+#endif
+
extern int mkfifoat(int, const char*, mode_t) __INTRODUCED_IN(23);
extern int fchmodat(int, const char*, mode_t, int);
diff --git a/libc/include/termios.h b/libc/include/termios.h
index 15a7b32..ad33bbe 100644
--- a/libc/include/termios.h
+++ b/libc/include/termios.h
@@ -35,19 +35,23 @@
__BEGIN_DECLS
-__BIONIC_LEGACY_INLINE speed_t cfgetispeed(const struct termios*);
-__BIONIC_LEGACY_INLINE speed_t cfgetospeed(const struct termios*);
-__BIONIC_LEGACY_INLINE void cfmakeraw(struct termios*);
-__BIONIC_LEGACY_INLINE int cfsetispeed(struct termios*, speed_t);
-__BIONIC_LEGACY_INLINE int cfsetospeed(struct termios*, speed_t);
-__BIONIC_LEGACY_INLINE int cfsetspeed(struct termios*, speed_t) __INTRODUCED_IN(21);
-__BIONIC_LEGACY_INLINE int tcdrain(int) __INTRODUCED_IN(21);
-__BIONIC_LEGACY_INLINE int tcflow(int, int);
-__BIONIC_LEGACY_INLINE int tcflush(int, int);
-__BIONIC_LEGACY_INLINE int tcgetattr(int, struct termios*);
-__BIONIC_LEGACY_INLINE pid_t tcgetsid(int);
-__BIONIC_LEGACY_INLINE int tcsendbreak(int, int);
-__BIONIC_LEGACY_INLINE int tcsetattr(int, int, const struct termios*);
+#if __ANDROID_API__ >= 21
+// Implemented as static inlines before 21.
+speed_t cfgetispeed(const struct termios*);
+speed_t cfgetospeed(const struct termios*);
+void cfmakeraw(struct termios*);
+int cfsetispeed(struct termios*, speed_t);
+int cfsetospeed(struct termios*, speed_t);
+int tcflow(int, int);
+int tcflush(int, int);
+int tcgetattr(int, struct termios*);
+pid_t tcgetsid(int);
+int tcsendbreak(int, int);
+int tcsetattr(int, int, const struct termios*);
+#endif
+
+int cfsetspeed(struct termios*, speed_t) __INTRODUCED_IN(21);
+int tcdrain(int) __INTRODUCED_IN(21);
__END_DECLS