[cfe-commits] [patch][libcxxabi] Fix a -Wsometimes-uninitialized warning in cxa_demangle.cpp

Andrew C. Morrow andrew.c.morrow at gmail.com
Sun Jul 29 08:06:39 PDT 2012


Hi -

The variable 't1' on line 10188 of cxa_demangle.cpp is uninitialized
which generates the following warning when building libcxxabi with
clang++ -Wall:


src/libcxxabi/src/cxa_demangle.cpp:10263:18: warning: variable 't1' is
used uninitialized whenever switch case is taken
[-Wsometimes-uninitialized]
            case 'U':
                 ^~~
src/libcxxabi/src/cxa_demangle.cpp:10338:17: note: uninitialized use occurs here
            if (t1 == t0 || t1 == last)
                ^~
src/libcxxabi/src/cxa_demangle.cpp:10188:27: note: initialize the
variable 't1' to silence this warning
            const char* t1;
                          ^
                           = nullptr


I've attached a patch that initializes 't1' to NULL. This is also the
first patch I've generated from a tree based on the LLVM git mirrors
rather than from svn, so I hope it is OK.

Thanks,
Andrew
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libcxxabi.demangle.uninit.patch
Type: application/octet-stream
Size: 451 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120729/bfa72d8b/attachment.obj>


More information about the cfe-commits mailing list