From: Andreas Schwab Date: Fri, 24 Feb 2012 11:22:22 +0000 (+0100) Subject: m68k: set errno in sin, cos, tan X-Git-Tag: glibc-2.16-ports-before-merge~246 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=27c1f49d4b983cf2274161872d36d30a543392ef;p=thirdparty%2Fglibc.git m68k: set errno in sin, cos, tan --- diff --git a/ChangeLog.m68k b/ChangeLog.m68k index 7eace9206d3..9724c306854 100644 --- a/ChangeLog.m68k +++ b/ChangeLog.m68k @@ -1,3 +1,18 @@ +2012-02-24 Andreas Schwab + + * sysdeps/m68k/m680x0/fpu/s_sin.c: Set errno to EDOM if argument + is infinite. + * sysdeps/m68k/m680x0/fpu/s_cos.c: Include . + * sysdeps/m68k/m680x0/fpu/s_tan.c: Likewise. + * sysdeps/m68k/m680x0/fpu/s_cosf.c: Include . + * sysdeps/m68k/m680x0/fpu/s_cosl.c: Include . + * sysdeps/m68k/m680x0/fpu/s_sinf.c: Include . + (FUNC): Don't define if already defined. + (float_type): Define. + * sysdeps/m68k/m680x0/fpu/s_sinl.c: Likewise. + * sysdeps/m68k/m680x0/fpu/bits/mathinline.h [__OPTIMIZE__]: Don't + define sin, cos, tan as inlines. + 2012-02-08 Andreas Schwab * sysdeps/m68k/crti.S: New file. diff --git a/sysdeps/m68k/m680x0/fpu/bits/mathinline.h b/sysdeps/m68k/m680x0/fpu/bits/mathinline.h index 00ae0760382..d79f6bdcde0 100644 --- a/sysdeps/m68k/m680x0/fpu/bits/mathinline.h +++ b/sysdeps/m68k/m680x0/fpu/bits/mathinline.h @@ -1,5 +1,5 @@ /* Definitions of inline math functions implemented by the m68881/2. - Copyright (C) 1991,92,93,94,96,97,98,99,2000,2002, 2003, 2004, 2008, 2010 + Copyright (C) 1991,92,93,94,96,97,98,99,2000,2002, 2003, 2004, 2008, 2010, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -175,9 +175,6 @@ __inline_mathop(__trunc, intrz) #if !defined __NO_MATH_INLINES && defined __OPTIMIZE__ __inline_mathop(atan, atan) -__inline_mathop(cos, cos) -__inline_mathop(sin, sin) -__inline_mathop(tan, tan) __inline_mathop(tanh, tanh) # if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 diff --git a/sysdeps/m68k/m680x0/fpu/s_cos.c b/sysdeps/m68k/m680x0/fpu/s_cos.c index 9c96076316a..2f1adf77f57 100644 --- a/sysdeps/m68k/m680x0/fpu/s_cos.c +++ b/sysdeps/m68k/m680x0/fpu/s_cos.c @@ -1,2 +1,2 @@ #define FUNC cos -#include +#include diff --git a/sysdeps/m68k/m680x0/fpu/s_cosf.c b/sysdeps/m68k/m680x0/fpu/s_cosf.c index db965b8cc1c..b6d6accb4ac 100644 --- a/sysdeps/m68k/m680x0/fpu/s_cosf.c +++ b/sysdeps/m68k/m680x0/fpu/s_cosf.c @@ -1,2 +1,2 @@ -#define FUNC cosf -#include +#define FUNC cosf +#include diff --git a/sysdeps/m68k/m680x0/fpu/s_cosl.c b/sysdeps/m68k/m680x0/fpu/s_cosl.c index 4198feef18f..eb61521fdda 100644 --- a/sysdeps/m68k/m680x0/fpu/s_cosl.c +++ b/sysdeps/m68k/m680x0/fpu/s_cosl.c @@ -1,2 +1,2 @@ #define FUNC cosl -#include +#include diff --git a/sysdeps/m68k/m680x0/fpu/s_sin.c b/sysdeps/m68k/m680x0/fpu/s_sin.c index 0d4abdbfe45..e088b584b79 100644 --- a/sysdeps/m68k/m680x0/fpu/s_sin.c +++ b/sysdeps/m68k/m680x0/fpu/s_sin.c @@ -1,2 +1,41 @@ -#define FUNC sin -#include +/* Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include "mathimpl.h" + +#ifndef FUNC +# define FUNC sin +#endif +#ifndef float_type +# define float_type double +#endif + +#define CONCATX(a,b) __CONCAT(a,b) + +float_type +CONCATX(__,FUNC) (float_type x) +{ + if (__m81_test (x) & __M81_COND_INF) + __set_errno (EDOM); + return __m81_u(CONCATX(__, FUNC)) (x); +} + +#define weak_aliasx(a, b) weak_alias(a, b) +weak_aliasx (CONCATX(__, FUNC), FUNC) diff --git a/sysdeps/m68k/m680x0/fpu/s_sinf.c b/sysdeps/m68k/m680x0/fpu/s_sinf.c index 9b23d4823f4..304f4f76f64 100644 --- a/sysdeps/m68k/m680x0/fpu/s_sinf.c +++ b/sysdeps/m68k/m680x0/fpu/s_sinf.c @@ -1,2 +1,5 @@ -#define FUNC sinf -#include +#ifndef FUNC +# define FUNC sinf +#endif +#define float_type float +#include diff --git a/sysdeps/m68k/m680x0/fpu/s_sinl.c b/sysdeps/m68k/m680x0/fpu/s_sinl.c index 9ac532cb477..31dac0bee70 100644 --- a/sysdeps/m68k/m680x0/fpu/s_sinl.c +++ b/sysdeps/m68k/m680x0/fpu/s_sinl.c @@ -1,2 +1,5 @@ -#define FUNC sinl -#include +#ifndef FUNC +# define FUNC sinl +#endif +#define float_type long double +#include diff --git a/sysdeps/m68k/m680x0/fpu/s_tan.c b/sysdeps/m68k/m680x0/fpu/s_tan.c index ca7fb0e6dc8..dfbbbb22704 100644 --- a/sysdeps/m68k/m680x0/fpu/s_tan.c +++ b/sysdeps/m68k/m680x0/fpu/s_tan.c @@ -1,2 +1,2 @@ #define FUNC tan -#include +#include diff --git a/sysdeps/m68k/m680x0/fpu/s_tanf.c b/sysdeps/m68k/m680x0/fpu/s_tanf.c index 95fe9c71a59..9ae66ddbf33 100644 --- a/sysdeps/m68k/m680x0/fpu/s_tanf.c +++ b/sysdeps/m68k/m680x0/fpu/s_tanf.c @@ -1,2 +1,2 @@ -#define FUNC tanf -#include +#define FUNC tanf +#include diff --git a/sysdeps/m68k/m680x0/fpu/s_tanl.c b/sysdeps/m68k/m680x0/fpu/s_tanl.c index 64fcb544068..27daf8f29b1 100644 --- a/sysdeps/m68k/m680x0/fpu/s_tanl.c +++ b/sysdeps/m68k/m680x0/fpu/s_tanl.c @@ -1,2 +1,2 @@ #define FUNC tanl -#include +#include