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

@ -95,7 +95,6 @@ static wontreturn void UnsupportedSyntax(unsigned char c) {
}
static void Open(const char *path, int fd, int flags) {
const char *err;
close(fd);
if (open(path, flags, 0644) == -1) {
perror(path);
@ -118,7 +117,7 @@ static int GetSignalByName(const char *s) {
return 0;
}
static void PutEnv(char **p, const char *kv) {
static void PutEnv(char **p, char *kv) {
struct Env e;
e = __getenv(p, kv);
p[e.i] = kv;
@ -182,7 +181,6 @@ static int Waiter(int pid) {
}
static int Wait(void) {
char ibuf[12];
int e, ws, pid;
if (n > 1) {
if ((pid = atoi(args[1])) <= 0) {
@ -719,7 +717,7 @@ static void Pipe(void) {
}
static int ShellSpawn(void) {
int rc, ws, pid;
int rc, pid;
if ((rc = TryBuiltin()) == -1) {
switch ((pid = fork())) {
case 0:
@ -804,8 +802,7 @@ static bool CopyVar(void) {
}
static char *Tokenize(void) {
const char *s;
int c, t, j, k, rc;
int c, t, rc;
for (t = STATE_WHITESPACE;; ++p) {
switch (t) {
@ -954,8 +951,8 @@ static const char *GetRedirectArg(const char *prog, const char *arg, int n) {
}
int _cocmd(int argc, char **argv, char **envp) {
size_t i;
char *arg;
size_t i, j;
size_t globCount = 0;
int globFlags = 0;
glob_t globTheBuilder;