On Thu, Jul 30, 2015 at 9:58 PM, Eric Fiselier <[email protected]> wrote: > > If the base class has a protected non-virtual dtor and the derived class > is marked final, this warning will not fire (because that interface will > ensure no > > polymorphic destruction occurs). Would that be sufficient for your needs? > > Oh, almost. I can't mark the derived class as final, but simply making > the base classes dtor protected prevents the warning. Thanks for the > information. >
Awesome :) > > On Thu, Jul 30, 2015 at 11:16 PM, David Blaikie <[email protected]> > wrote: > > > > > > On Thu, Jul 30, 2015 at 6:43 PM, Eric Fiselier <[email protected]> wrote: > >> > >> EricWF created this revision. > >> EricWF added a reviewer: mclow.lists. > >> EricWF added a subscriber: cfe-commits. > >> > >> Normally people won't see warnings in libc++ headers, but if they > compile > >> with "-Wsystem-headers -Wnon-virtual-dtor" they will likely see issues > in > >> <locale>. > >> > >> The struct `time_get` is specified as having a non-virtual protected > >> destructor but in the libc++ implementation `time_get` also has a > >> non-virtual base class with virtual methods. > > > > > > If the base class has a protected non-virtual dtor and the derived class > is > > marked final, this warning will not fire (because that interface will > ensure > > no polymorphic destruction occurs). Would that be sufficient for your > needs? > > > >> > >> I don't believe this is a bug but instead a false positive. > >> > >> > >> http://reviews.llvm.org/D11670 > >> > >> Files: > >> include/__config > >> include/locale > >> > >> Index: include/locale > >> =================================================================== > >> --- include/locale > >> +++ include/locale > >> @@ -1875,6 +1875,11 @@ > >> enum dateorder {no_order, dmy, mdy, ymd, ydm}; > >> }; > >> > >> +#if __has_warning("-Wnon-virtual-dtor") > >> +#pragma clang diagnostic push > >> +#pragma clang diagnostic ignored "-Wnon-virtual-dtor" > >> +#endif > >> + > >> template <class _CharT> > >> class _LIBCPP_TYPE_VIS_ONLY __time_get_c_storage > >> { > >> @@ -1890,6 +1895,10 @@ > >> virtual const string_type& __X() const; > >> }; > >> > >> +#if __has_warning("-Wnon-virtual-dtor") > >> +#pragma clang diagnostic pop > >> +#endif > >> + > >> template <class _CharT, class _InputIterator = > >> istreambuf_iterator<_CharT> > > >> class _LIBCPP_TYPE_VIS_ONLY time_get > >> : public locale::facet, > >> Index: include/__config > >> =================================================================== > >> --- include/__config > >> +++ include/__config > >> @@ -45,6 +45,9 @@ > >> #ifndef __is_identifier > >> #define __is_identifier(__x) 1 > >> #endif > >> +#ifndef __has_warning > >> +#define __has_warning(__x) 0 > >> +#endif > >> > >> > >> #ifdef __LITTLE_ENDIAN__ > >> > >> > >> > >> _______________________________________________ > >> cfe-commits mailing list > >> [email protected] > >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits > >> > > >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
