Rearange code to supress -Wuninitialized error.
authorAndrew Cagney <cagney@redhat.com>
Tue, 11 Dec 2001 18:35:38 +0000 (18:35 +0000)
committerAndrew Cagney <cagney@redhat.com>
Tue, 11 Dec 2001 18:35:38 +0000 (18:35 +0000)
gdb/ChangeLog
gdb/values.c

index 6dc2b7700529ca0fccaf45e17074fb80fc2b266a..7a25a0dfc891328f7f5c5aa42d6515d2c0e22a6d 100644 (file)
@@ -1,3 +1,8 @@
+2001-12-11  Andrew Cagney  <ac131313@redhat.com>
+
+       * values.c: Include "gdb_assert.h".
+       (value_fn_field): Rearange to avoid -Wuninitialized warning.
+
 2001-12-10  Fred Fish  <fnf@redhat.com>
 
        * values.c (value_fn_field): Add physname variable.  Use a minimal
index b8407e123fb056b4fdd6ad5a2594ef967637bea7..cc90caacd7aabfe2b4beaca569db43315f0306eb 100644 (file)
@@ -33,6 +33,7 @@
 #include "scm-lang.h"
 #include "demangle.h"
 #include "doublest.h"
+#include "gdb_assert.h"
 
 /* Prototypes for exported functions. */
 
@@ -971,14 +972,18 @@ value_fn_field (value_ptr *arg1p, struct fn_field *f, int j, struct type *type,
   struct minimal_symbol *msym;
 
   sym = lookup_symbol (physname, 0, VAR_NAMESPACE, 0, NULL);
-  if (!sym)
+  if (sym != NULL)
     {
+      msym = NULL;
+    }
+  else
+    {
+      gdb_assert (sym == NULL);
       msym = lookup_minimal_symbol (physname, NULL, NULL);
+      if (msym == NULL)
+       return NULL;
     }
 
-  if (!sym && !msym)
-    return NULL;
-
   v = allocate_value (ftype);
   if (sym)
     {