This is the mail archive of the archer@sourceware.org mailing list for the Archer project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[python] fix minor build problem


python-type.c failed to compile with -g -O2.
This patch fixes the problem.  GCC was complaining about 'type' being
possibly uninitialized; the fix below moves the switch into the 'if'
to avoid this.

Tom

2008-11-07  Tom Tromey  <tromey@redhat.com>

	* python/python-type.c (typy_lookup_type): Rearrange to avoid
	warning.

diff --git a/gdb/python/python-type.c b/gdb/python/python-type.c
index 5162986..77bb489 100644
--- a/gdb/python/python-type.c
+++ b/gdb/python/python-type.c
@@ -143,17 +143,18 @@ typy_lookup_type (struct demangle_component *demangled,
       type = typy_lookup_type (demangled->u.s_binary.left, block);
       if (! type)
 	return NULL;
-    }
-  switch (demangled->type)
-    {
-    case DEMANGLE_COMPONENT_REFERENCE:
-      return lookup_reference_type (type);
-    case DEMANGLE_COMPONENT_POINTER:
-      return lookup_pointer_type (type);
-    case DEMANGLE_COMPONENT_CONST:
-      return make_cv_type (1, 0, type, NULL);
-    case DEMANGLE_COMPONENT_VOLATILE:
-      return make_cv_type (0, 1, type, NULL);
+
+      switch (demangled->type)
+	{
+	case DEMANGLE_COMPONENT_REFERENCE:
+	  return lookup_reference_type (type);
+	case DEMANGLE_COMPONENT_POINTER:
+	  return lookup_pointer_type (type);
+	case DEMANGLE_COMPONENT_CONST:
+	  return make_cv_type (1, 0, type, NULL);
+	case DEMANGLE_COMPONENT_VOLATILE:
+	  return make_cv_type (0, 1, type, NULL);
+	}
     }
 
   type_name = cp_comp_to_string (demangled, 10);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]