diff options
author | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2007-01-29 17:08:51 +0000 |
---|---|---|
committer | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2007-01-29 17:08:51 +0000 |
commit | 531a4b43c3f7e390833d17a713fd4f8bd80109db (patch) | |
tree | fc053ce5905670ef6f36497374bee20234d16f15 | |
parent | 23620f1f7d2e58f9b44c1c9d0e57bd9d86937e6d (diff) | |
download | busybox-w32-531a4b43c3f7e390833d17a713fd4f8bd80109db.tar.gz busybox-w32-531a4b43c3f7e390833d17a713fd4f8bd80109db.tar.bz2 busybox-w32-531a4b43c3f7e390833d17a713fd4f8bd80109db.zip |
disable -Wold-style-definition for gcc 3.x
git-svn-id: svn://busybox.net/trunk/busybox@17638 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r-- | Makefile.flags | 8 | ||||
-rw-r--r-- | editors/sed.c | 15 | ||||
-rwxr-xr-x | scripts/gcc-version.sh | 12 |
3 files changed, 28 insertions, 7 deletions
diff --git a/Makefile.flags b/Makefile.flags index b39dfbb3c..9de52d89a 100644 --- a/Makefile.flags +++ b/Makefile.flags | |||
@@ -20,16 +20,22 @@ CFLAGS += $(call cc-option,-Wall -Wshadow,) | |||
20 | ifeq ($(CONFIG_WERROR),y) | 20 | ifeq ($(CONFIG_WERROR),y) |
21 | CFLAGS += $(call cc-option,-Werror,) | 21 | CFLAGS += $(call cc-option,-Werror,) |
22 | endif | 22 | endif |
23 | CFLAGS += $(call cc-option,-Wundef -Wold-style-definition -Wstrict-prototypes,) | 23 | CFLAGS += $(call cc-option,-Wundef -Wstrict-prototypes,) |
24 | # If you want to add "-Wmissing-prototypes -Wmissing-declarations" above | 24 | # If you want to add "-Wmissing-prototypes -Wmissing-declarations" above |
25 | # (or anything else for that matter) make sure that it is still possible | 25 | # (or anything else for that matter) make sure that it is still possible |
26 | # to build bbox without warnings. Current offender: find.c:alloc_action(). | 26 | # to build bbox without warnings. Current offender: find.c:alloc_action(). |
27 | # Looks more like gcc bug: gcc will warn on it with or without prototype. | 27 | # Looks more like gcc bug: gcc will warn on it with or without prototype. |
28 | # But still, warning-free compile is a must, or else we will drown | 28 | # But still, warning-free compile is a must, or else we will drown |
29 | # in warnings pretty soon. | 29 | # in warnings pretty soon. |
30 | |||
31 | # gcc 3.x emits bogus "old style proto" warning on find.c:alloc_action() | ||
32 | CFLAGS += $(call cc-ifversion, -ge, 0400, -Wold-style-definition) | ||
33 | |||
34 | # gcc emits bogus "no prev proto" warning on find.c:alloc_action() | ||
30 | ifneq ($(CONFIG_WERROR),y) | 35 | ifneq ($(CONFIG_WERROR),y) |
31 | CFLAGS += $(call cc-option,-Wmissing-prototypes -Wmissing-declarations,) | 36 | CFLAGS += $(call cc-option,-Wmissing-prototypes -Wmissing-declarations,) |
32 | endif | 37 | endif |
38 | |||
33 | CFLAGS += $(call cc-option,-Os -fno-builtin-strlen -finline-limit=0 -fomit-frame-pointer -ffunction-sections -fdata-sections,) | 39 | CFLAGS += $(call cc-option,-Os -fno-builtin-strlen -finline-limit=0 -fomit-frame-pointer -ffunction-sections -fdata-sections,) |
34 | # -fno-guess-branch-probability: prohibit pseudo-random guessing | 40 | # -fno-guess-branch-probability: prohibit pseudo-random guessing |
35 | # of branch probabilities (hopefully makes bloatcheck more stable): | 41 | # of branch probabilities (hopefully makes bloatcheck more stable): |
diff --git a/editors/sed.c b/editors/sed.c index 70be2e824..bf40877e4 100644 --- a/editors/sed.c +++ b/editors/sed.c | |||
@@ -422,8 +422,10 @@ static char *parse_cmd_args(sed_cmd_t *sed_cmd, char *cmdstr) | |||
422 | if (sed_cmd->end_line || sed_cmd->end_match) | 422 | if (sed_cmd->end_line || sed_cmd->end_match) |
423 | bb_error_msg_and_die("command only uses one address"); | 423 | bb_error_msg_and_die("command only uses one address"); |
424 | cmdstr += parse_file_cmd(sed_cmd, cmdstr, &sed_cmd->string); | 424 | cmdstr += parse_file_cmd(sed_cmd, cmdstr, &sed_cmd->string); |
425 | if (sed_cmd->cmd == 'w') | 425 | if (sed_cmd->cmd == 'w') { |
426 | sed_cmd->sw_file = xfopen(sed_cmd->string, "w"); | 426 | sed_cmd->sw_file = xfopen(sed_cmd->string, "w"); |
427 | sed_cmd->sw_last_char = '\n'; | ||
428 | } | ||
427 | /* handle branch commands */ | 429 | /* handle branch commands */ |
428 | } else if (strchr(":btT", sed_cmd->cmd)) { | 430 | } else if (strchr(":btT", sed_cmd->cmd)) { |
429 | int length; | 431 | int length; |
@@ -726,7 +728,8 @@ enum { | |||
726 | static char *get_next_line(char *gets_char) | 728 | static char *get_next_line(char *gets_char) |
727 | { | 729 | { |
728 | char *temp = NULL; | 730 | char *temp = NULL; |
729 | int len, gc; | 731 | int len; |
732 | char gc; | ||
730 | 733 | ||
731 | flush_append(); | 734 | flush_append(); |
732 | 735 | ||
@@ -744,9 +747,11 @@ static char *get_next_line(char *gets_char) | |||
744 | char c = temp[len-1]; | 747 | char c = temp[len-1]; |
745 | if (c == '\n' || c == '\0') { | 748 | if (c == '\n' || c == '\0') { |
746 | temp[len-1] = '\0'; | 749 | temp[len-1] = '\0'; |
747 | gc = (unsigned char)c; | 750 | gc = c; |
748 | break; | ||
749 | } | 751 | } |
752 | /* else we put NO_EOL_CHAR into *gets_char */ | ||
753 | break; | ||
754 | |||
750 | /* NB: I had the idea of peeking next file(s) and returning | 755 | /* NB: I had the idea of peeking next file(s) and returning |
751 | * NO_EOL_CHAR only if it is the *last* non-empty | 756 | * NO_EOL_CHAR only if it is the *last* non-empty |
752 | * input file. But there is a case where this won't work: | 757 | * input file. But there is a case where this won't work: |
@@ -754,8 +759,6 @@ static char *get_next_line(char *gets_char) | |||
754 | * file2: "c no\nd no" | 759 | * file2: "c no\nd no" |
755 | * sed -ne 's/woo/bang/p' input1 input2 => "a bang\nb bang" | 760 | * sed -ne 's/woo/bang/p' input1 input2 => "a bang\nb bang" |
756 | * (note: *no* newline after "b bang"!) */ | 761 | * (note: *no* newline after "b bang"!) */ |
757 | |||
758 | break; | ||
759 | } | 762 | } |
760 | /* Close this file and advance to next one */ | 763 | /* Close this file and advance to next one */ |
761 | fclose(bbg.input_file_list[bbg.current_input_file++]); | 764 | fclose(bbg.input_file_list[bbg.current_input_file++]); |
diff --git a/scripts/gcc-version.sh b/scripts/gcc-version.sh new file mode 100755 index 000000000..34510804f --- /dev/null +++ b/scripts/gcc-version.sh | |||
@@ -0,0 +1,12 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # gcc-version gcc-command | ||
4 | # | ||
5 | # Prints the gcc version of `gcc-command' in a canonical 4-digit form | ||
6 | # such as `0295' for gcc-2.95, `0303' for gcc-3.3, etc. | ||
7 | # | ||
8 | |||
9 | compiler="$*" | ||
10 | |||
11 | MAJ_MIN=$(echo __GNUC__ __GNUC_MINOR__ | $compiler -E -xc - | tail -n 1) | ||
12 | printf '%02d%02d\n' $MAJ_MIN | ||