Message ID | CAFULd4b1wMYmGosnnoCR_f3-hTjc2g0V1PAVKKCwzpEjLcQ1=Q@mail.gmail.com |
---|---|
State | New |
Headers | show |
Hi, On 08/07/2013 10:48 PM, Uros Bizjak wrote: > 2013-08-07 Uros Bizjak <ubizjak@gmail.com> > > * src/c++98/compatibility.cc (_ZTIe): Use const_cast to avoid warning. > (_ZTIPe): Ditto. > (ZTIPKe): Ditto. > > The patch was bootstrapped on alpha-linux-gnu, regression test is still running. > > OK for mainline if regtest shows no problems? Also for 4.8? I think you want in any case Jakub to have a look. Paolo.
On Wed, Aug 07, 2013 at 11:47:55PM +0200, Paolo Carlini wrote: > Hi, > > On 08/07/2013 10:48 PM, Uros Bizjak wrote: > >2013-08-07 Uros Bizjak <ubizjak@gmail.com> > > > > * src/c++98/compatibility.cc (_ZTIe): Use const_cast to avoid warning. > > (_ZTIPe): Ditto. > > (ZTIPKe): Ditto. > > > >The patch was bootstrapped on alpha-linux-gnu, regression test is still running. > > > >OK for mainline if regtest shows no problems? Also for 4.8? > I think you want in any case Jakub to have a look. Changing all those (void *) casts into (const void *) in the _ZTIe, _ZTIPe and _ZTIPKe initializers seems to also work. I'm not really a C++ guy, so I'll leave whether (const void *) or const_cast should be used to libstdc++ maintainers. I'm just surprised you haven't changed all the spots, just some of them, and (void *) &_ZTVN10__cxxabiv123__fundamental_type_infoE[2] and similar and (void *) 1L etc. were left untouched. Jakub
On Wed, Aug 14, 2013 at 10:29 AM, Jakub Jelinek <jakub@redhat.com> wrote: >> >2013-08-07 Uros Bizjak <ubizjak@gmail.com> >> > >> > * src/c++98/compatibility.cc (_ZTIe): Use const_cast to avoid warning. >> > (_ZTIPe): Ditto. >> > (ZTIPKe): Ditto. >> > >> >The patch was bootstrapped on alpha-linux-gnu, regression test is still running. >> > >> >OK for mainline if regtest shows no problems? Also for 4.8? >> I think you want in any case Jakub to have a look. > > Changing all those (void *) casts into (const void *) in the _ZTIe, > _ZTIPe and _ZTIPKe initializers seems to also work. I'm not really a C++ > guy, so I'll leave whether (const void *) or const_cast should be used > to libstdc++ maintainers. I'm just surprised you haven't changed > all the spots, just some of them, and > (void *) &_ZTVN10__cxxabiv123__fundamental_type_infoE[2] and similar > and (void *) 1L etc. were left untouched. These didn't emit warnings for my target (alpha), so also not being a C++ person, I left them as they were. Uros.
On 08/14/2013 10:41 AM, Uros Bizjak wrote: > These didn't emit warnings for my target (alpha), so also not being a > C++ person, I left them as they were. Ok then, for now let's simply go ahead with your original patch. Please also add a one line comment before the first cast. Thanks! Paolo.
Index: src/c++98/compatibility.cc =================================================================== --- src/c++98/compatibility.cc (revision 201568) +++ src/c++98/compatibility.cc (working copy) @@ -518,13 +518,15 @@ extern __attribute__((used, weak)) const char _ZTSPKe[4] = "PKe"; extern __attribute__((used, weak)) const void * const _ZTIe[2] = { (void *) &_ZTVN10__cxxabiv123__fundamental_type_infoE[2], - (void *) _ZTSe }; + const_cast<char*>(_ZTSe) }; extern __attribute__((used, weak)) const void * const _ZTIPe[4] = { (void *) &_ZTVN10__cxxabiv119__pointer_type_infoE[2], - (void *) _ZTSPe, (void *) 0L, (void *) _ZTIe }; + const_cast<char*>(_ZTSPe), (void *) 0L, + const_cast<void* const*>(_ZTIe) }; extern __attribute__((used, weak)) const void * const _ZTIPKe[4] = { (void *) &_ZTVN10__cxxabiv119__pointer_type_infoE[2], - (void *) _ZTSPKe, (void *) 1L, (void *) _ZTIe }; + const_cast<char*>(_ZTSPKe), (void *) 1L, + const_cast<void* const*>(_ZTIe) }; #endif // _GLIBCXX_LONG_DOUBLE_COMPAT #ifdef _GLIBCXX_SYMVER_DARWIN