diff -Naur insight-6.8.orig/gdb/cli/cli-cmds.c insight-6.8.new/gdb/cli/cli-cmds.c
--- insight-6.8.orig/gdb/cli/cli-cmds.c 2008-01-01 23:53:14.000000000 +0100
+++ insight-6.8.new/gdb/cli/cli-cmds.c 2008-08-14 21:42:39.000000000 +0200
@@ -320,7 +320,8 @@
{
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"),
diff -Naur insight-6.8.orig/gdb/doublest.c insight-6.8.new/gdb/doublest.c
--- insight-6.8.orig/gdb/doublest.c 2008-01-03 12:39:35.000000000 +0100
+++ insight-6.8.new/gdb/doublest.c 2008-08-14 21:41:32.000000000 +0200
@@ -92,15 +92,10 @@
{
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 */
diff -Naur insight-6.8.orig/gdb/dwarf2expr.c insight-6.8.new/gdb/dwarf2expr.c
--- insight-6.8.orig/gdb/dwarf2expr.c 2008-01-01 23:53:09.000000000 +0100
+++ insight-6.8.new/gdb/dwarf2expr.c 2008-08-14 21:38:31.000000000 +0200
@@ -595,6 +595,8 @@
op_ptr = read_uleb128 (op_ptr, op_end, ®);
result += reg;
break;
+ default:
+ break;
}
break;
diff -Naur insight-6.8.orig/gdb/dwarf2read.c insight-6.8.new/gdb/dwarf2read.c
--- insight-6.8.orig/gdb/dwarf2read.c 2008-03-10 15:18:10.000000000 +0100
+++ insight-6.8.new/gdb/dwarf2read.c 2008-08-14 21:37:07.000000000 +0200
@@ -9641,6 +9641,7 @@
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)
@@ -9652,13 +9653,16 @@
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:
{
diff -Naur insight-6.8.orig/gdb/f-exp.y insight-6.8.new/gdb/f-exp.y
--- insight-6.8.orig/gdb/f-exp.y 2008-01-01 23:53:09.000000000 +0100
+++ insight-6.8.new/gdb/f-exp.y 2008-08-14 21:26:51.000000000 +0200
@@ -567,6 +567,8 @@
case tp_function:
follow_type = lookup_function_type (follow_type);
break;
+ default:
+ break;
}
$$ = follow_type;
}
diff -Naur insight-6.8.orig/gdb/gdb-events.c insight-6.8.new/gdb/gdb-events.c
--- insight-6.8.orig/gdb/gdb-events.c 2008-01-01 23:53:09.000000000 +0100
+++ insight-6.8.new/gdb/gdb-events.c 2008-08-14 21:33:42.000000000 +0200
@@ -319,6 +319,8 @@
case architecture_changed:
vector->architecture_changed ();
break;
+ default:
+ break;
}
delivering_events = event->next;
xfree (event);
diff -Naur insight-6.8.orig/gdb/gdbserver/gdbreplay.c insight-6.8.new/gdb/gdbserver/gdbreplay.c
--- insight-6.8.orig/gdb/gdbserver/gdbreplay.c 2008-01-01 23:53:14.000000000 +0100
+++ insight-6.8.new/gdb/gdbserver/gdbreplay.c 2008-08-14 21:51:32.000000000 +0200
@@ -356,7 +356,12 @@
{
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 @@
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;
+ }
}
}
diff -Naur insight-6.8.orig/gdb/inflow.c insight-6.8.new/gdb/inflow.c
--- insight-6.8.orig/gdb/inflow.c 2008-01-01 23:53:11.000000000 +0100
+++ insight-6.8.new/gdb/inflow.c 2008-08-14 21:43:55.000000000 +0200
@@ -545,17 +545,20 @@
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);
diff -Naur insight-6.8.orig/gdb/linespec.c insight-6.8.new/gdb/linespec.c
--- insight-6.8.orig/gdb/linespec.c 2008-01-01 23:53:11.000000000 +0100
+++ insight-6.8.new/gdb/linespec.c 2008-08-14 21:31:24.000000000 +0200
@@ -1409,7 +1409,7 @@
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 = {0};
struct symbol *sym = NULL;
int i1; /* Counter for the symbol array. */
struct symbol **sym_arr = alloca (total_number_of_methods (t)
diff -Naur insight-6.8.orig/gdb/linux-nat.c insight-6.8.new/gdb/linux-nat.c
--- insight-6.8.orig/gdb/linux-nat.c 2008-01-29 23:47:20.000000000 +0100
+++ insight-6.8.new/gdb/linux-nat.c 2008-08-14 21:44:39.000000000 +0200
@@ -2876,7 +2876,8 @@
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);
}
diff -Naur insight-6.8.orig/gdb/main.c insight-6.8.new/gdb/main.c
--- insight-6.8.orig/gdb/main.c 2008-01-05 17:49:53.000000000 +0100
+++ insight-6.8.new/gdb/main.c 2008-08-14 21:45:18.000000000 +0200
@@ -188,7 +188,8 @@
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);
diff -Naur insight-6.8.orig/gdb/mi/mi-cmd-env.c insight-6.8.new/gdb/mi/mi-cmd-env.c
--- insight-6.8.orig/gdb/mi/mi-cmd-env.c 2008-01-01 23:53:14.000000000 +0100
+++ insight-6.8.new/gdb/mi/mi-cmd-env.c 2008-08-14 21:46:06.000000000 +0200
@@ -78,7 +78,8 @@
/* 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;
diff -Naur insight-6.8.orig/gdb/s390-tdep.c insight-6.8.new/gdb/s390-tdep.c
--- insight-6.8.orig/gdb/s390-tdep.c 2008-01-31 16:43:32.000000000 +0100
+++ insight-6.8.new/gdb/s390-tdep.c 2008-08-14 21:25:43.000000000 +0200
@@ -2218,6 +2218,9 @@
case RETURN_VALUE_STRUCT_CONVENTION:
error (_("Cannot set function return value."));
break;
+
+ default:
+ break;
}
}
else if (out)
@@ -2251,6 +2254,9 @@
case RETURN_VALUE_STRUCT_CONVENTION:
error (_("Function return value unknown."));
break;
+
+ default:
+ break;
}
}
diff -Naur insight-6.8.orig/gdb/source.c insight-6.8.new/gdb/source.c
--- insight-6.8.orig/gdb/source.c 2008-02-08 23:20:48.000000000 +0100
+++ insight-6.8.new/gdb/source.c 2008-08-14 21:28:28.000000000 +0200
@@ -170,7 +170,7 @@
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 symtabs_and_lines sals = {0};
struct symtab_and_line sal;
CORE_ADDR start_pc, end_pc;
int i;
diff -Naur insight-6.8.orig/gdb/stabsread.c insight-6.8.new/gdb/stabsread.c
--- insight-6.8.orig/gdb/stabsread.c 2008-01-01 23:53:13.000000000 +0100
+++ insight-6.8.new/gdb/stabsread.c 2008-08-14 21:37:51.000000000 +0200
@@ -1828,7 +1828,8 @@
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. */
diff -Naur insight-6.8.orig/gdb/target.c insight-6.8.new/gdb/target.c
--- insight-6.8.orig/gdb/target.c 2008-01-25 01:09:49.000000000 +0100
+++ insight-6.8.new/gdb/target.c 2008-08-14 21:33:14.000000000 +0200
@@ -1045,6 +1045,9 @@
case MEM_NONE:
return -1;
+
+ default:
+ break;
}
if (region->attrib.cache)
diff -Naur insight-6.8.orig/gdb/top.c insight-6.8.new/gdb/top.c
--- insight-6.8.orig/gdb/top.c 2008-01-01 23:53:13.000000000 +0100
+++ insight-6.8.new/gdb/top.c 2008-08-14 21:46:43.000000000 +0200
@@ -1628,7 +1628,8 @@
/* 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__
diff -Naur insight-6.8.orig/gdb/ui-file.c insight-6.8.new/gdb/ui-file.c
--- insight-6.8.orig/gdb/ui-file.c 2008-01-01 23:53:13.000000000 +0100
+++ insight-6.8.new/gdb/ui-file.c 2008-08-14 21:48:01.000000000 +0200
@@ -481,7 +481,8 @@
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
diff -Naur insight-6.8.orig/gdb/utils.c insight-6.8.new/gdb/utils.c
--- insight-6.8.orig/gdb/utils.c 2008-01-01 23:53:13.000000000 +0100
+++ insight-6.8.new/gdb/utils.c 2008-08-14 21:47:36.000000000 +0200
@@ -704,7 +704,8 @@
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);
}
}
diff -Naur insight-6.8.orig/gdb/varobj.c insight-6.8.new/gdb/varobj.c
--- insight-6.8.orig/gdb/varobj.c 2008-02-04 08:49:04.000000000 +0100
+++ insight-6.8.new/gdb/varobj.c 2008-08-14 21:40:16.000000000 +0200
@@ -319,8 +319,7 @@
/* Array of known source language routines. */
static struct language_specific languages[vlang_end] = {
/* Unknown (try treating as C */
- {
- vlang_unknown,
+ {vlang_unknown,
c_number_of_children,
c_name_of_variable,
c_name_of_child,
@@ -331,8 +330,7 @@
c_value_of_variable}
,
/* C */
- {
- vlang_c,
+ {vlang_c,
c_number_of_children,
c_name_of_variable,
c_name_of_child,
@@ -343,8 +341,7 @@
c_value_of_variable}
,
/* C++ */
- {
- vlang_cplus,
+ {vlang_cplus,
cplus_number_of_children,
cplus_name_of_variable,
cplus_name_of_child,
@@ -355,8 +352,7 @@
cplus_value_of_variable}
,
/* Java */
- {
- vlang_java,
+ {vlang_java,
java_number_of_children,
java_name_of_variable,
java_name_of_child,