This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

Re: PATCH, libiberty: silence warning


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;
 



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