[libcxx-commits] [PATCH] D61109: Remove incorrect explicit instantiation declarations for valarray

Richard Smith - zygoloid via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Apr 24 18:33:24 PDT 2019


rsmith created this revision.
rsmith added reviewers: EricWF, ldionne.
Herald added a subscriber: dexonsmith.

libc++ ABI v1 provides three valarray symbols as part of the shared library:

  valarray<size_t>::valarray(size_t)
  valarray<size_t>::~valarray()
  valarray<size_t>::resize(size_t, size_t)

The first two of these appear to be intended to be removed in V2 of the ABI: they're attributed `_LIBCPP_HIDE_FROM_ABI_AFTER_V1`, and looking through the commit history it appears that the intention is that these symbols from the library are not used even when building using the V1 ABI. However, there are explicit instantiation declarations for all three symbols in the header, which are wrong as we do not intend to find an instantiation of these functions that is provided elsewhere.

(A recent change to clang to properly diagnose explicit instantiation declarations of internal linkage functions -- required by [temp.explicit]p13 -- had to be rolled back because it diagnosed these explicit instantiations.)

Remove the explicit instantiation declarations, and remove the explicit instantiation definitions for V2 of the libc++ ABI onwards.


Repository:
  rCXX libc++

https://reviews.llvm.org/D61109

Files:
  include/valarray
  lib/abi/x86_64-apple-darwin.v2.abilist
  src/valarray.cpp


Index: src/valarray.cpp
===================================================================
--- src/valarray.cpp
+++ src/valarray.cpp
@@ -10,8 +10,10 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+#if _LIBCPP_ABI_VERSION == 1
 template valarray<size_t>::valarray(size_t);
 template valarray<size_t>::~valarray();
+#endif
 template void valarray<size_t>::resize(size_t, size_t);
 
 void
Index: lib/abi/x86_64-apple-darwin.v2.abilist
===================================================================
--- lib/abi/x86_64-apple-darwin.v2.abilist
+++ lib/abi/x86_64-apple-darwin.v2.abilist
@@ -1380,10 +1380,6 @@
 {'is_defined': True, 'name': '__ZNSt3__28time_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE2idE', 'size': 0, 'type': 'OBJECT'}
 {'is_defined': True, 'name': '__ZNSt3__28time_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE2idE', 'size': 0, 'type': 'OBJECT'}
 {'is_defined': True, 'name': '__ZNSt3__28valarrayImE6resizeEmm', 'type': 'FUNC'}
-{'is_defined': True, 'name': '__ZNSt3__28valarrayImEC1Em', 'type': 'FUNC'}
-{'is_defined': True, 'name': '__ZNSt3__28valarrayImEC2Em', 'type': 'FUNC'}
-{'is_defined': True, 'name': '__ZNSt3__28valarrayImED1Ev', 'type': 'FUNC'}
-{'is_defined': True, 'name': '__ZNSt3__28valarrayImED2Ev', 'type': 'FUNC'}
 {'is_defined': True, 'name': '__ZNSt3__29__num_getIcE17__stage2_int_loopEciPcRS2_RjcRKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPjRSD_PKc', 'type': 'FUNC'}
 {'is_defined': True, 'name': '__ZNSt3__29__num_getIcE17__stage2_int_prepERNS_8ios_baseERc', 'type': 'FUNC'}
 {'is_defined': True, 'name': '__ZNSt3__29__num_getIcE19__stage2_float_loopEcRbRcPcRS4_ccRKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEPjRSE_RjS4_', 'type': 'FUNC'}
Index: include/valarray
===================================================================
--- include/valarray
+++ include/valarray
@@ -1059,8 +1059,6 @@
     valarray& __assign_range(const value_type* __f, const value_type* __l);
 };
 
-_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS valarray<size_t>::valarray(size_t))
-_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS valarray<size_t>::~valarray())
 _LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void valarray<size_t>::resize(size_t, size_t))
 
 template <class _Op, class _Tp>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61109.196563.patch
Type: text/x-patch
Size: 2234 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190425/0fecd7e1/attachment-0001.bin>


More information about the libcxx-commits mailing list