aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2016-06-13 13:23:42 -0700
committerElliott Hughes <enh@google.com>2016-06-13 14:14:43 -0700
commit9c8d711aa5ee3108a8e1e8959be9d0355ca0fa6a (patch)
treed860929c4008c8b28d5516c16e9b404bfd94fa5a
parentc713adeca1b840ea8f2fd94717e77316cb0a39c4 (diff)
downloadbionic-9c8d711aa5ee3108a8e1e8959be9d0355ca0fa6a.tar.gz
Don't expose all BSD extensions.
Just expose the ones that bionic historically leaked. Also, many of the M_* constants in <math.h> are actually POSIX. Change-Id: I6275df84c5866b872b71f1c8ed14e2aada12b793
-rw-r--r--libc/include/limits.h2
-rw-r--r--libc/include/math.h4
-rw-r--r--libc/include/stdio.h5
-rw-r--r--libc/include/sys/cdefs.h5
-rw-r--r--libc/include/sys/endian.h2
-rw-r--r--libc/include/sys/limits.h2
-rw-r--r--libc/include/sys/types.h2
-rw-r--r--libm/Android.bp1
8 files changed, 9 insertions, 14 deletions
diff --git a/libc/include/limits.h b/libc/include/limits.h
index 84effa7a2..cb86aec8c 100644
--- a/libc/include/limits.h
+++ b/libc/include/limits.h
@@ -66,7 +66,7 @@
#define ULONG_LONG_MAX ULLONG_MAX
#endif
-#if defined(__USE_BSD)
+#if defined(__USE_BSD) || defined(__BIONIC__) /* Historically bionic exposed these. */
#if defined(__LP64__)
#define SIZE_T_MAX ULONG_MAX
#else
diff --git a/libc/include/math.h b/libc/include/math.h
index c84d0176d..1afef4cbb 100644
--- a/libc/include/math.h
+++ b/libc/include/math.h
@@ -297,7 +297,6 @@ long double tanl(long double) __INTRODUCED_IN(21);
long double tgammal(long double) __INTRODUCED_IN(21);
long double truncl(long double);
-#if defined(__USE_BSD) || defined(__USE_GNU)
#define M_E 2.7182818284590452354 /* e */
#define M_LOG2E 1.4426950408889634074 /* log 2e */
#define M_LOG10E 0.43429448190325182765 /* log 10e */
@@ -311,7 +310,10 @@ long double truncl(long double);
#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
+
#define MAXFLOAT ((float)3.40282346638528860e+38)
+
+#if defined(__USE_BSD) || defined(__USE_GNU)
extern int signgam;
double j0(double);
double j1(double);
diff --git a/libc/include/stdio.h b/libc/include/stdio.h
index cfcdf1a41..ef660d8e8 100644
--- a/libc/include/stdio.h
+++ b/libc/include/stdio.h
@@ -227,10 +227,7 @@ int putchar_unlocked(int);
FILE* fmemopen(void*, size_t, const char*) __INTRODUCED_IN(23);
FILE* open_memstream(char**, size_t*) __INTRODUCED_IN(23);
-/*
- * Routines that are purely local.
- */
-#if defined(__USE_BSD)
+#if defined(__USE_BSD) || defined(__BIONIC__) /* Historically bionic exposed these. */
int asprintf(char** __restrict, const char* __restrict, ...) __printflike(2, 3);
char* fgetln(FILE* __restrict, size_t* __restrict);
int fpurge(FILE*);
diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h
index 5369e3092..8cde1c7b8 100644
--- a/libc/include/sys/cdefs.h
+++ b/libc/include/sys/cdefs.h
@@ -233,11 +233,6 @@
# define __USE_BSD 1
#endif
-/* Historically there was no way to turn off the BSD stuff, so we're probably stuck with that. */
-#if !defined(__USE_BSD)
-# define __USE_BSD 1
-#endif
-
/* _FILE_OFFSET_BITS 64 support. */
#if !defined(__LP64__) && defined(_FILE_OFFSET_BITS)
#if _FILE_OFFSET_BITS == 64
diff --git a/libc/include/sys/endian.h b/libc/include/sys/endian.h
index 99d5ff1fc..b9e47580c 100644
--- a/libc/include/sys/endian.h
+++ b/libc/include/sys/endian.h
@@ -64,7 +64,7 @@ __END_DECLS
#define htonq(x) __swap64(x)
#define ntohq(x) __swap64(x)
-#if defined(__USE_BSD)
+#if defined(__USE_BSD) || defined(__BIONIC__) /* Historically bionic exposed these. */
#define LITTLE_ENDIAN _LITTLE_ENDIAN
#define BIG_ENDIAN _BIG_ENDIAN
#define PDP_ENDIAN _PDP_ENDIAN
diff --git a/libc/include/sys/limits.h b/libc/include/sys/limits.h
index b7d899b52..5aa3d80fa 100644
--- a/libc/include/sys/limits.h
+++ b/libc/include/sys/limits.h
@@ -73,7 +73,7 @@
# define LLONG_MIN (-0x7fffffffffffffffLL-1)
/* min value for a signed long long */
-#if defined(__USE_BSD)
+#if defined(__USE_BSD) || defined(__BIONIC__) /* Historically bionic exposed these. */
# define UID_MAX UINT_MAX /* max value for a uid_t */
# define GID_MAX UINT_MAX /* max value for a gid_t */
#endif
diff --git a/libc/include/sys/types.h b/libc/include/sys/types.h
index 469842d95..28950576b 100644
--- a/libc/include/sys/types.h
+++ b/libc/include/sys/types.h
@@ -141,7 +141,7 @@ typedef __kernel_ssize_t ssize_t;
typedef unsigned int uint_t;
typedef unsigned int uint;
-#if defined(__USE_BSD)
+#if defined(__USE_BSD) || defined(__BIONIC__) /* Historically bionic exposed these. */
#include <sys/sysmacros.h>
typedef unsigned char u_char;
diff --git a/libm/Android.bp b/libm/Android.bp
index 25c3e8f42..23b9d5e0c 100644
--- a/libm/Android.bp
+++ b/libm/Android.bp
@@ -510,6 +510,7 @@ cc_library {
cflags: [
"-D__BIONIC_NO_MATH_INLINES",
+ "-D_BSD_SOURCE",
"-DFLT_EVAL_METHOD=0",
"-include freebsd-compat.h",
"-Werror",