svn commit: trunk/busybox: editors scripts

vda at busybox.net vda at busybox.net
Mon Jan 29 17:08:52 UTC 2007


Author: vda
Date: 2007-01-29 09:08:51 -0800 (Mon, 29 Jan 2007)
New Revision: 17638

Log:
disable -Wold-style-definition for gcc 3.x


Added:
   trunk/busybox/scripts/gcc-version.sh

Modified:
   trunk/busybox/Makefile.flags
   trunk/busybox/editors/sed.c


Changeset:
Modified: trunk/busybox/Makefile.flags
===================================================================
--- trunk/busybox/Makefile.flags	2007-01-29 17:02:31 UTC (rev 17637)
+++ trunk/busybox/Makefile.flags	2007-01-29 17:08:51 UTC (rev 17638)
@@ -20,16 +20,22 @@
 ifeq ($(CONFIG_WERROR),y)
 CFLAGS += $(call cc-option,-Werror,)
 endif
-CFLAGS += $(call cc-option,-Wundef -Wold-style-definition -Wstrict-prototypes,)
+CFLAGS += $(call cc-option,-Wundef -Wstrict-prototypes,)
 # If you want to add "-Wmissing-prototypes -Wmissing-declarations" above
 # (or anything else for that matter) make sure that it is still possible
 # to build bbox without warnings. Current offender: find.c:alloc_action().
 # Looks more like gcc bug: gcc will warn on it with or without prototype.
 # But still, warning-free compile is a must, or else we will drown
 # in warnings pretty soon.
+
+# gcc 3.x emits bogus "old style proto" warning on find.c:alloc_action()
+CFLAGS += $(call cc-ifversion, -ge, 0400, -Wold-style-definition)
+
+# gcc emits bogus "no prev proto" warning on find.c:alloc_action()
 ifneq ($(CONFIG_WERROR),y)
 CFLAGS += $(call cc-option,-Wmissing-prototypes -Wmissing-declarations,)
 endif
+
 CFLAGS += $(call cc-option,-Os -fno-builtin-strlen -finline-limit=0 -fomit-frame-pointer -ffunction-sections -fdata-sections,)
 # -fno-guess-branch-probability: prohibit pseudo-random guessing
 # of branch probabilities (hopefully makes bloatcheck more stable):

Modified: trunk/busybox/editors/sed.c
===================================================================
--- trunk/busybox/editors/sed.c	2007-01-29 17:02:31 UTC (rev 17637)
+++ trunk/busybox/editors/sed.c	2007-01-29 17:08:51 UTC (rev 17638)
@@ -422,8 +422,10 @@
 		if (sed_cmd->end_line || sed_cmd->end_match)
 			bb_error_msg_and_die("command only uses one address");
 		cmdstr += parse_file_cmd(sed_cmd, cmdstr, &sed_cmd->string);
-		if (sed_cmd->cmd == 'w')
+		if (sed_cmd->cmd == 'w') {
 			sed_cmd->sw_file = xfopen(sed_cmd->string, "w");
+			sed_cmd->sw_last_char = '\n';
+		}
 	/* handle branch commands */
 	} else if (strchr(":btT", sed_cmd->cmd)) {
 		int length;
@@ -726,7 +728,8 @@
 static char *get_next_line(char *gets_char)
 {
 	char *temp = NULL;
-	int len, gc;
+	int len;
+	char gc;
 
 	flush_append();
 
@@ -744,9 +747,11 @@
 			char c = temp[len-1];
 			if (c == '\n' || c == '\0') {
 				temp[len-1] = '\0';
-				gc = (unsigned char)c;
-				break;
+				gc = c;
 			}
+			/* else we put NO_EOL_CHAR into *gets_char */
+			break;
+
 		/* NB: I had the idea of peeking next file(s) and returning
 		 * NO_EOL_CHAR only if it is the *last* non-empty
 		 * input file. But there is a case where this won't work:
@@ -754,8 +759,6 @@
 		 * file2: "c no\nd no"
 		 * sed -ne 's/woo/bang/p' input1 input2 => "a bang\nb bang"
 		 * (note: *no* newline after "b bang"!) */
-
-			break;
 		}
 		/* Close this file and advance to next one */
 		fclose(bbg.input_file_list[bbg.current_input_file++]);

Added: trunk/busybox/scripts/gcc-version.sh
===================================================================
--- trunk/busybox/scripts/gcc-version.sh	                        (rev 0)
+++ trunk/busybox/scripts/gcc-version.sh	2007-01-29 17:08:51 UTC (rev 17638)
@@ -0,0 +1,12 @@
+#!/bin/sh
+#
+# gcc-version gcc-command
+#
+# Prints the gcc version of `gcc-command' in a canonical 4-digit form
+# such as `0295' for gcc-2.95, `0303' for gcc-3.3, etc.
+#
+
+compiler="$*"
+
+MAJ_MIN=$(echo __GNUC__ __GNUC_MINOR__ | $compiler -E -xc - | tail -n 1)
+printf '%02d%02d\n' $MAJ_MIN


Property changes on: trunk/busybox/scripts/gcc-version.sh
___________________________________________________________________
Name: svn:executable
   + *




More information about the busybox-cvs mailing list