This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH, libiberty: silence warning
- From: Ben Elliston <bje at au1 dot ibm dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 02 Jan 2009 11:03:02 +1100
- Subject: Re: PATCH, libiberty: silence warning
- References: <1229575531.30583.2.camel@helios> <m33agm5649.fsf@google.com>
On Wed, 2008-12-17 at 22:50 -0800, Ian Lance Taylor wrote:
> > This patch silences a warning about a potentially uninitialised variable
> > when compiling cp-demangle.c. This is arguably a weakness of my build
> > system compiler, but I don't see any harm in initialising it.
> >
> > Okay for the trunk?
> >
> > 2008-12-18 Ben Elliston <bje@auibm.com>
> >
> > * cp-demangle.c (cplus_demangle_type): Initialise ret.
>
> I think the warning is correct. What happens if you fix the 'D' case
> in that function to add a default to the switch which returns NULL?
Ah, right you are. That fixes the warning. Okay for the trunk?
2009-01-02 Ben Elliston <bje@au.ibm.com>
* cp-demangle.c (cplus_demangle_type): Return NULL if the
character following a 'D' cannot be recognised.
Index: cp-demangle.c
===================================================================
--- cp-demangle.c (revision 142998)
+++ cp-demangle.c (working copy)
@@ -2131,6 +2131,9 @@ cplus_demangle_type (struct d_info *di)
peek = d_next_char (di);
ret->u.s_fixed.sat = (peek == 's');
break;
+
+ default:
+ return NULL;
}
break;