diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-05-18 22:28:26 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-05-18 22:28:26 +0000 |
commit | 5599502a550a7f892d4b73dceb2105a6916f83e6 (patch) | |
tree | 572ffa27892b1b24db86930044077dbb1565840f | |
parent | e125a683a77d14401644d15f38b7f578db723924 (diff) | |
download | busybox-w32-5599502a550a7f892d4b73dceb2105a6916f83e6.tar.gz busybox-w32-5599502a550a7f892d4b73dceb2105a6916f83e6.tar.bz2 busybox-w32-5599502a550a7f892d4b73dceb2105a6916f83e6.zip |
more -Wall warning fixes. -Wall is enabled now.
-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | Makefile.flags | 10 | ||||
-rw-r--r-- | coreutils/cksum.c | 2 | ||||
-rw-r--r-- | editors/vi.c | 4 | ||||
-rw-r--r-- | include/libbb.h | 2 | ||||
-rw-r--r-- | libbb/appletlib.c | 4 | ||||
-rw-r--r-- | libbb/lineedit.c | 4 | ||||
-rw-r--r-- | libbb/xfuncs.c | 2 | ||||
-rw-r--r-- | networking/telnet.c | 2 | ||||
-rw-r--r-- | networking/tftp.c | 12 | ||||
-rw-r--r-- | networking/wget.c | 4 | ||||
-rw-r--r-- | procps/top.c | 5 | ||||
-rw-r--r-- | procps/watch.c | 8 | ||||
-rw-r--r-- | util-linux/more.c | 4 |
14 files changed, 34 insertions, 35 deletions
@@ -498,12 +498,6 @@ all: busybox | |||
498 | #bbox# NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) | 498 | #bbox# NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) |
499 | CHECKFLAGS += $(NOSTDINC_FLAGS) | 499 | CHECKFLAGS += $(NOSTDINC_FLAGS) |
500 | 500 | ||
501 | # warn about C99 declaration after statement | ||
502 | CFLAGS += $(call cc-option,-Wdeclaration-after-statement,) | ||
503 | |||
504 | # disable pointer signedness warnings in gcc 4.0 | ||
505 | CFLAGS += $(call cc-option,-Wno-pointer-sign,) | ||
506 | |||
507 | # Default kernel image to build when no specific target is given. | 501 | # Default kernel image to build when no specific target is given. |
508 | # KBUILD_IMAGE may be overruled on the commandline or | 502 | # KBUILD_IMAGE may be overruled on the commandline or |
509 | # set in the environment | 503 | # set in the environment |
diff --git a/Makefile.flags b/Makefile.flags index 3889df09b..9525889c6 100644 --- a/Makefile.flags +++ b/Makefile.flags | |||
@@ -17,11 +17,15 @@ CPPFLAGS += \ | |||
17 | $(if $(CONFIG_LFS),-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64) \ | 17 | $(if $(CONFIG_LFS),-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64) \ |
18 | -D"BB_VER=KBUILD_STR($(BB_VER))" -DBB_BT=AUTOCONF_TIMESTAMP | 18 | -D"BB_VER=KBUILD_STR($(BB_VER))" -DBB_BT=AUTOCONF_TIMESTAMP |
19 | 19 | ||
20 | # flag checks are grouped together to speed the checks up a bit.. | 20 | CFLAGS += $(call cc-option,-Wall,) |
21 | CFLAGS += $(call cc-option,-Wall -Wshadow -Wwrite-strings,) | 21 | CFLAGS += $(call cc-option,-Wshadow,) |
22 | CFLAGS += $(call cc-option,-Wundef -Wstrict-prototypes,) | 22 | CFLAGS += $(call cc-option,-Wwrite-strings,) |
23 | CFLAGS += $(call cc-option,-Wundef,) | ||
24 | CFLAGS += $(call cc-option,-Wstrict-prototypes,) | ||
23 | CFLAGS += $(call cc-option,-Wunused -Wunused-parameter,) | 25 | CFLAGS += $(call cc-option,-Wunused -Wunused-parameter,) |
24 | CFLAGS += $(call cc-option,-Wmissing-prototypes -Wmissing-declarations,) | 26 | CFLAGS += $(call cc-option,-Wmissing-prototypes -Wmissing-declarations,) |
27 | # warn about C99 declaration after statement | ||
28 | CFLAGS += $(call cc-option,-Wdeclaration-after-statement,) | ||
25 | # If you want to add more -Wsomething above, make sure that it is | 29 | # If you want to add more -Wsomething above, make sure that it is |
26 | # still possible to build bbox without warnings. | 30 | # still possible to build bbox without warnings. |
27 | 31 | ||
diff --git a/coreutils/cksum.c b/coreutils/cksum.c index 6512ccc17..074d06811 100644 --- a/coreutils/cksum.c +++ b/coreutils/cksum.c | |||
@@ -34,7 +34,7 @@ int cksum_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
34 | 34 | ||
35 | #define read_buf bb_common_bufsiz1 | 35 | #define read_buf bb_common_bufsiz1 |
36 | while ((bytes_read = safe_read(fd, read_buf, sizeof(read_buf))) > 0) { | 36 | while ((bytes_read = safe_read(fd, read_buf, sizeof(read_buf))) > 0) { |
37 | cp = read_buf; | 37 | cp = (uint8_t *) read_buf; |
38 | length += bytes_read; | 38 | length += bytes_read; |
39 | do { | 39 | do { |
40 | crc = (crc << 8) ^ crc32_table[(crc >> 24) ^ *cp++]; | 40 | crc = (crc << 8) ^ crc32_table[(crc >> 24) ^ *cp++]; |
diff --git a/editors/vi.c b/editors/vi.c index 5013d0d51..dded6edb3 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -136,7 +136,7 @@ static smallint last_file_modified = -1; | |||
136 | static int fn_start; // index of first cmd line file name | 136 | static int fn_start; // index of first cmd line file name |
137 | static int save_argc; // how many file names on cmd line | 137 | static int save_argc; // how many file names on cmd line |
138 | static int cmdcnt; // repetition count | 138 | static int cmdcnt; // repetition count |
139 | static int rows, columns; // the terminal screen is this size | 139 | static unsigned rows, columns; // the terminal screen is this size |
140 | static int crow, ccol; // cursor is on Crow x Ccol | 140 | static int crow, ccol; // cursor is on Crow x Ccol |
141 | static int offset; // chars scrolled off the screen to the left | 141 | static int offset; // chars scrolled off the screen to the left |
142 | static char *status_buffer; // mesages to the user | 142 | static char *status_buffer; // mesages to the user |
@@ -2837,7 +2837,7 @@ static void refresh(int full_screen) | |||
2837 | char *tp, *sp; // pointer into text[] and screen[] | 2837 | char *tp, *sp; // pointer into text[] and screen[] |
2838 | 2838 | ||
2839 | if (ENABLE_FEATURE_VI_WIN_RESIZE) { | 2839 | if (ENABLE_FEATURE_VI_WIN_RESIZE) { |
2840 | int c = columns, r = rows; | 2840 | unsigned c = columns, r = rows; |
2841 | get_terminal_width_height(0, &columns, &rows); | 2841 | get_terminal_width_height(0, &columns, &rows); |
2842 | if (rows > MAX_SCR_ROWS) rows = MAX_SCR_ROWS; | 2842 | if (rows > MAX_SCR_ROWS) rows = MAX_SCR_ROWS; |
2843 | if (columns > MAX_SCR_COLS) columns = MAX_SCR_COLS; | 2843 | if (columns > MAX_SCR_COLS) columns = MAX_SCR_COLS; |
diff --git a/include/libbb.h b/include/libbb.h index 6f41184a9..4067063e6 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -1048,7 +1048,7 @@ extern int update_passwd(const char *filename, const char *username, | |||
1048 | const char *new_pw); | 1048 | const char *new_pw); |
1049 | 1049 | ||
1050 | /* NB: typically you want to pass fd 0, not 1. Think 'applet | grep something' */ | 1050 | /* NB: typically you want to pass fd 0, not 1. Think 'applet | grep something' */ |
1051 | int get_terminal_width_height(int fd, int *width, int *height); | 1051 | int get_terminal_width_height(int fd, unsigned *width, unsigned *height); |
1052 | 1052 | ||
1053 | /* NB: "unsigned request" is crucial! "int request" will break some arches! */ | 1053 | /* NB: "unsigned request" is crucial! "int request" will break some arches! */ |
1054 | int ioctl_or_perror(int fd, unsigned request, void *argp, const char *fmt,...) __attribute__ ((format (printf, 4, 5))); | 1054 | int ioctl_or_perror(int fd, unsigned request, void *argp, const char *fmt,...) __attribute__ ((format (printf, 4, 5))); |
diff --git a/libbb/appletlib.c b/libbb/appletlib.c index 3d5aef873..464280b17 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c | |||
@@ -73,7 +73,7 @@ static const char *unpack_usage_messages(void) | |||
73 | 73 | ||
74 | i = start_bunzip(&bd, | 74 | i = start_bunzip(&bd, |
75 | /* src_fd: */ -1, | 75 | /* src_fd: */ -1, |
76 | /* inbuf: */ packed_usage, | 76 | /* inbuf: */ (void *)packed_usage, |
77 | /* len: */ sizeof(packed_usage)); | 77 | /* len: */ sizeof(packed_usage)); |
78 | /* read_bunzip can longjmp to start_bunzip, and ultimately | 78 | /* read_bunzip can longjmp to start_bunzip, and ultimately |
79 | * end up here with i != 0 on read data errors! Not trivial */ | 79 | * end up here with i != 0 on read data errors! Not trivial */ |
@@ -628,7 +628,7 @@ static int busybox_main(char **argv) | |||
628 | if (!argv[1]) { | 628 | if (!argv[1]) { |
629 | /* Called without arguments */ | 629 | /* Called without arguments */ |
630 | const char *a; | 630 | const char *a; |
631 | int col, output_width; | 631 | unsigned col, output_width; |
632 | help: | 632 | help: |
633 | output_width = 80; | 633 | output_width = 80; |
634 | if (ENABLE_FEATURE_AUTOWIDTH) { | 634 | if (ENABLE_FEATURE_AUTOWIDTH) { |
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 9c802a35f..c91efd40c 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c | |||
@@ -1318,7 +1318,7 @@ static void cmdedit_setwidth(unsigned w, int redraw_flg) | |||
1318 | 1318 | ||
1319 | static void win_changed(int nsig) | 1319 | static void win_changed(int nsig) |
1320 | { | 1320 | { |
1321 | int width; | 1321 | unsigned width; |
1322 | get_terminal_width_height(0, &width, NULL); | 1322 | get_terminal_width_height(0, &width, NULL); |
1323 | cmdedit_setwidth(width, nsig /* - just a yes/no flag */); | 1323 | cmdedit_setwidth(width, nsig /* - just a yes/no flag */); |
1324 | if (nsig == SIGWINCH) | 1324 | if (nsig == SIGWINCH) |
@@ -1353,7 +1353,7 @@ int read_line_input(const char *prompt, char *command, int maxsize, line_input_t | |||
1353 | #if ENABLE_FEATURE_TAB_COMPLETION | 1353 | #if ENABLE_FEATURE_TAB_COMPLETION |
1354 | smallint lastWasTab = FALSE; | 1354 | smallint lastWasTab = FALSE; |
1355 | #endif | 1355 | #endif |
1356 | unsigned int ic; | 1356 | unsigned ic; |
1357 | unsigned char c; | 1357 | unsigned char c; |
1358 | smallint break_out = 0; | 1358 | smallint break_out = 0; |
1359 | #if ENABLE_FEATURE_EDITING_VI | 1359 | #if ENABLE_FEATURE_EDITING_VI |
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c index 915b74dd1..fe3c647d0 100644 --- a/libbb/xfuncs.c +++ b/libbb/xfuncs.c | |||
@@ -262,7 +262,7 @@ off_t fdlength(int fd) | |||
262 | 262 | ||
263 | /* It is perfectly ok to pass in a NULL for either width or for | 263 | /* It is perfectly ok to pass in a NULL for either width or for |
264 | * height, in which case that value will not be set. */ | 264 | * height, in which case that value will not be set. */ |
265 | int get_terminal_width_height(int fd, int *width, int *height) | 265 | int get_terminal_width_height(int fd, unsigned *width, unsigned *height) |
266 | { | 266 | { |
267 | struct winsize win = { 0, 0, 0, 0 }; | 267 | struct winsize win = { 0, 0, 0, 0 }; |
268 | int ret = ioctl(fd, TIOCGWINSZ, &win); | 268 | int ret = ioctl(fd, TIOCGWINSZ, &win); |
diff --git a/networking/telnet.c b/networking/telnet.c index 78229cd01..32e9993d3 100644 --- a/networking/telnet.c +++ b/networking/telnet.c | |||
@@ -68,7 +68,7 @@ struct globals { | |||
68 | const char *autologin; | 68 | const char *autologin; |
69 | #endif | 69 | #endif |
70 | #if ENABLE_FEATURE_AUTOWIDTH | 70 | #if ENABLE_FEATURE_AUTOWIDTH |
71 | int win_width, win_height; | 71 | unsigned win_width, win_height; |
72 | #endif | 72 | #endif |
73 | /* same buffer used both for network and console read/write */ | 73 | /* same buffer used both for network and console read/write */ |
74 | char buf[DATABUFSIZE]; | 74 | char buf[DATABUFSIZE]; |
diff --git a/networking/tftp.c b/networking/tftp.c index 143279757..36e63e0f7 100644 --- a/networking/tftp.c +++ b/networking/tftp.c | |||
@@ -246,7 +246,7 @@ static int tftp_protocol( | |||
246 | local_fd = open_or_warn(local_file, open_mode); | 246 | local_fd = open_or_warn(local_file, open_mode); |
247 | if (local_fd < 0) { | 247 | if (local_fd < 0) { |
248 | /*error_pkt_reason = ERR_NOFILE/ERR_ACCESS?*/ | 248 | /*error_pkt_reason = ERR_NOFILE/ERR_ACCESS?*/ |
249 | strcpy(error_pkt_str, "can't open file"); | 249 | strcpy((char*)error_pkt_str, "can't open file"); |
250 | goto send_err_pkt; | 250 | goto send_err_pkt; |
251 | } | 251 | } |
252 | } | 252 | } |
@@ -479,7 +479,7 @@ static int tftp_protocol( | |||
479 | if (recv_blk == block_nr) { | 479 | if (recv_blk == block_nr) { |
480 | int sz = full_write(local_fd, &rbuf[4], len - 4); | 480 | int sz = full_write(local_fd, &rbuf[4], len - 4); |
481 | if (sz != len - 4) { | 481 | if (sz != len - 4) { |
482 | strcpy(error_pkt_str, bb_msg_write_error); | 482 | strcpy((char*)error_pkt_str, bb_msg_write_error); |
483 | error_pkt_reason = ERR_WRITE; | 483 | error_pkt_reason = ERR_WRITE; |
484 | goto send_err_pkt; | 484 | goto send_err_pkt; |
485 | } | 485 | } |
@@ -525,12 +525,12 @@ static int tftp_protocol( | |||
525 | return finished == 0; /* returns 1 on failure */ | 525 | return finished == 0; /* returns 1 on failure */ |
526 | 526 | ||
527 | send_read_err_pkt: | 527 | send_read_err_pkt: |
528 | strcpy(error_pkt_str, bb_msg_read_error); | 528 | strcpy((char*)error_pkt_str, bb_msg_read_error); |
529 | send_err_pkt: | 529 | send_err_pkt: |
530 | if (error_pkt_str[0]) | 530 | if (error_pkt_str[0]) |
531 | bb_error_msg(error_pkt_str); | 531 | bb_error_msg((char*)error_pkt_str); |
532 | error_pkt[1] = TFTP_ERROR; | 532 | error_pkt[1] = TFTP_ERROR; |
533 | xsendto(socket_fd, error_pkt, 4 + 1 + strlen(error_pkt_str), | 533 | xsendto(socket_fd, error_pkt, 4 + 1 + strlen((char*)error_pkt_str), |
534 | &peer_lsa->u.sa, peer_lsa->len); | 534 | &peer_lsa->u.sa, peer_lsa->len); |
535 | return EXIT_FAILURE; | 535 | return EXIT_FAILURE; |
536 | } | 536 | } |
@@ -715,7 +715,7 @@ int tftpd_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
715 | 715 | ||
716 | return result; | 716 | return result; |
717 | err: | 717 | err: |
718 | strcpy(error_pkt_str, error_msg); | 718 | strcpy((char*)error_pkt_str, error_msg); |
719 | goto do_proto; | 719 | goto do_proto; |
720 | } | 720 | } |
721 | 721 | ||
diff --git a/networking/wget.c b/networking/wget.c index 7dd1d36f9..84ee1ca3e 100644 --- a/networking/wget.c +++ b/networking/wget.c | |||
@@ -54,9 +54,9 @@ enum { | |||
54 | STALLTIME = 5 /* Seconds when xfer considered "stalled" */ | 54 | STALLTIME = 5 /* Seconds when xfer considered "stalled" */ |
55 | }; | 55 | }; |
56 | 56 | ||
57 | static int getttywidth(void) | 57 | static unsigned int getttywidth(void) |
58 | { | 58 | { |
59 | int width; | 59 | unsigned width; |
60 | get_terminal_width_height(0, &width, NULL); | 60 | get_terminal_width_height(0, &width, NULL); |
61 | return width; | 61 | return width; |
62 | } | 62 | } |
diff --git a/procps/top.c b/procps/top.c index ca43376ac..ed74879d1 100644 --- a/procps/top.c +++ b/procps/top.c | |||
@@ -742,9 +742,10 @@ enum { | |||
742 | int top_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 742 | int top_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
743 | int top_main(int argc ATTRIBUTE_UNUSED, char **argv) | 743 | int top_main(int argc ATTRIBUTE_UNUSED, char **argv) |
744 | { | 744 | { |
745 | int count, lines, col; | 745 | int count; |
746 | unsigned interval; | ||
747 | int iterations; | 746 | int iterations; |
747 | unsigned lines, col; | ||
748 | unsigned interval; | ||
748 | char *sinterval; | 749 | char *sinterval; |
749 | SKIP_FEATURE_TOPMEM(const) unsigned scan_mask = TOP_MASK; | 750 | SKIP_FEATURE_TOPMEM(const) unsigned scan_mask = TOP_MASK; |
750 | #if ENABLE_FEATURE_USE_TERMIOS | 751 | #if ENABLE_FEATURE_USE_TERMIOS |
diff --git a/procps/watch.c b/procps/watch.c index 5b774e808..7d8e0de1f 100644 --- a/procps/watch.c +++ b/procps/watch.c | |||
@@ -28,7 +28,7 @@ int watch_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
28 | { | 28 | { |
29 | unsigned opt; | 29 | unsigned opt; |
30 | unsigned period = 2; | 30 | unsigned period = 2; |
31 | int width, new_width; | 31 | unsigned width, new_width; |
32 | char *header; | 32 | char *header; |
33 | char *cmd; | 33 | char *cmd; |
34 | 34 | ||
@@ -43,19 +43,19 @@ int watch_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
43 | while (*++argv) | 43 | while (*++argv) |
44 | cmd = xasprintf("%s %s", cmd, *argv); // leaks cmd | 44 | cmd = xasprintf("%s %s", cmd, *argv); // leaks cmd |
45 | 45 | ||
46 | width = -1; // make sure first time new_width != width | 46 | width = (unsigned)-1; // make sure first time new_width != width |
47 | header = NULL; | 47 | header = NULL; |
48 | while (1) { | 48 | while (1) { |
49 | printf("\033[H\033[J"); | 49 | printf("\033[H\033[J"); |
50 | if (!(opt & 0x2)) { // no -t | 50 | if (!(opt & 0x2)) { // no -t |
51 | const int time_len = sizeof("1234-67-90 23:56:89"); | 51 | const unsigned time_len = sizeof("1234-67-90 23:56:89"); |
52 | time_t t; | 52 | time_t t; |
53 | 53 | ||
54 | get_terminal_width_height(STDIN_FILENO, &new_width, NULL); | 54 | get_terminal_width_height(STDIN_FILENO, &new_width, NULL); |
55 | if (new_width != width) { | 55 | if (new_width != width) { |
56 | width = new_width; | 56 | width = new_width; |
57 | free(header); | 57 | free(header); |
58 | header = xasprintf("Every %us: %-*s", period, width, cmd); | 58 | header = xasprintf("Every %us: %-*s", period, (int)width, cmd); |
59 | } | 59 | } |
60 | time(&t); | 60 | time(&t); |
61 | if (time_len < width) | 61 | if (time_len < width) |
diff --git a/util-linux/more.c b/util-linux/more.c index 257f40168..2577a67ac 100644 --- a/util-linux/more.c +++ b/util-linux/more.c | |||
@@ -62,8 +62,8 @@ int more_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
62 | FILE *file; | 62 | FILE *file; |
63 | FILE *cin; | 63 | FILE *cin; |
64 | int len; | 64 | int len; |
65 | int terminal_width; | 65 | unsigned terminal_width; |
66 | int terminal_height; | 66 | unsigned terminal_height; |
67 | 67 | ||
68 | INIT_G(); | 68 | INIT_G(); |
69 | 69 | ||