mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-22 21:32:31 +00:00
Fix warnings
This change fixes Cosmopolitan so it has fewer opinions about compiler warnings. The whole repository had to be cleaned up to be buildable in -Werror -Wall mode. This lets us benefit from things like strict const checking. Some actual bugs might have been caught too.
This commit is contained in:
parent
e2b3c3618e
commit
0d748ad58e
571 changed files with 1306 additions and 1888 deletions
|
@ -110,7 +110,7 @@ double acos(double x)
|
|||
/* |x| >= 1 or nan */
|
||||
if (ix >= 0x3ff00000) {
|
||||
lx = u.i;
|
||||
if ((ix-0x3ff00000 | lx) == 0) {
|
||||
if (((ix-0x3ff00000) | lx) == 0) {
|
||||
/* acos(1)=0, acos(-1)=pi */
|
||||
if (hx >> 31)
|
||||
return 2*pio2_hi + 0x1p-120f;
|
||||
|
|
|
@ -119,7 +119,7 @@ double asin(double x)
|
|||
/* |x| >= 1 or nan */
|
||||
if (ix >= 0x3ff00000) {
|
||||
lx = u.i;
|
||||
if (!(ix-0x3ff00000 | lx))
|
||||
if (!((ix-0x3ff00000) | lx))
|
||||
/* asin(1) = +-pi/2 with inexact */
|
||||
return x*pio2_hi + 0x1p-120f;
|
||||
return 0/(x-x);
|
||||
|
|
|
@ -43,7 +43,6 @@ asm(".include \"libc/disclaimer.inc\"");
|
|||
#elif FLT_EVAL_METHOD==2
|
||||
#define EPS LDBL_EPSILON
|
||||
#endif
|
||||
static const double_t toint = 1/EPS;
|
||||
|
||||
/**
|
||||
* Returns smallest integral value not less than 𝑥.
|
||||
|
@ -74,6 +73,7 @@ double ceil(double x)
|
|||
|
||||
#else
|
||||
|
||||
static const double_t toint = 1/EPS;
|
||||
union {double f; uint64_t i;} u = {x};
|
||||
int e = u.i >> 52 & 0x7ff;
|
||||
double_t y;
|
||||
|
|
|
@ -5,14 +5,17 @@ COSMOPOLITAN_C_START_
|
|||
|
||||
static inline void fevalf(float x) {
|
||||
volatile float y = x;
|
||||
(void)y;
|
||||
}
|
||||
|
||||
static inline void feval(double x) {
|
||||
volatile double y = x;
|
||||
(void)y;
|
||||
}
|
||||
|
||||
static inline void fevall(long double x) {
|
||||
volatile long double y = x;
|
||||
(void)y;
|
||||
}
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
|
|
|
@ -43,7 +43,6 @@ asm(".include \"libc/disclaimer.inc\"");
|
|||
#elif FLT_EVAL_METHOD==2
|
||||
#define EPS LDBL_EPSILON
|
||||
#endif
|
||||
static const double_t toint = 1/EPS;
|
||||
|
||||
/**
|
||||
* Returns largest integral value not greater than 𝑥.
|
||||
|
@ -74,6 +73,7 @@ double floor(double x)
|
|||
|
||||
#else
|
||||
|
||||
static const double_t toint = 1/EPS;
|
||||
union {double f; uint64_t i;} u = {x};
|
||||
int e = u.i >> 52 & 0x7ff;
|
||||
double_t y;
|
||||
|
|
|
@ -154,7 +154,7 @@ double fma(double x, double y, double z)
|
|||
if (d > 0) {
|
||||
if (d < 64) {
|
||||
zlo = nz.m<<d;
|
||||
zhi = nz.m>>64-d;
|
||||
zhi = nz.m>>(64-d);
|
||||
} else {
|
||||
zlo = 0;
|
||||
zhi = nz.m;
|
||||
|
@ -162,7 +162,7 @@ double fma(double x, double y, double z)
|
|||
d -= 64;
|
||||
if (d == 0) {
|
||||
} else if (d < 64) {
|
||||
rlo = rhi<<64-d | rlo>>d | !!(rlo<<64-d);
|
||||
rlo = rhi<<(64-d) | rlo>>d | !!(rlo<<(64-d));
|
||||
rhi = rhi>>d;
|
||||
} else {
|
||||
rlo = 1;
|
||||
|
@ -175,7 +175,7 @@ double fma(double x, double y, double z)
|
|||
if (d == 0) {
|
||||
zlo = nz.m;
|
||||
} else if (d < 64) {
|
||||
zlo = nz.m>>d | !!(nz.m<<64-d);
|
||||
zlo = nz.m>>d | !!(nz.m<<(64-d));
|
||||
} else {
|
||||
zlo = 1;
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ double fma(double x, double y, double z)
|
|||
e += 64;
|
||||
d = a_clz_64(rhi)-1;
|
||||
/* note: d > 0 */
|
||||
rhi = rhi<<d | rlo>>64-d | !!(rlo<<d);
|
||||
rhi = rhi<<d | rlo>>(64-d) | !!(rlo<<d);
|
||||
} else if (rlo) {
|
||||
d = a_clz_64(rlo)-1;
|
||||
if (d < 0)
|
||||
|
@ -258,7 +258,7 @@ double fma(double x, double y, double z)
|
|||
} else {
|
||||
/* only round once when scaled */
|
||||
d = 10;
|
||||
i = ( rhi>>d | !!(rhi<<64-d) ) << d;
|
||||
i = ( rhi>>d | !!(rhi<<(64-d)) ) << d;
|
||||
if (sign)
|
||||
i = -i;
|
||||
r = i;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue