Skip to content

Commit 51a30c6

Browse files
committed
Enabled -Wextra
This only required adding NULLs where commit statements were not fully initialized. Unfortunately we still need -Wno-missing-field-initializers because of a bug in GCC that persists on Travis. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60784 Found by apmorton
1 parent a064479 commit 51a30c6

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ override CFLAGS += -m$(WORD)
2626
endif
2727
override CFLAGS += -I.
2828
override CFLAGS += -std=c99 -Wall -pedantic
29-
override CFLAGS += -Wshadow -Wunused-parameter -Wjump-misses-init -Wsign-compare
29+
override CFLAGS += -Wextra -Wshadow -Wjump-misses-init
30+
# Remove missing-field-initializers because of GCC bug
31+
override CFLAGS += -Wno-missing-field-initializers
3032

3133

3234
all: $(TARGET)

lfs.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1889,7 +1889,7 @@ int lfs_mkdir(lfs_t *lfs, const char *path) {
18891889
// now insert into our parent block
18901890
lfs_pair_tole32(dir.pair);
18911891
err = lfs_dir_commit(lfs, &cwd, LFS_MKATTRS(
1892-
{LFS_MKTAG(LFS_TYPE_CREATE, id, 0)},
1892+
{LFS_MKTAG(LFS_TYPE_CREATE, id, 0), NULL},
18931893
{LFS_MKTAG(LFS_TYPE_DIR, id, nlen), path},
18941894
{LFS_MKTAG(LFS_TYPE_DIRSTRUCT, id, 8), dir.pair},
18951895
{!cwd.split
@@ -2296,9 +2296,9 @@ int lfs_file_opencfg(lfs_t *lfs, lfs_file_t *file,
22962296

22972297
// get next slot and create entry to remember name
22982298
err = lfs_dir_commit(lfs, &file->m, LFS_MKATTRS(
2299-
{LFS_MKTAG(LFS_TYPE_CREATE, file->id, 0)},
2299+
{LFS_MKTAG(LFS_TYPE_CREATE, file->id, 0), NULL},
23002300
{LFS_MKTAG(LFS_TYPE_REG, file->id, nlen), path},
2301-
{LFS_MKTAG(LFS_TYPE_INLINESTRUCT, file->id, 0)}));
2301+
{LFS_MKTAG(LFS_TYPE_INLINESTRUCT, file->id, 0), NULL}));
23022302
if (err) {
23032303
err = LFS_ERR_NAMETOOLONG;
23042304
goto cleanup;
@@ -2975,7 +2975,7 @@ int lfs_remove(lfs_t *lfs, const char *path) {
29752975

29762976
// delete the entry
29772977
err = lfs_dir_commit(lfs, &cwd, LFS_MKATTRS(
2978-
{LFS_MKTAG(LFS_TYPE_DELETE, lfs_tag_id(tag), 0)}));
2978+
{LFS_MKTAG(LFS_TYPE_DELETE, lfs_tag_id(tag), 0), NULL}));
29792979
if (err) {
29802980
return err;
29812981
}
@@ -3070,8 +3070,8 @@ int lfs_rename(lfs_t *lfs, const char *oldpath, const char *newpath) {
30703070
err = lfs_dir_commit(lfs, &newcwd, LFS_MKATTRS(
30713071
{prevtag != LFS_ERR_NOENT
30723072
? LFS_MKTAG(LFS_TYPE_DELETE, newid, 0)
3073-
: LFS_MKTAG(LFS_FROM_NOOP, 0, 0)},
3074-
{LFS_MKTAG(LFS_TYPE_CREATE, newid, 0)},
3073+
: LFS_MKTAG(LFS_FROM_NOOP, 0, 0), NULL},
3074+
{LFS_MKTAG(LFS_TYPE_CREATE, newid, 0), NULL},
30753075
{LFS_MKTAG(lfs_tag_type3(oldtag), newid, strlen(newpath)),
30763076
newpath},
30773077
{LFS_MKTAG(LFS_FROM_MOVE, newid, lfs_tag_id(oldtag)), &oldcwd}));
@@ -3318,7 +3318,7 @@ int lfs_format(lfs_t *lfs, const struct lfs_config *cfg) {
33183318

33193319
lfs_superblock_tole32(&superblock);
33203320
err = lfs_dir_commit(lfs, &root, LFS_MKATTRS(
3321-
{LFS_MKTAG(LFS_TYPE_CREATE, 0, 0)},
3321+
{LFS_MKTAG(LFS_TYPE_CREATE, 0, 0), NULL},
33223322
{LFS_MKTAG(LFS_TYPE_SUPERBLOCK, 0, 8), "littlefs"},
33233323
{LFS_MKTAG(LFS_TYPE_INLINESTRUCT, 0, sizeof(superblock)),
33243324
&superblock}));

0 commit comments

Comments
 (0)