Commit Graph

15 Commits

Author SHA1 Message Date
Michael Davidsaver 88f09659e4 Workaround apparent g++12 spurious error
In file included from ../testshared.cpp:12:
In constructor ‘pvxs::shared_array<E, Enable>::shared_array(size_t, V) [with V = std::nullptr_t; E = std::unique_ptr<unsigned int>; Enable = void]’,
    inlined from ‘void {anonymous}::testComplex()’ at ../testshared.cpp:225:57:
../../src/pvxs/sharedArray.h:288:17: error: pointer used after ‘void operator delete [](void*, std::size_t)’ [-Werror=use-after-free]
  288 |         :base_t(new _E_non_const[c], c)
      |                 ^~~~~~~~~~~~~~~~~~~
In member function ‘void pvxs::detail::sa_default_delete<E>::operator()(E*) const [with E = std::unique_ptr<unsigned int>]’,
    inlined from ‘std::__shared_count<_Lp>::__shared_count(_Ptr, _Deleter, _Alloc) [with _Ptr = std::unique_ptr<unsigned int>*; _Deleter = pvxs::detail::sa_default_delete<std::unique_ptr<unsigned int> >; _Alloc = std::allocator<void>; <template-parameter-2-4> = void; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at /usr/include/c++/12/bits/shared_ptr_base.h:958:11,
    inlined from ‘std::__shared_count<_Lp>::__shared_count(_Ptr, _Deleter) [with _Ptr = std::unique_ptr<unsigned int>*; _Deleter = pvxs::detail::sa_default_delete<std::unique_ptr<unsigned int> >; <template-parameter-2-3> = void; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at /usr/include/c++/12/bits/shared_ptr_base.h:939:57,
    inlined from ‘std::__shared_ptr<_Tp, _Lp>::__shared_ptr(_Yp*, _Deleter) [with _Yp = std::unique_ptr<unsigned int>; _Deleter = pvxs::detail::sa_default_delete<std::unique_ptr<unsigned int> >; <template-parameter-2-3> = void; _Tp = std::unique_ptr<unsigned int>; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’ at /usr/include/c++/12/bits/shared_ptr_base.h:1478:17,
    inlined from ‘std::shared_ptr<_Tp>::shared_ptr(_Yp*, _Deleter) [with _Yp = std::unique_ptr<unsigned int>; _Deleter = pvxs::detail::sa_default_delete<std::unique_ptr<unsigned int> >; <template-parameter-2-3> = void; _Tp = std::unique_ptr<unsigned int>]’ at /usr/include/c++/12/bits/shared_ptr.h:232:48,
    inlined from ‘pvxs::detail::sa_base<E>::sa_base(A*, size_t) [with A = std::unique_ptr<unsigned int>; E = std::unique_ptr<unsigned int>]’ at ../../src/pvxs/sharedArray.h:136:10,
    inlined from ‘pvxs::shared_array<E, Enable>::shared_array(size_t, V) [with V = std::nullptr_t; E = std::unique_ptr<unsigned int>; Enable = void]’ at ../../src/pvxs/sharedArray.h:288:39,
    inlined from ‘void {anonymous}::testComplex()’ at ../testshared.cpp:225:57:
../../src/pvxs/sharedArray.h:92:35: note: call to ‘void operator delete [](void*, std::size_t)’ here
   92 |     void operator()(E* e) const { delete[] e; }
      |                                   ^~~~~~~~~~
2023-07-17 09:30:37 -07:00
Michael Davidsaver f4069ef596 expand testing of shared_array::convertTo 2023-02-13 07:42:54 -08:00
Michael Davidsaver e93909cf7e fix shared_array::convertTo() 2023-02-12 08:26:50 -08:00
Michael Davidsaver a7ce56ac18 add shared_array::thaw() 2023-01-26 08:23:40 -08:00
Michael Davidsaver f88733d7c6 shared_array: fix assembly from void*
CaptureBase<void> not valid
2021-05-04 16:46:41 -07:00
Michael Davidsaver 4a86694605 missing includes 2021-04-18 18:07:56 -07:00
Michael Davidsaver 0e972ecc71 more testshared 2020-07-19 21:07:15 -07:00
Michael Davidsaver 38c15e655f fix/test allocArray 2020-07-19 21:07:15 -07:00
Michael Davidsaver f2777e319b fix shared_array::convertTo() 2020-07-16 12:37:48 -07:00
Michael Davidsaver 7a9d5cb6ab WIN32: SetErrorMode(0) 2020-06-16 16:39:00 -07:00
Michael Davidsaver 88d23a0314 shared_array add iterator range ctor 2020-04-21 14:37:29 -07:00
Michael Davidsaver d811485b90 revise shared_vector casting
Rename existing castTo() as castToUnsafe().
Add new castTo() which is doesn't allow non-void -> non-void
and may throw on void -> non-void
2020-03-26 09:04:44 -07:00
Michael Davidsaver 078e0ea69f sharedArray formatting with size limit. 2020-03-19 17:15:53 -07:00
Michael Davidsaver 7dd33a0c71 shared_array redo freeze/cast as members 2019-12-15 16:43:22 -08:00
Michael Davidsaver 4c60d72f9c add shared_array
simpler version of epics::pvData::shared_vector<T>
w/ offset+capacity tracking, or value conversion.
Updated to use c++11 features (like std::type_index).
2019-12-10 17:56:40 -08:00