Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/littlefs-project/littlefs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-06-08 04:24:27 +0300
committerChristopher Haster <chaster@utexas.edu>2018-07-02 18:29:19 +0300
commit51346b8bf4146cc145c2cefce9928b03fa9f4c8c (patch)
treef6088a3d7de73fc903bfa9762c0aca9f911ec59c
parent93a2e0bbe53e741f468bd84e75a2f894aa6158e3 (diff)
Fixed shadowed variable warnings
- Fixed shadowed variable warnings in lfs_dir_find. - Fixed unused parameter warnings when LFS_NO_MALLOC is enabled. - Added extra warning flags to CFLAGS. - Updated tests so they don't shadow the "size" variable for -Wshadow
-rw-r--r--Makefile2
-rw-r--r--lfs.c2
-rw-r--r--lfs_util.h3
-rwxr-xr-xtests/test_files.sh4
-rwxr-xr-xtests/test_seek.sh8
5 files changed, 11 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index c093313..8457c5f 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@ ifdef WORD
override CFLAGS += -m$(WORD)
endif
override CFLAGS += -I.
-override CFLAGS += -std=c99 -Wall -pedantic
+override CFLAGS += -std=c99 -Wall -pedantic -Wshadow -Wunused-parameter
all: $(TARGET)
diff --git a/lfs.c b/lfs.c
index b169389..55446b5 100644
--- a/lfs.c
+++ b/lfs.c
@@ -836,7 +836,7 @@ nextname:
// find entry matching name
while (true) {
- int err = lfs_dir_next(lfs, dir, entry);
+ err = lfs_dir_next(lfs, dir, entry);
if (err) {
return err;
}
diff --git a/lfs_util.h b/lfs_util.h
index 51005dc..d61c545 100644
--- a/lfs_util.h
+++ b/lfs_util.h
@@ -158,6 +158,7 @@ static inline void *lfs_malloc(size_t size) {
#ifndef LFS_NO_MALLOC
return malloc(size);
#else
+ (void)size;
return NULL;
#endif
}
@@ -166,6 +167,8 @@ static inline void *lfs_malloc(size_t size) {
static inline void lfs_free(void *p) {
#ifndef LFS_NO_MALLOC
free(p);
+#else
+ (void)p;
#endif
}
diff --git a/tests/test_files.sh b/tests/test_files.sh
index b2039a7..bbecea9 100755
--- a/tests/test_files.sh
+++ b/tests/test_files.sh
@@ -30,7 +30,7 @@ TEST
w_test() {
tests/test.py << TEST
- lfs_size_t size = $1;
+ size = $1;
lfs_size_t chunk = 31;
srand(0);
lfs_mount(&lfs, &cfg) => 0;
@@ -50,7 +50,7 @@ TEST
r_test() {
tests/test.py << TEST
- lfs_size_t size = $1;
+ size = $1;
lfs_size_t chunk = 29;
srand(0);
lfs_mount(&lfs, &cfg) => 0;
diff --git a/tests/test_seek.sh b/tests/test_seek.sh
index 3b46892..0084d42 100755
--- a/tests/test_seek.sh
+++ b/tests/test_seek.sh
@@ -153,7 +153,7 @@ tests/test.py << TEST
lfs_file_read(&lfs, &file[0], buffer, size) => size;
memcmp(buffer, "kittycatcat", size) => 0;
- lfs_size_t size = lfs_file_size(&lfs, &file[0]);
+ size = lfs_file_size(&lfs, &file[0]);
lfs_file_seek(&lfs, &file[0], 0, LFS_SEEK_CUR) => size;
lfs_file_close(&lfs, &file[0]) => 0;
@@ -202,7 +202,7 @@ tests/test.py << TEST
lfs_file_read(&lfs, &file[0], buffer, size) => size;
memcmp(buffer, "kittycatcat", size) => 0;
- lfs_size_t size = lfs_file_size(&lfs, &file[0]);
+ size = lfs_file_size(&lfs, &file[0]);
lfs_file_seek(&lfs, &file[0], 0, LFS_SEEK_CUR) => size;
lfs_file_close(&lfs, &file[0]) => 0;
@@ -243,7 +243,7 @@ tests/test.py << TEST
lfs_file_read(&lfs, &file[0], buffer, size) => size;
memcmp(buffer, "kittycatcat", size) => 0;
- lfs_size_t size = lfs_file_size(&lfs, &file[0]);
+ size = lfs_file_size(&lfs, &file[0]);
lfs_file_seek(&lfs, &file[0], 0, LFS_SEEK_CUR) => size;
lfs_file_close(&lfs, &file[0]) => 0;
@@ -286,7 +286,7 @@ tests/test.py << TEST
lfs_file_read(&lfs, &file[0], buffer, size) => size;
memcmp(buffer, "kittycatcat", size) => 0;
- lfs_size_t size = lfs_file_size(&lfs, &file[0]);
+ size = lfs_file_size(&lfs, &file[0]);
lfs_file_seek(&lfs, &file[0], 0, LFS_SEEK_CUR) => size;
lfs_file_close(&lfs, &file[0]) => 0;