[Tux3] [PATCH 01/10] Add more gcc warning flags

OGAWA Hirofumi hirofumi at mail.parknet.co.jp
Fri Oct 17 02:43:37 PDT 2008



---

 user/test/Makefile |    3 +++
 user/test/balloc.c |    4 ++--
 user/test/dleaf.c  |    4 ++--
 user/test/trace.h  |    4 ++--
 4 files changed, 9 insertions(+), 6 deletions(-)

diff -puN user/test/Makefile~debug-warning user/test/Makefile
--- tux3/user/test/Makefile~debug-warning	2008-10-16 01:20:40.000000000 +0900
+++ tux3-hirofumi/user/test/Makefile	2008-10-17 08:37:40.000000000 +0900
@@ -1,4 +1,7 @@
 CC=gcc -std=gnu99 -Wall -g -D_FILE_OFFSET_BITS=64
+CC += -Werror -Wall -Wextra
+CC += -Wno-unused-parameter -Wno-sign-compare -Wno-missing-field-initializers
+
 VG=valgrind --error-exitcode=200 --leak-check=full
 
 binaries = vfs.o balloc dleaf ileaf iattr xattr btree dir filemap inode tux3
diff -puN user/test/balloc.c~debug-warning user/test/balloc.c
--- tux3/user/test/balloc.c~debug-warning	2008-10-16 01:20:40.000000000 +0900
+++ tux3-hirofumi/user/test/balloc.c	2008-10-16 01:20:40.000000000 +0900
@@ -334,7 +334,7 @@ int main(int argc, char *argv[])
 	}
 	for (int i = 0; i < 12; i++) {
 		block_t block = balloc_from_range(bitmap, 121, 10);
-		printf("%Li\n", block);
+		printf("%Li\n", (L)block);
 	}
 	hexdump(getblk(map, 0)->data, dumpsize);
 	hexdump(getblk(map, 1)->data, dumpsize);
@@ -351,7 +351,7 @@ int main(int argc, char *argv[])
 	hexdump(getblk(map, 2)->data, dumpsize);
 
 	bitmap_dump(bitmap, 0, sb->super.volblocks);
-	printf("%Li used, %Li free\n", count_range(bitmap, 0, sb->super.volblocks), sb->freeblocks);
+	printf("%Li used, %Li free\n", (L)count_range(bitmap, 0, sb->super.volblocks), (L)sb->freeblocks);
 	bfree(sb, 0x7e);
 	bfree(sb, 0x80);
 	bitmap_dump(bitmap, 0, sb->super.volblocks);
diff -puN user/test/dleaf.c~debug-warning user/test/dleaf.c
--- tux3/user/test/dleaf.c~debug-warning	2008-10-16 01:20:40.000000000 +0900
+++ tux3-hirofumi/user/test/dleaf.c	2008-10-17 08:38:49.000000000 +0900
@@ -416,8 +416,8 @@ int dwalk_mock(struct dwalk *walk, tuxke
 
 int dwalk_pack(struct dwalk *walk, tuxkey_t index, struct extent extent)
 {
-	printf("group %i/%i ", walk->gstop + walk->leaf->groups - 1 - walk->group, walk->leaf->groups);
-	//printf("at entry %i/%i\n", walk->estop + walk->group->count - 1 - walk->entry, walk->group->count);
+	printf("group %ti/%i ", walk->gstop + walk->leaf->groups - 1 - walk->group, walk->leaf->groups);
+	//printf("at entry %ti/%i\n", walk->estop + walk->group->count - 1 - walk->entry, walk->group->count);
 	if (!walk->leaf->groups || walk->entry == walk->estop || dwalk_index(walk) != index) {
 		trace("add entry 0x%Lx", (L)index);
 		unsigned keylo = index & 0xffffff, keyhi = index >> 24;
diff -puN user/test/trace.h~debug-warning user/test/trace.h
--- tux3/user/test/trace.h~debug-warning	2008-10-16 01:20:40.000000000 +0900
+++ tux3-hirofumi/user/test/trace.h	2008-10-16 01:20:40.000000000 +0900
@@ -23,7 +23,7 @@ static inline void logline(const char *c
 #define error(string, args...) ({ warn(string "!", ##args); die(99); 1; })
 #define assert(expr) do { if (!(expr)) error("Failed assertion \"%s\"", #expr); } while (0)
 #define warn(string, args...) do { logline(__func__, string, ##args); } while (0)
-#define trace_off(...)
-#define trace_on warn
+#define trace_off(...) do {} while (0)
+#define trace_on(fmt, args...) warn(fmt, ## args)
 
 #endif
_

_______________________________________________
Tux3 mailing list
Tux3 at tux3.org
http://tux3.org/cgi-bin/mailman/listinfo/tux3



More information about the Tux3 mailing list