Remove now unnecessary _POSIX_C_SOURCE bits to work around macOS bug.
crypto/bio/bio_test.cc - I'm not sure where this was added for, but none
of the functions used there appear to have feature macros documented.
crypto/bio/printf.c - -std=c99 provides (v)snprintf.
crypto/lhash/lhash_test.cc - we no longer call rand_r.
crypto/mem.c - we no longer call strdup and -std=c99 provides (v)snprintf.
Apple messed up their headers and, if _POSIX_C_SOURCE is defined but
_DARWIN_C_SOURCE isn't, pthread.h no longer defines mach_port_t. They
then shipped a version of libc++ headers that is missing this fix, so
the build breaks:
https://github.com/llvm-mirror/libcxx/commit/bcc92d75df0274b9593ebd097fcae60494e3bffc
If one uses XCode, they've hacked their pthread.h to provide mach_port_t
if defined(__cplusplus), but the standalone tools appear to be old and
missing this.
We can work around this by also defining _DARWIN_C_SOURCE in C++ files
that need _POSIX_C_SOURCE, but it appears none of these files actually
need it.
Change-Id: I5df9453730696100eb22b809febeb65053701322
Reviewed-on: https://boringssl-review.googlesource.com/20964
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/bio/bio_test.cc b/crypto/bio/bio_test.cc
index 3d78635..eb54f7e 100644
--- a/crypto/bio/bio_test.cc
+++ b/crypto/bio/bio_test.cc
@@ -12,10 +12,6 @@
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
-#if !defined(_POSIX_C_SOURCE)
-#define _POSIX_C_SOURCE 201410L
-#endif
-
#include <algorithm>
#include <string>
diff --git a/crypto/bio/printf.c b/crypto/bio/printf.c
index 28162e6..4f9d8a1 100644
--- a/crypto/bio/printf.c
+++ b/crypto/bio/printf.c
@@ -54,10 +54,6 @@
* copied and put under another distribution licence
* [including the GNU Public Licence.] */
-#if !defined(_POSIX_C_SOURCE)
-#define _POSIX_C_SOURCE 201410L // for snprintf, vprintf etc
-#endif
-
#include <openssl/bio.h>
#include <assert.h>
diff --git a/crypto/lhash/lhash_test.cc b/crypto/lhash/lhash_test.cc
index cc146e8..0859eeb 100644
--- a/crypto/lhash/lhash_test.cc
+++ b/crypto/lhash/lhash_test.cc
@@ -12,10 +12,6 @@
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
-#if !defined(_POSIX_C_SOURCE)
-#define _POSIX_C_SOURCE 201410L
-#endif
-
#include <openssl/lhash.h>
#include <stdio.h>
diff --git a/crypto/mem.c b/crypto/mem.c
index 09f3159..67f74b7 100644
--- a/crypto/mem.c
+++ b/crypto/mem.c
@@ -54,10 +54,6 @@
* copied and put under another distribution licence
* [including the GNU Public Licence.] */
-#if !defined(_POSIX_C_SOURCE)
-#define _POSIX_C_SOURCE 201410L // needed for strdup, snprintf, vprintf etc
-#endif
-
#include <openssl/mem.h>
#include <assert.h>