aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.8.1/libgo/runtime/go-matherr.c
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2016-02-24 13:48:45 -0800
committerDan Albert <danalbert@google.com>2016-02-24 13:51:18 -0800
commitb9de1157289455b0ca26daff519d4a0ddcd1fa13 (patch)
tree4c56cc0a34b91f17033a40a455f26652304f7b8d /gcc-4.8.1/libgo/runtime/go-matherr.c
parent098157a754787181cfa10e71325832448ddcea98 (diff)
downloadtoolchain_gcc-b9de1157289455b0ca26daff519d4a0ddcd1fa13.tar.gz
toolchain_gcc-b9de1157289455b0ca26daff519d4a0ddcd1fa13.tar.bz2
toolchain_gcc-b9de1157289455b0ca26daff519d4a0ddcd1fa13.zip
Update 4.8.1 to 4.8.3.
My previous drop was the wrong version. The platform mingw is currently using 4.8.3, not 4.8.1 (not sure how I got that wrong). From ftp://ftp.gnu.org/gnu/gcc/gcc-4.8.3/gcc-4.8.3.tar.bz2. Bug: http://b/26523949 Change-Id: Id85f1bdcbbaf78c7d0b5a69e74c798a08f341c35
Diffstat (limited to 'gcc-4.8.1/libgo/runtime/go-matherr.c')
-rw-r--r--gcc-4.8.1/libgo/runtime/go-matherr.c88
1 files changed, 0 insertions, 88 deletions
diff --git a/gcc-4.8.1/libgo/runtime/go-matherr.c b/gcc-4.8.1/libgo/runtime/go-matherr.c
deleted file mode 100644
index d620ba08b..000000000
--- a/gcc-4.8.1/libgo/runtime/go-matherr.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* go-matherr.c -- a Go version of the matherr function.
-
- Copyright 2012 The Go Authors. All rights reserved.
- Use of this source code is governed by a BSD-style
- license that can be found in the LICENSE file. */
-
-/* The gccgo version of the math library calls libc functions. On
- some systems, such as Solaris, those functions will call matherr on
- exceptional conditions. This is a version of matherr appropriate
- for Go, one which returns the values that the Go math library
- expects. This is fine for pure Go programs. For mixed Go and C
- programs this will be problematic if the C programs themselves use
- matherr. Normally the C version of matherr will override this, and
- the Go code will just have to cope. If this turns out to be too
- problematic we can change to run pure Go code in the math library
- on systems that use matherr. */
-
-#include <math.h>
-#include <stdint.h>
-
-#include "config.h"
-
-#if defined(HAVE_MATHERR) && defined(HAVE_STRUCT_EXCEPTION)
-
-#define PI 3.14159265358979323846264338327950288419716939937510582097494459
-
-int
-matherr (struct exception* e)
-{
- const char *n;
-
- if (e->type != DOMAIN)
- return 0;
-
- n = e->name;
- if (__builtin_strcmp (n, "acos") == 0
- || __builtin_strcmp (n, "asin") == 0)
- e->retval = __builtin_nan ("");
- else if (__builtin_strcmp (n, "atan2") == 0)
- {
- if (e->arg1 == 0 && e->arg2 == 0)
- {
- double nz;
-
- nz = -0.0;
- if (__builtin_memcmp (&e->arg2, &nz, sizeof (double)) != 0)
- e->retval = e->arg1;
- else
- e->retval = copysign (PI, e->arg1);
- }
- else
- return 0;
- }
- else if (__builtin_strcmp (n, "log") == 0
- || __builtin_strcmp (n, "log10") == 0)
- e->retval = __builtin_nan ("");
- else if (__builtin_strcmp (n, "pow") == 0)
- {
- if (e->arg1 < 0)
- e->retval = __builtin_nan ("");
- else if (e->arg1 == 0 && e->arg2 == 0)
- e->retval = 1.0;
- else if (e->arg1 == 0 && e->arg2 < 0)
- {
- double i;
-
- if (modf (e->arg2, &i) == 0 && ((int64_t) i & 1) == 1)
- e->retval = copysign (__builtin_inf (), e->arg1);
- else
- e->retval = __builtin_inf ();
- }
- else
- return 0;
- }
- else if (__builtin_strcmp (n, "sqrt") == 0)
- {
- if (e->arg1 < 0)
- e->retval = __builtin_nan ("");
- else
- return 0;
- }
- else
- return 0;
-
- return 1;
-}
-
-#endif