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__


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
cfe-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to