Imported Upstream version 4.2.0.179

Former-commit-id: 0a113cb3a6feb7873f632839b1307cc6033cd595
This commit is contained in:
Xamarin Public Jenkins
2015-08-26 07:17:56 -04:00
committed by Jo Shields
parent 183bba2c9a
commit 6992685b86
7507 changed files with 90259 additions and 657307 deletions

View File

@@ -35,7 +35,7 @@ Mono_Posix_Stdlib_SetLastError (int error_number)
* we assume that the XPG version is present.
*/
#ifdef _GNU_SOURCE
#ifdef _GNU_SOURCE && !PLATFORM_ANDROID
#define mph_min(x,y) ((x) <= (y) ? (x) : (y))
/* If you pass an invalid errno value to glibc 2.3.2's strerror_r, you get
@@ -80,7 +80,27 @@ Mono_Posix_Syscall_strerror_r (int errnum, char *buf, mph_size_t n)
mph_return_if_size_t_overflow (n);
/* first, check for valid errnum */
#if PLATFORM_ANDROID
/* Android NDK defines _GNU_SOURCE but strerror_r follows the XSI semantics
* not the GNU one. XSI version returns an integer, as opposed to the GNU one
* which returns pointer to the buffer.
*/
if (strerror_r (errnum, ebuf, sizeof(ebuf)) == -1) {
/* XSI strerror_r will return -1 if errno is set, but if we leave the value
* alone it breaks Mono.Posix StdioFileStream tests, so we'll ignore the value
* and set errno as below
*/
errno = EINVAL;
return -1;
}
r = ebuf;
#else
r = strerror_r (errnum, ebuf, sizeof(ebuf));
#endif
if (!r) {
errno = EINVAL;
return -1;
}
len = strlen (r);
if (r == ebuf ||

74
support/libm/complex.c Normal file
View File

@@ -0,0 +1,74 @@
/* @(#)e_hypot.c 1.3 95/01/18 */
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunSoft, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
#include <sys/cdefs.h>
#include <float.h>
#include <math.h>
#include "complex.h"
#include "math_private.h"
/*-
* Copyright (c) 2004 Stefan Farfeleder
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
double
creal(double complex z)
{
return z;
}
double
cimag(double complex z)
{
const double_complex z1 = { .f = z };
return (IMAGPART(z1));
}
/*
* cabs() wrapper for hypot().
*
* Written by J.T. Conklin, <jtc@wimsey.com>
* Placed into the Public Domain, 1994.
*/
double
cabs(double complex z)
{
return hypot(creal(z), cimag(z));
}