[PATCH] D11670: [libcxx] Disable -Wnon-virtual-dtor warning in <locale>

Eric Fiselier eric at efcs.ca
Thu Jul 30 18:43:05 PDT 2015


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. 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__


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11670.31099.patch
Type: text/x-patch
Size: 1032 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150731/b488f4b9/attachment.bin>


More information about the cfe-commits mailing list