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:
Justine Tunney 2023-09-01 20:49:13 -07:00
parent e2b3c3618e
commit 0d748ad58e
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
571 changed files with 1306 additions and 1888 deletions

View file

@ -68,8 +68,8 @@ void *TortureWorker(void *arg) {
}
TEST(getrandom, test) {
int i, n = 999;
double e, w = 7.7;
int i, j, n = 999;
char *buf = _gc(calloc(1, n));
ASSERT_SYS(0, 0, getrandom(0, 0, 0));
ASSERT_SYS(0, n, getrandom(buf, n, 0));
@ -91,7 +91,7 @@ TEST(getrandom, test2) {
pthread_t child;
double e, w = 7.7;
struct sigaction sa;
int i, j, k, m, n = 999;
int i, k, m, n = 999;
char *buf = _gc(calloc(1, n));
sa.sa_flags = 0;
sa.sa_handler = OnSig;
@ -307,7 +307,7 @@ static const struct RandomFunction {
TEST(getrandom, sanityTest) {
uint64_t q;
size_t i, j, k;
double montepi, chip, scc, mean, chisq, ent;
double montepi, scc, mean, chisq, ent;
for (k = 0; k < 1; ++k) {
for (j = 0; j < ARRAYLEN(kRandomFunctions); ++j) {
rt_init(0);
@ -316,8 +316,8 @@ TEST(getrandom, sanityTest) {
rt_add(&q, 8);
}
rt_end(&ent, &chisq, &mean, &montepi, &scc);
chip = pochisq(chisq, 255);
#if 0
double chip = pochisq(chisq, 255);
fprintf(stderr, "\n");
fprintf(stderr, "/* %-32s */\n", kRandomFunctions[j].s);
fprintf(stderr, "/* entropy: %-12g */\n", ent);