Blob Blame History Raw
[base]

2007-10-14  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Port to GDB-6.7.

Index: gdb-6.7/gdb/mi/mi-cmd-env.c
===================================================================
--- gdb-6.7.orig/gdb/mi/mi-cmd-env.c	2007-10-14 23:42:39.000000000 +0200
+++ gdb-6.7/gdb/mi/mi-cmd-env.c	2007-10-14 23:42:39.000000000 +0200
@@ -78,7 +78,8 @@ mi_cmd_env_pwd (char *command, char **ar
      
   /* Otherwise the mi level is 2 or higher.  */
 
-  getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
+  /* Unused result.  */
+  1 && getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
   ui_out_field_string (uiout, "cwd", gdb_dirbuf);
 
   return MI_CMD_DONE;
Index: gdb-6.7/gdb/testsuite/gdb.base/move-dir.h
===================================================================
--- gdb-6.7.orig/gdb/testsuite/gdb.base/move-dir.h	2007-10-14 23:31:22.000000000 +0200
+++ gdb-6.7/gdb/testsuite/gdb.base/move-dir.h	2007-10-14 23:42:39.000000000 +0200
@@ -1,4 +1,4 @@
-#include <stdlib.h>
+#include <stdio.h>
 
 void other() {
   const char* ostring = "other";
Index: gdb-6.7/gdb/testsuite/gdb.base/sigrepeat.c
===================================================================
--- gdb-6.7.orig/gdb/testsuite/gdb.base/sigrepeat.c	2007-08-23 20:08:49.000000000 +0200
+++ gdb-6.7/gdb/testsuite/gdb.base/sigrepeat.c	2007-10-14 23:42:39.000000000 +0200
@@ -21,6 +21,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <signal.h>
+#include <stdlib.h>
 #include <sys/time.h>
 
 static volatile int done[2];
Index: gdb-6.7/gdb/s390-tdep.c
===================================================================
--- gdb-6.7.orig/gdb/s390-tdep.c	2007-10-02 21:26:42.000000000 +0200
+++ gdb-6.7/gdb/s390-tdep.c	2007-10-14 23:42:39.000000000 +0200
@@ -2214,6 +2214,9 @@ s390_return_value (struct gdbarch *gdbar
 	case RETURN_VALUE_STRUCT_CONVENTION:
 	  error (_("Cannot set function return value."));
 	  break;
+
+        default:
+      	  break;
 	}
     }
   else if (out)
@@ -2246,6 +2249,9 @@ s390_return_value (struct gdbarch *gdbar
 	case RETURN_VALUE_STRUCT_CONVENTION:
 	  error (_("Function return value unknown."));
 	  break;
+
+        default:
+      	  break;
 	}
     }
 
Index: gdb-6.7/gdb/f-exp.y
===================================================================
--- gdb-6.7.orig/gdb/f-exp.y	2007-06-12 17:33:03.000000000 +0200
+++ gdb-6.7/gdb/f-exp.y	2007-10-14 23:42:39.000000000 +0200
@@ -567,6 +567,8 @@ ptype	:	typebase
 		      case tp_function:
 			follow_type = lookup_function_type (follow_type);
 			break;
+		      default:
+			break;
 		      }
 		  $$ = follow_type;
 		}
Index: gdb-6.7/gdb/source.c
===================================================================
--- gdb-6.7.orig/gdb/source.c	2007-08-23 20:08:38.000000000 +0200
+++ gdb-6.7/gdb/source.c	2007-10-14 23:42:39.000000000 +0200
@@ -170,7 +170,7 @@ get_current_source_symtab_and_line (void
 void
 set_default_source_symtab_and_line (void)
 {
-  struct symtab_and_line cursal;
+  struct symtab_and_line cursal = {0};
 
   if (!have_full_symbols () && !have_partial_symbols ())
     error (_("No symbol table is loaded.  Use the \"file\" command."));
@@ -1439,7 +1439,7 @@ static void
 line_info (char *arg, int from_tty)
 {
   struct symtabs_and_lines sals;
-  struct symtab_and_line sal;
+  struct symtab_and_line sal = {0};
   CORE_ADDR start_pc, end_pc;
   int i;
 
Index: gdb-6.7/gdb/linespec.c
===================================================================
--- gdb-6.7.orig/gdb/linespec.c	2007-10-14 23:31:03.000000000 +0200
+++ gdb-6.7/gdb/linespec.c	2007-10-14 23:53:57.000000000 +0200
@@ -1654,7 +1654,7 @@ static struct symtabs_and_lines
 find_method (int funfirstline, char ***canonical, char *saved_arg,
 	     char *copy, struct type *t, struct symbol *sym_class)
 {
-  struct symtabs_and_lines values;
+  struct symtabs_and_lines values = { NULL }; 
   struct symbol *sym = NULL;
   int i1;	/*  Counter for the symbol array.  */
   struct symbol **sym_arr =  alloca (total_number_of_methods (t)
Index: gdb-6.7/gdb/gdb-events.c
===================================================================
--- gdb-6.7.orig/gdb/gdb-events.c	2007-08-23 20:08:31.000000000 +0200
+++ gdb-6.7/gdb/gdb-events.c	2007-10-14 23:42:39.000000000 +0200
@@ -319,6 +319,8 @@ gdb_events_deliver (struct gdb_events *v
 	case architecture_changed:
 	  vector->architecture_changed ();
 	  break;
+	default:
+	  break;
 	}
       delivering_events = event->next;
       xfree (event);
Index: gdb-6.7/gdb/dwarf2read.c
===================================================================
--- gdb-6.7.orig/gdb/dwarf2read.c	2007-10-14 23:31:22.000000000 +0200
+++ gdb-6.7/gdb/dwarf2read.c	2007-10-14 23:42:39.000000000 +0200
@@ -9585,6 +9585,7 @@ dwarf_decode_macros (struct line_header 
   for (;;)
     {
       enum dwarf_macinfo_record_type macinfo_type;
+      int tmp;
 
       /* Do we at least have room for a macinfo type byte?  */
       if (mac_ptr >= mac_end)
@@ -9596,13 +9597,16 @@ dwarf_decode_macros (struct line_header 
       macinfo_type = read_1_byte (abfd, mac_ptr);
       mac_ptr++;
 
+      /* Check for a zero macinfo type which indicates the end of the macro
+         information.  We do this as the compiler may warn us if we
+         try and look for 0 in the switch below because 0 is not
+         an enumerated value.  */
+      tmp = (int)macinfo_type;
+      if (tmp == 0)
+	return;
+
       switch (macinfo_type)
         {
-          /* A zero macinfo type indicates the end of the macro
-             information.  */
-        case 0:
-          return;
-
         case DW_MACINFO_define:
         case DW_MACINFO_undef:
           {
Index: gdb-6.7/gdb/stabsread.c
===================================================================
--- gdb-6.7.orig/gdb/stabsread.c	2007-10-09 00:44:32.000000000 +0200
+++ gdb-6.7/gdb/stabsread.c	2007-10-14 23:42:39.000000000 +0200
@@ -1842,7 +1842,8 @@ again:
 	  struct type *domain = read_type (pp, objfile);
 	  struct type *return_type;
 	  struct field *args;
-	  int nargs, varargs;
+	  int nargs = 0;
+	  int varargs = 0;
 
 	  if (**pp != ',')
 	    /* Invalid member type data format.  */
Index: gdb-6.7/gdb/dwarf2expr.c
===================================================================
--- gdb-6.7.orig/gdb/dwarf2expr.c	2007-08-23 20:08:28.000000000 +0200
+++ gdb-6.7/gdb/dwarf2expr.c	2007-10-14 23:42:39.000000000 +0200
@@ -594,6 +594,8 @@ execute_stack_op (struct dwarf_expr_cont
 	      op_ptr = read_uleb128 (op_ptr, op_end, &reg);
 	      result += reg;
 	      break;
+	    default:
+	      break;
 	    }
 	  break;
 
Index: gdb-6.7/gdb/varobj.c
===================================================================
--- gdb-6.7.orig/gdb/varobj.c	2007-10-13 05:29:58.000000000 +0200
+++ gdb-6.7/gdb/varobj.c	2007-10-14 23:42:39.000000000 +0200
@@ -347,8 +347,7 @@ static struct language_specific language
    c_value_of_variable}
   ,
   /* C */
-  {
-   vlang_c,
+  {vlang_c,
    c_number_of_children,
    c_name_of_variable,
    c_name_of_child,
@@ -360,8 +359,7 @@ static struct language_specific language
    c_value_of_variable}
   ,
   /* C++ */
-  {
-   vlang_cplus,
+  {vlang_cplus,
    cplus_number_of_children,
    cplus_name_of_variable,
    cplus_name_of_child,
@@ -373,8 +371,7 @@ static struct language_specific language
    cplus_value_of_variable}
   ,
   /* Java */
-  {
-   vlang_java,
+  {vlang_java,
    java_number_of_children,
    java_name_of_variable,
    java_name_of_child,
Index: gdb-6.7/gdb/doublest.c
===================================================================
--- gdb-6.7.orig/gdb/doublest.c	2007-08-23 20:08:28.000000000 +0200
+++ gdb-6.7/gdb/doublest.c	2007-10-14 23:42:39.000000000 +0200
@@ -92,15 +92,10 @@ get_field (const bfd_byte *data, enum fl
     {
       result |= (unsigned long)*(data + cur_byte) << cur_bitshift;
       cur_bitshift += FLOATFORMAT_CHAR_BIT;
-      switch (order)
-	{
-	case floatformat_little:
-	  ++cur_byte;
-	  break;
-	case floatformat_big:
-	  --cur_byte;
-	  break;
-	}
+      if (order == floatformat_little)
+	++cur_byte;
+      else
+	--cur_byte;
     }
   if (len < sizeof(result) * FLOATFORMAT_CHAR_BIT)
     /* Mask out bits which are not part of the field */
Index: gdb-6.7/gdb/cli/cli-cmds.c
===================================================================
--- gdb-6.7.orig/gdb/cli/cli-cmds.c	2007-08-23 20:08:47.000000000 +0200
+++ gdb-6.7/gdb/cli/cli-cmds.c	2007-10-14 23:42:39.000000000 +0200
@@ -320,7 +320,8 @@ pwd_command (char *args, int from_tty)
 {
   if (args)
     error (_("The \"pwd\" command does not take an argument: %s"), args);
-  getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
+  /* Unused result.  */
+  1 && getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
 
   if (strcmp (gdb_dirbuf, current_directory) != 0)
     printf_unfiltered (_("Working directory %s\n (canonically %s).\n"),
Index: gdb-6.7/gdb/inflow.c
===================================================================
--- gdb-6.7.orig/gdb/inflow.c	2007-08-23 20:08:35.000000000 +0200
+++ gdb-6.7/gdb/inflow.c	2007-10-14 23:42:39.000000000 +0200
@@ -547,17 +547,20 @@ new_tty (void)
   if (tty != 0)
     {
       close (0);
-      dup (tty);
+      /* Unused result.  */
+      1 && dup (tty);
     }
   if (tty != 1)
     {
       close (1);
-      dup (tty);
+      /* Unused result.  */
+      1 && dup (tty);
     }
   if (tty != 2)
     {
       close (2);
-      dup (tty);
+      /* Unused result.  */
+      1 && dup (tty);
     }
   if (tty > 2)
     close (tty);
Index: gdb-6.7/gdb/linux-nat.c
===================================================================
--- gdb-6.7.orig/gdb/linux-nat.c	2007-10-14 23:31:22.000000000 +0200
+++ gdb-6.7/gdb/linux-nat.c	2007-10-14 23:42:39.000000000 +0200
@@ -2895,7 +2895,8 @@ linux_nat_info_proc_cmd (char *args, int
       sprintf (fname1, "/proc/%lld/cmdline", pid);
       if ((procfile = fopen (fname1, "r")) != NULL)
 	{
-	  fgets (buffer, sizeof (buffer), procfile);
+	  /* Unused result.  */
+	  1 && fgets (buffer, sizeof (buffer), procfile);
 	  printf_filtered ("cmdline = '%s'\n", buffer);
 	  fclose (procfile);
 	}
Index: gdb-6.7/gdb/main.c
===================================================================
--- gdb-6.7.orig/gdb/main.c	2007-08-23 20:08:36.000000000 +0200
+++ gdb-6.7/gdb/main.c	2007-10-14 23:42:39.000000000 +0200
@@ -193,7 +193,8 @@ captured_main (void *data)
   line[0] = '\0';		/* Terminate saved (now empty) cmd line */
   instream = stdin;
 
-  getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
+  /* Unused result.  */
+  1 && getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
   current_directory = gdb_dirbuf;
 
   gdb_stdout = stdio_fileopen (stdout);
Index: gdb-6.7/gdb/top.c
===================================================================
--- gdb-6.7.orig/gdb/top.c	2007-10-14 23:38:27.000000000 +0200
+++ gdb-6.7/gdb/top.c	2007-10-14 23:42:39.000000000 +0200
@@ -1636,7 +1636,8 @@ gdb_init (char *argv0)
 
   /* Run the init function of each source file */
 
-  getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
+  /* Unused result.  */
+  1 && getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
   current_directory = gdb_dirbuf;
 
 #ifdef __MSDOS__
Index: gdb-6.7/gdb/ui-file.c
===================================================================
--- gdb-6.7.orig/gdb/ui-file.c	2007-08-23 20:08:46.000000000 +0200
+++ gdb-6.7/gdb/ui-file.c	2007-10-14 23:42:39.000000000 +0200
@@ -480,7 +480,8 @@ stdio_file_write (struct ui_file *file, 
   if (stdio->magic != &stdio_file_magic)
     internal_error (__FILE__, __LINE__,
 		    _("stdio_file_write: bad magic number"));
-  fwrite (buf, length_buf, 1, stdio->file);
+  /* Unused result.  */
+  1 && fwrite (buf, length_buf, 1, stdio->file);
 }
 
 static void
Index: gdb-6.7/gdb/utils.c
===================================================================
--- gdb-6.7.orig/gdb/utils.c	2007-08-23 20:08:46.000000000 +0200
+++ gdb-6.7/gdb/utils.c	2007-10-14 23:42:39.000000000 +0200
@@ -716,7 +716,8 @@ internal_vproblem (struct internal_probl
 	abort ();	/* NOTE: GDB has only three calls to abort().  */
       default:
 	dejavu = 3;
-	write (STDERR_FILENO, msg, sizeof (msg));
+	/* Unused result.  */
+	1 && write (STDERR_FILENO, msg, sizeof (msg));
 	exit (1);
       }
   }
Index: gdb-6.7/gdb/gdbserver/gdbreplay.c
===================================================================
--- gdb-6.7.orig/gdb/gdbserver/gdbreplay.c	2007-08-23 20:08:48.000000000 +0200
+++ gdb-6.7/gdb/gdbserver/gdbreplay.c	2007-10-14 23:42:39.000000000 +0200
@@ -356,7 +356,12 @@ expect (FILE *fp)
 	{
 	  break;
 	}
-      read (remote_desc, &fromgdb, 1);
+      if (read (remote_desc, &fromgdb, 1) != 1)
+        {
+	  /* Error gets reported below.  */
+	  fromlog = 0;
+	  break;
+	}
     }
   while (fromlog == fromgdb);
   if (fromlog != EOL)
@@ -383,7 +388,11 @@ play (FILE *fp)
   while ((fromlog = logchar (fp)) != EOL)
     {
       ch = fromlog;
-      write (remote_desc, &ch, 1);
+      if (write (remote_desc, &ch, 1) != 1)
+        {
+	  sync_error (fp, "Sync error during write of gdb packet", ch, 0);
+	  break;
+	}
     }
 }