Add casts and L suffixes to libc quad support, to work around various
-Werror warnings from clang 10.0.0, such as: lib/libc/quad/fixdfdi.c:57:12: error: implicit conversion from 'long long' to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Werror,-Wimplicit-int-float-conversion] if (x >= QUAD_MAX) ~~ ^~~~~~~~ /usr/obj/usr/src/powerpc.powerpc/tmp/usr/include/sys/limits.h:89:19: note: expanded from macro 'QUAD_MAX' #define QUAD_MAX (__QUAD_MAX) /* max value for a quad_t */ ^~~~~~~~~~ /usr/obj/usr/src/powerpc.powerpc/tmp/usr/include/machine/_limits.h:91:20: note: expanded from macro '__QUAD_MAX' #define __QUAD_MAX __LLONG_MAX /* max value for a quad_t */ ^~~~~~~~~~~ /usr/obj/usr/src/powerpc.powerpc/tmp/usr/include/machine/_limits.h:75:21: note: expanded from macro '__LLONG_MAX' #define __LLONG_MAX 0x7fffffffffffffffLL /* max value for a long long */ ^~~~~~~~~~~~~~~~~~~~ and many instances of: lib/libc/quad/fixunsdfdi.c:73:17: error: shift count >= width of type [-Werror,-Wshift-count-overflow] toppart = (x - ONE_HALF) / ONE; ^~~~~~~~ lib/libc/quad/fixunsdfdi.c:45:19: note: expanded from macro 'ONE_HALF' #define ONE_HALF (ONE_FOURTH * 2.0) ^~~~~~~~~~ lib/libc/quad/fixunsdfdi.c:44:23: note: expanded from macro 'ONE_FOURTH' #define ONE_FOURTH (1 << (LONG_BITS - 2)) ^ ~~~~~~~~~~~~~~~ lib/libc/quad/fixunsdfdi.c:73:29: error: shift count >= width of type [-Werror,-Wshift-count-overflow] toppart = (x - ONE_HALF) / ONE; ^~~ lib/libc/quad/fixunsdfdi.c:46:15: note: expanded from macro 'ONE' #define ONE (ONE_FOURTH * 4.0) ^~~~~~~~~~ lib/libc/quad/fixunsdfdi.c:44:23: note: expanded from macro 'ONE_FOURTH' #define ONE_FOURTH (1 << (LONG_BITS - 2)) ^ ~~~~~~~~~~~~~~~
This commit is contained in:
parent
816dab96c1
commit
feb1d5507e
@ -49,12 +49,12 @@ quad_t
|
||||
__fixdfdi(double x)
|
||||
{
|
||||
if (x < 0)
|
||||
if (x <= QUAD_MIN)
|
||||
if (x <= (double)QUAD_MIN)
|
||||
return (QUAD_MIN);
|
||||
else
|
||||
return ((quad_t)-(u_quad_t)-x);
|
||||
else
|
||||
if (x >= QUAD_MAX)
|
||||
if (x >= (double)QUAD_MAX)
|
||||
return (QUAD_MAX);
|
||||
else
|
||||
return ((quad_t)(u_quad_t)x);
|
||||
|
@ -51,12 +51,12 @@ long long
|
||||
__fixsfdi(float x)
|
||||
{
|
||||
if (x < 0)
|
||||
if (x <= QUAD_MIN)
|
||||
if (x <= (float)QUAD_MIN)
|
||||
return (QUAD_MIN);
|
||||
else
|
||||
return ((quad_t)-(u_quad_t)-x);
|
||||
else
|
||||
if (x >= QUAD_MAX)
|
||||
if (x >= (float)QUAD_MAX)
|
||||
return (QUAD_MAX);
|
||||
else
|
||||
return ((quad_t)(u_quad_t)x);
|
||||
|
@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include "quad.h"
|
||||
|
||||
#define ONE_FOURTH (1 << (LONG_BITS - 2))
|
||||
#define ONE_FOURTH (1L << (LONG_BITS - 2))
|
||||
#define ONE_HALF (ONE_FOURTH * 2.0)
|
||||
#define ONE (ONE_FOURTH * 4.0)
|
||||
|
||||
@ -84,11 +84,11 @@ __fixunsdfdi(double x)
|
||||
x -= (double)t.uq;
|
||||
if (x < 0) {
|
||||
t.ul[H]--;
|
||||
x += ULONG_MAX;
|
||||
x += (double)ULONG_MAX;
|
||||
}
|
||||
if (x > ULONG_MAX) {
|
||||
if (x > (double)ULONG_MAX) {
|
||||
t.ul[H]++;
|
||||
x -= ULONG_MAX;
|
||||
x -= (double)ULONG_MAX;
|
||||
}
|
||||
t.ul[L] = (u_long)x;
|
||||
return (t.uq);
|
||||
|
@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include "quad.h"
|
||||
|
||||
#define ONE_FOURTH (1 << (LONG_BITS - 2))
|
||||
#define ONE_FOURTH (1L << (LONG_BITS - 2))
|
||||
#define ONE_HALF (ONE_FOURTH * 2.0)
|
||||
#define ONE (ONE_FOURTH * 4.0)
|
||||
|
||||
@ -89,11 +89,11 @@ __fixunssfdi(float f)
|
||||
x -= (double)t.uq;
|
||||
if (x < 0) {
|
||||
t.ul[H]--;
|
||||
x += ULONG_MAX;
|
||||
x += (double)ULONG_MAX;
|
||||
}
|
||||
if (x > ULONG_MAX) {
|
||||
if (x > (double)ULONG_MAX) {
|
||||
t.ul[H]++;
|
||||
x -= ULONG_MAX;
|
||||
x -= (double)ULONG_MAX;
|
||||
}
|
||||
t.ul[L] = (u_long)x;
|
||||
return (t.uq);
|
||||
|
@ -66,7 +66,7 @@ __floatdidf(quad_t x)
|
||||
* code and does not know how to get at an exponent. Machine-
|
||||
* specific code may be able to do this more efficiently.
|
||||
*/
|
||||
d = (double)u.ul[H] * ((1 << (LONG_BITS - 2)) * 4.0);
|
||||
d = (double)u.ul[H] * ((1L << (LONG_BITS - 2)) * 4.0);
|
||||
d += u.ul[L];
|
||||
|
||||
return (neg ? -d : d);
|
||||
|
@ -68,7 +68,7 @@ __floatdisf(quad_t x)
|
||||
*
|
||||
* Using double here may be excessive paranoia.
|
||||
*/
|
||||
f = (double)u.ul[H] * ((1 << (LONG_BITS - 2)) * 4.0);
|
||||
f = (double)u.ul[H] * ((1L << (LONG_BITS - 2)) * 4.0);
|
||||
f += u.ul[L];
|
||||
|
||||
return (neg ? -f : f);
|
||||
|
@ -52,7 +52,7 @@ __floatunsdidf(u_quad_t x)
|
||||
union uu u;
|
||||
|
||||
u.uq = x;
|
||||
d = (double)u.ul[H] * ((1 << (LONG_BITS - 2)) * 4.0);
|
||||
d = (double)u.ul[H] * ((1L << (LONG_BITS - 2)) * 4.0);
|
||||
d += u.ul[L];
|
||||
return (d);
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include "quad.h"
|
||||
|
||||
#define B (1 << HALF_BITS) /* digit base */
|
||||
#define B (1L << HALF_BITS) /* digit base */
|
||||
|
||||
/* Combine two `digits' to make a single two-digit number. */
|
||||
#define COMBINE(a, b) (((u_long)(a) << HALF_BITS) | (b))
|
||||
|
@ -91,7 +91,7 @@ union uu {
|
||||
* (sizeof(long)*CHAR_BIT/2).
|
||||
*/
|
||||
#define HHALF(x) ((x) >> HALF_BITS)
|
||||
#define LHALF(x) ((x) & ((1 << HALF_BITS) - 1))
|
||||
#define LHALF(x) ((x) & ((1L << HALF_BITS) - 1))
|
||||
#define LHUP(x) ((x) << HALF_BITS)
|
||||
|
||||
int __cmpdi2(quad_t a, quad_t b);
|
||||
|
Loading…
Reference in New Issue
Block a user