Added -Wjump-misses-init and fixed uninitialized warnings

This commit is contained in:
Christopher Haster
2018-09-26 10:11:40 -05:00
parent 1b7a15599e
commit 646b1b5a6c
2 changed files with 117 additions and 110 deletions

View File

@@ -25,7 +25,8 @@ ifdef WORD
override CFLAGS += -m$(WORD)
endif
override CFLAGS += -I.
override CFLAGS += -std=c99 -Wall -pedantic -Wshadow -Wunused-parameter
override CFLAGS += -std=c99 -Wall -pedantic
override CFLAGS += -Wshadow -Wunused-parameter -Wjump-misses-init
all: $(TARGET)

10
lfs.c
View File

@@ -2096,7 +2096,9 @@ cleanup:
}
int lfs_format(lfs_t *lfs, const struct lfs_config *cfg) {
int err = lfs_init(lfs, cfg);
int err = 0;
if (true) {
err = lfs_init(lfs, cfg);
if (err) {
return err;
}
@@ -2173,6 +2175,7 @@ int lfs_format(lfs_t *lfs, const struct lfs_config *cfg) {
}
lfs_alloc_ack(lfs);
}
cleanup:
lfs_deinit(lfs);
@@ -2180,7 +2183,9 @@ cleanup:
}
int lfs_mount(lfs_t *lfs, const struct lfs_config *cfg) {
int err = lfs_init(lfs, cfg);
int err = 0;
if (true) {
err = lfs_init(lfs, cfg);
if (err) {
return err;
}
@@ -2227,6 +2232,7 @@ int lfs_mount(lfs_t *lfs, const struct lfs_config *cfg) {
}
return 0;
}
cleanup: