diff options
author | Joseph Myers <joseph@codesourcery.com> | 2017-12-19 02:02:26 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2017-12-19 02:02:26 +0000 |
commit | 664251859260d3cca6a477fb08c3b9f2b78a4fd9 (patch) | |
tree | 6862a783277d1253893d35f3afba0b0c796c9f49 /sysdeps/m68k/m680x0 | |
parent | 8e52f573a1e0c2c39968051bcf683805540deb03 (diff) | |
download | glibc-664251859260d3cca6a477fb08c3b9f2b78a4fd9.tar.gz glibc-664251859260d3cca6a477fb08c3b9f2b78a4fd9.tar.xz glibc-664251859260d3cca6a477fb08c3b9f2b78a4fd9.zip |
Fix m68k bits/mathinline.h attributes (bug 22631).
m68k bits/mathinline.h declares various functions with const attributes. These are inappropriate for functions that have results depending on the rounding mode; the machine-independent bits/mathcalls.h only uses const attributes for a very few functions with no rounding mode dependence, and the m68k header should do likewise. GCC uses pure for such functions with -frounding-math, resulting in GCC mainline warning for conflicts with between the header and the built-in attributes and glibc failing to build for m68k with GCC mainline. This patch fixes the attributes to avoid using const except when bits/mathcalls.h does so. (There are a few functions where maybe bits/mathcalls.h could do so but doesn't, but keeping the headers in sync in this regard seems to be the safe approach.) Tested compilation with build-many-glibcs.py with GCC mainline. [BZ #22631] * sysdeps/m68k/m680x0/fpu/bits/mathinline.h (__m81_defun): Add argument for attrubutes. All callers changed. (__inline_mathop1): Likewise. All callers changed. (__inline_mathop): Likewise. All callers changed. [__USE_MISC] (scalbn): Use __inline_forward instead of __inline_forward_c. [__USE_ISOC99] (scalbln): Likewise. [__USE_ISOC99] (nearbyint): Likewise. [__USE_ISOC99] (lrint): Likewise. [__USE_MISC] (scalbnf): Likewise. [__USE_ISOC99] (scalblnf): Likewise. [__USE_ISOC99] (nearbyintf): Likewise. [__USE_ISOC99] (lrintf): Likewise. [__USE_MISC] (scalbnl): Likewise. [__USE_ISOC99] (scalblnl): Likewise. [__USE_ISOC99] (nearbyintl): Likewise. [__USE_ISOC99] (lrintl): Likewise. * sysdeps/m68k/m680x0/fpu/mathimpl.h: All callers of __inline_mathop and __m81_defun changed.
Diffstat (limited to 'sysdeps/m68k/m680x0')
-rw-r--r-- | sysdeps/m68k/m680x0/fpu/bits/mathinline.h | 105 | ||||
-rw-r--r-- | sysdeps/m68k/m680x0/fpu/mathimpl.h | 36 |
2 files changed, 73 insertions, 68 deletions
diff --git a/sysdeps/m68k/m680x0/fpu/bits/mathinline.h b/sysdeps/m68k/m680x0/fpu/bits/mathinline.h index dcc2a4e829..ddf3856157 100644 --- a/sysdeps/m68k/m680x0/fpu/bits/mathinline.h +++ b/sysdeps/m68k/m680x0/fpu/bits/mathinline.h @@ -46,9 +46,9 @@ # define __M81_MATH_INLINES 1 #endif -/* Define a const math function. */ -#define __m81_defun(rettype, func, args) \ - __m81_inline rettype __attribute__((__const__)) \ +/* Define a math function. */ +#define __m81_defun(rettype, func, args, attrs) \ + __m81_inline rettype attrs \ __m81_nth (__m81_u(func) args) /* Define the three variants of a math function that has a direct @@ -57,17 +57,17 @@ is the name of the fpu operation (without leading f). */ #ifdef __USE_ISOC99 -# define __inline_mathop(func, op) \ - __inline_mathop1(double, func, op) \ - __inline_mathop1(float, __CONCAT(func,f), op) \ - __inline_mathop1(long double, __CONCAT(func,l), op) +# define __inline_mathop(func, op, attrs) \ + __inline_mathop1(double, func, op, attrs) \ + __inline_mathop1(float, __CONCAT(func,f), op, attrs) \ + __inline_mathop1(long double, __CONCAT(func,l), op, attrs) #else -# define __inline_mathop(func, op) \ - __inline_mathop1(double, func, op) +# define __inline_mathop(func, op, attrs) \ + __inline_mathop1(double, func, op, attrs) #endif -#define __inline_mathop1(float_type,func, op) \ - __m81_defun (float_type, func, (float_type __mathop_x)) \ +#define __inline_mathop1(float_type,func, op, attrs) \ + __m81_defun (float_type, func, (float_type __mathop_x), attrs) \ { \ float_type __result; \ __asm __volatile__ ("f" __STRING(op) "%.x %1, %0" \ @@ -75,43 +75,43 @@ return __result; \ } -__inline_mathop(__atan, atan) -__inline_mathop(__cos, cos) -__inline_mathop(__sin, sin) -__inline_mathop(__tan, tan) -__inline_mathop(__tanh, tanh) -__inline_mathop(__fabs, abs) +__inline_mathop(__atan, atan,) +__inline_mathop(__cos, cos,) +__inline_mathop(__sin, sin,) +__inline_mathop(__tan, tan,) +__inline_mathop(__tanh, tanh,) +__inline_mathop(__fabs, abs, __attribute__ ((__const__))) #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 -__inline_mathop(__rint, int) -__inline_mathop(__expm1, etoxm1) -__inline_mathop(__log1p, lognp1) +__inline_mathop(__rint, int,) +__inline_mathop(__expm1, etoxm1,) +__inline_mathop(__log1p, lognp1,) #endif #ifdef __USE_MISC -__inline_mathop(__significand, getman) +__inline_mathop(__significand, getman,) #endif #ifdef __USE_ISOC99 -__inline_mathop(__trunc, intrz) +__inline_mathop(__trunc, intrz, __attribute__ ((__const__))) #endif #if !defined __NO_MATH_INLINES && defined __OPTIMIZE__ -__inline_mathop(atan, atan) -__inline_mathop(tanh, tanh) +__inline_mathop(atan, atan,) +__inline_mathop(tanh, tanh,) # if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 -__inline_mathop(rint, int) -__inline_mathop(log1p, lognp1) +__inline_mathop(rint, int,) +__inline_mathop(log1p, lognp1,) # endif # ifdef __USE_MISC -__inline_mathop(significand, getman) +__inline_mathop(significand, getman,) # endif # ifdef __USE_ISOC99 -__inline_mathop(trunc, intrz) +__inline_mathop(trunc, intrz, __attribute__ ((__const__))) # endif #endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */ @@ -121,7 +121,8 @@ __inline_mathop(trunc, intrz) that adds the suffix for the function names. */ #define __inline_functions(float_type, m) \ -__m81_defun (float_type, m(__floor), (float_type __x)) \ +__m81_defun (float_type, m(__floor), (float_type __x), \ + __attribute__ ((__const__))) \ { \ float_type __result; \ unsigned long int __ctrl_reg; \ @@ -137,7 +138,8 @@ __m81_defun (float_type, m(__floor), (float_type __x)) \ return __result; \ } \ \ -__m81_defun (float_type, m(__ceil), (float_type __x)) \ +__m81_defun (float_type, m(__ceil), (float_type __x), \ + __attribute__ ((__const__))) \ { \ float_type __result; \ unsigned long int __ctrl_reg; \ @@ -166,7 +168,8 @@ __inline_functions(long double, __CONCAT_l) #ifdef __USE_MISC # define __inline_functions(float_type, m) \ -__m81_defun (int, m(__isinf), (float_type __value)) \ +__m81_defun (int, m(__isinf), (float_type __value), \ + __attribute__ ((__const__))) \ { \ /* There is no branch-condition for infinity, \ so we must extract and examine the condition codes manually. */ \ @@ -176,7 +179,8 @@ __m81_defun (int, m(__isinf), (float_type __value)) \ return (__fpsr & (2 << 24)) ? (__fpsr & (8 << 24) ? -1 : 1) : 0; \ } \ \ -__m81_defun (int, m(__finite), (float_type __value)) \ +__m81_defun (int, m(__finite), (float_type __value), \ + __attribute__ ((__const__))) \ { \ /* There is no branch-condition for infinity, so we must extract and \ examine the condition codes manually. */ \ @@ -187,7 +191,7 @@ __m81_defun (int, m(__finite), (float_type __value)) \ } \ \ __m81_defun (float_type, m(__scalbn), \ - (float_type __x, int __n)) \ + (float_type __x, int __n),) \ { \ float_type __result; \ __asm __volatile__ ("fscale%.l %1, %0" : "=f" (__result) \ @@ -205,7 +209,8 @@ __inline_functions(long double, __CONCAT_l) #if defined __USE_MISC || defined __USE_XOPEN # define __inline_functions(float_type, m) \ -__m81_defun (int, m(__isnan), (float_type __value)) \ +__m81_defun (int, m(__isnan), (float_type __value), \ + __attribute__ ((__const__))) \ { \ char __result; \ __asm ("ftst%.x %1\n" \ @@ -226,12 +231,12 @@ __inline_functions(long double, __CONCAT_l) # define __inline_functions(float_type, m) \ __m81_defun (float_type, m(__scalbln), \ - (float_type __x, long int __n)) \ + (float_type __x, long int __n),) \ { \ return m(__scalbn) (__x, __n); \ } \ \ -__m81_defun (float_type, m(__nearbyint), (float_type __x)) \ +__m81_defun (float_type, m(__nearbyint), (float_type __x),) \ { \ float_type __result; \ unsigned long int __ctrl_reg; \ @@ -245,7 +250,7 @@ __m81_defun (float_type, m(__nearbyint), (float_type __x)) \ return __result; \ } \ \ -__m81_defun (long int, m(__lrint), (float_type __x)) \ +__m81_defun (long int, m(__lrint), (float_type __x),) \ { \ long int __result; \ __asm __volatile__ ("fmove%.l %1, %0" : "=dm" (__result) : "f" (__x)); \ @@ -305,7 +310,7 @@ __inline_forward_c(double,ceil, (double __x), (__x)) __inline_forward_c(int,isinf, (double __value), (__value)) # endif __inline_forward_c(int,finite, (double __value), (__value)) -__inline_forward_c(double,scalbn, (double __x, int __n), (__x, __n)) +__inline_forward(double,scalbn, (double __x, int __n), (__x, __n)) # endif # if defined __USE_MISC || defined __USE_XOPEN # ifndef __USE_ISOC99 /* Conflict with macro of same name. */ @@ -313,9 +318,9 @@ __inline_forward_c(int,isnan, (double __value), (__value)) # endif # endif # ifdef __USE_ISOC99 -__inline_forward_c(double,scalbln, (double __x, long int __n), (__x, __n)) -__inline_forward_c(double,nearbyint, (double __value), (__value)) -__inline_forward_c(long int,lrint, (double __value), (__value)) +__inline_forward(double,scalbln, (double __x, long int __n), (__x, __n)) +__inline_forward(double,nearbyint, (double __value), (__value)) +__inline_forward(long int,lrint, (double __value), (__value)) # endif # ifdef __USE_GNU __inline_forward(void,sincos, (double __x, double *__sinx, double *__cosx), @@ -329,13 +334,13 @@ __inline_forward_c(float,ceilf, (float __x), (__x)) # ifdef __USE_MISC __inline_forward_c(int,isinff, (float __value), (__value)) __inline_forward_c(int,finitef, (float __value), (__value)) -__inline_forward_c(float,scalbnf, (float __x, int __n), (__x, __n)) +__inline_forward(float,scalbnf, (float __x, int __n), (__x, __n)) __inline_forward_c(int,isnanf, (float __value), (__value)) # endif # ifdef __USE_ISOC99 -__inline_forward_c(float,scalblnf, (float __x, long int __n), (__x, __n)) -__inline_forward_c(float,nearbyintf, (float __value), (__value)) -__inline_forward_c(long int,lrintf, (float __value), (__value)) +__inline_forward(float,scalblnf, (float __x, long int __n), (__x, __n)) +__inline_forward(float,nearbyintf, (float __value), (__value)) +__inline_forward(long int,lrintf, (float __value), (__value)) # endif # ifdef __USE_GNU __inline_forward(void,sincosf, (float __x, float *__sinx, float *__cosx), @@ -347,14 +352,14 @@ __inline_forward_c(long double,ceill, (long double __x), (__x)) # ifdef __USE_MISC __inline_forward_c(int,isinfl, (long double __value), (__value)) __inline_forward_c(int,finitel, (long double __value), (__value)) -__inline_forward_c(long double,scalbnl, (long double __x, int __n), (__x, __n)) +__inline_forward(long double,scalbnl, (long double __x, int __n), (__x, __n)) __inline_forward_c(int,isnanl, (long double __value), (__value)) # endif # ifdef __USE_ISOC99 -__inline_forward_c(long double,scalblnl, (long double __x, long int __n), - (__x, __n)) -__inline_forward_c(long double,nearbyintl, (long double __value), (__value)) -__inline_forward_c(long int,lrintl, (long double __value), (__value)) +__inline_forward(long double,scalblnl, (long double __x, long int __n), + (__x, __n)) +__inline_forward(long double,nearbyintl, (long double __value), (__value)) +__inline_forward(long int,lrintl, (long double __value), (__value)) # endif # ifdef __USE_GNU __inline_forward(void,sincosl, diff --git a/sysdeps/m68k/m680x0/fpu/mathimpl.h b/sysdeps/m68k/m680x0/fpu/mathimpl.h index 653df96873..2be4e1a01c 100644 --- a/sysdeps/m68k/m680x0/fpu/mathimpl.h +++ b/sysdeps/m68k/m680x0/fpu/mathimpl.h @@ -20,27 +20,27 @@ /* This file contains the definitions of the inline math functions that are only used internally inside libm, not visible to the user. */ -__inline_mathop (__ieee754_acos, acos) -__inline_mathop (__ieee754_asin, asin) -__inline_mathop (__ieee754_cosh, cosh) -__inline_mathop (__ieee754_sinh, sinh) -__inline_mathop (__ieee754_exp, etox) -__inline_mathop (__ieee754_exp2, twotox) -__inline_mathop (__ieee754_exp10, tentox) -__inline_mathop (__ieee754_log10, log10) -__inline_mathop (__ieee754_log2, log2) -__inline_mathop (__ieee754_log, logn) -__inline_mathop (__ieee754_sqrt, sqrt) -__inline_mathop (__ieee754_atanh, atanh) +__inline_mathop (__ieee754_acos, acos,) +__inline_mathop (__ieee754_asin, asin,) +__inline_mathop (__ieee754_cosh, cosh,) +__inline_mathop (__ieee754_sinh, sinh,) +__inline_mathop (__ieee754_exp, etox,) +__inline_mathop (__ieee754_exp2, twotox,) +__inline_mathop (__ieee754_exp10, tentox,) +__inline_mathop (__ieee754_log10, log10,) +__inline_mathop (__ieee754_log2, log2,) +__inline_mathop (__ieee754_log, logn,) +__inline_mathop (__ieee754_sqrt, sqrt,) +__inline_mathop (__ieee754_atanh, atanh,) -__m81_defun (double, __ieee754_remainder, (double __x, double __y)) +__m81_defun (double, __ieee754_remainder, (double __x, double __y),) { double __result; __asm ("frem%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x)); return __result; } -__m81_defun (float, __ieee754_remainderf, (float __x, float __y)) +__m81_defun (float, __ieee754_remainderf, (float __x, float __y),) { float __result; __asm ("frem%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x)); @@ -48,21 +48,21 @@ __m81_defun (float, __ieee754_remainderf, (float __x, float __y)) } __m81_defun (long double, - __ieee754_remainderl, (long double __x, long double __y)) + __ieee754_remainderl, (long double __x, long double __y),) { long double __result; __asm ("frem%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x)); return __result; } -__m81_defun (double, __ieee754_fmod, (double __x, double __y)) +__m81_defun (double, __ieee754_fmod, (double __x, double __y),) { double __result; __asm ("fmod%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x)); return __result; } -__m81_defun (float, __ieee754_fmodf, (float __x, float __y)) +__m81_defun (float, __ieee754_fmodf, (float __x, float __y),) { float __result; __asm ("fmod%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x)); @@ -70,7 +70,7 @@ __m81_defun (float, __ieee754_fmodf, (float __x, float __y)) } __m81_defun (long double, - __ieee754_fmodl, (long double __x, long double __y)) + __ieee754_fmodl, (long double __x, long double __y),) { long double __result; __asm ("fmod%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x)); |