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

@ -398,7 +398,7 @@ static int __fmt_stoa(int out(const char *, void *, size_t), void *arg,
unsigned n;
emit_f emit;
char *p, buf[1];
unsigned w, c, pad;
unsigned w, pad;
bool justdobytes, ignorenul;
p = data;
@ -604,7 +604,7 @@ static void __fmt_ldfpbits(union U *u, struct FPBits *b) {
// returns number of hex digits minus 1, or 0 for zero
static int __fmt_fpiprec(struct FPBits *b) {
FPI *fpi;
const FPI *fpi;
int i, j, k, m;
uint32_t *bits;
if (b->kind == STRTOG_Zero) return (b->ex = 0);
@ -794,10 +794,10 @@ int __fmt(void *fn, void *arg, const char *format, va_list va) {
wchar_t charbuf[1];
const char *alphabet;
unsigned char signbit, log2base;
int c, k, i1, bw, rc, bex, prec1, decpt;
int (*out)(const char *, void *, size_t);
char *se, *s0, *s, *q, qchar, special[8];
int d, w, n, sign, prec, flags, width, lasterr;
int c, k, i1, ui, bw, rc, bex, sgn, prec1, decpt;
x = 0;
lasterr = errno;
@ -852,7 +852,7 @@ int __fmt(void *fn, void *arg, const char *format, va_list va) {
continue;
} else if (format[1] == '.' && format[2] == '*' && format[3] == 's') {
n = va_arg(va, unsigned); // FAST PATH: PRECISION STRING
s = va_arg(va, const char *);
const char *s = va_arg(va, const char *);
if (s) {
n = strnlen(s, n);
} else {