Closed Flamefire closed 2 years ago
Merging #81 (f89dccf) into develop (608e015) will decrease coverage by
0.03%
. The diff coverage is77.77%
.
@@ Coverage Diff @@
## develop #81 +/- ##
===========================================
- Coverage 80.07% 80.04% -0.04%
===========================================
Files 76 76
Lines 5958 5959 +1
===========================================
- Hits 4771 4770 -1
- Misses 1187 1189 +2
Impacted Files | Coverage Δ | |
---|---|---|
include/boost/locale/conversion.hpp | 100.00% <ø> (ø) |
|
include/boost/locale/info.hpp | 100.00% <ø> (ø) |
|
include/boost/locale/util.hpp | 0.00% <ø> (-12.00%) |
:arrow_down: |
src/util/info.cpp | 76.92% <ø> (ø) |
|
src/shared/ids.cpp | 88.88% <66.66%> (-11.12%) |
:arrow_down: |
include/boost/locale/message.hpp | 92.90% <100.00%> (-0.10%) |
:arrow_down: |
src/util/codecvt_converter.cpp | 71.92% <100.00%> (+0.16%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update dbeb8f1...f89dccf. Read the comment docs.
UBSAN on OSX reports some invalid downcasts, for example:
Note that
boost::locale::util::simple_info
is a subclass ofboost::locale::info
, hence the cast is valid.In most cases the classes were already correctly decorated with
BOOST_LOCALE_DECL
but as the whole class was defined inline the library and the executable linking to it may get different VTables (i.e. an own copy each which the runtime linker doesn't combine)So far 2 solutions work:
BOOST_SYMBOL_VISIBLE
on the class andBOOST_LOCALE_DECL
on members as required (e.g. static member variables)BOOST_LOCALE_DECL
on the class and adding an out-of-line virtual destructor (likely any virtual method out-of-line will do)@pdimov explained via Slack
Hence for most classes I made sure they are decorated with
BOOST_LOCALE_DECL
and have a (virtual) destructor defined in one of the libraries source files.For template classes this doesn't work directly as defining a member requires defining the class specialization. Hence 2 solutions are used (I mostly kept what was used before):
BOOST_LOCALE_DECL
+ defined (virtual) destructor approach can be used. See e.g.boundary_indexing
&converter
std::locale::facet
and the requiredstd::locale::id
and use the same approach as above (BOOST_LOCALE_DECL
+ dtor) to get the definitions of the ids then inherit from that and decorate that template class withBOOST_SYMBOL_VISIBLE
to get (unified) VTables. See(base_)message_format
There might be a better solution which avoids that C&P specializations by only instantiating the template and define the static data member specialization:
But I can't do that for std::locale::id as it isn't copyable and brace-init is C++11 but we still support C++98. Also I'm not sure what happens to the VTable in that case, i.e. how to define and correctly export/import the virtual destructor (and with it the VTable)