This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
[python] fix minor build problem
- From: Tom Tromey <tromey at redhat dot com>
- To: Project Archer <archer at sourceware dot org>
- Date: Fri, 07 Nov 2008 10:27:11 -0700
- Subject: [python] fix minor build problem
- Reply-to: Tom Tromey <tromey at redhat dot com>
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);