mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-24 13:50:49 +03:00
0024023: Revamp the OCCT Handle - gcc and clang
Adaptations for compiling with GCC 4.7 and 4.8: - Construction semantics is used for Handle objects being initialized by const Handle objects of derived type, to avoid overload resolution error in GCC 4.7. - Missing includes added. - Fixed bugs related to misuse of direct casts of handle. - Eliminate CLang warnings on uninitialized and unused variables, functions, and expressions
This commit is contained in:
@@ -33,10 +33,6 @@
|
||||
#include <memory>
|
||||
#include <typeinfo>
|
||||
|
||||
#if defined(__GNUC__) && __cplusplus < 201103L
|
||||
#include <tr1/memory>
|
||||
#endif
|
||||
|
||||
// auxiliary macro to check and report status
|
||||
#define CHECK(di,ok,what) di << "Checking " << what << (ok ? ": OK\n" : ": Error\n")
|
||||
|
||||
@@ -393,7 +389,7 @@ static Standard_Integer QAHandleInc (Draw_Interpretor& theDI,
|
||||
}
|
||||
|
||||
Handle(Standard_Transient) aHandle = new Standard_Transient();
|
||||
std::tr1::shared_ptr<Standard_Transient> aSharePtr (new Standard_Transient());
|
||||
std::shared_ptr<Standard_Transient> aSharePtr (new Standard_Transient());
|
||||
theDI << "Time of creating and destroying " << aNbIters << " smart pointers to the same object, per item, ns:";
|
||||
{
|
||||
{
|
||||
@@ -409,7 +405,7 @@ static Standard_Integer QAHandleInc (Draw_Interpretor& theDI,
|
||||
{
|
||||
QATimer aTimer (theDI, "\nsC++ shared_ptr: ", QATimer::ns, aNbIters);
|
||||
{
|
||||
std::vector< std::tr1::shared_ptr<Standard_Transient> > aSharePointers (aNbIters);
|
||||
std::vector< std::shared_ptr<Standard_Transient> > aSharePointers (aNbIters);
|
||||
for (Standard_Integer anIter = 0; anIter < aNbIters; ++anIter)
|
||||
{
|
||||
aSharePointers[anIter] = aSharePtr;
|
||||
@@ -461,14 +457,14 @@ namespace
|
||||
template<typename TFrom>
|
||||
static void doShareCast (Draw_Interpretor& theDI,
|
||||
const Standard_Integer theNbIters,
|
||||
const std::tr1::shared_ptr<TFrom>& theSharePtr)
|
||||
const std::shared_ptr<TFrom>& theSharePtr)
|
||||
{
|
||||
std::vector< std::tr1::shared_ptr<typename TTo::element_type> > aSharePointers (theNbIters);
|
||||
std::vector< std::shared_ptr<typename TTo::element_type> > aSharePointers (theNbIters);
|
||||
{
|
||||
QATimer aTimer (theDI, " ", QATimer::ns, theNbIters);
|
||||
for (Standard_Integer anIter = 0; anIter < theNbIters; ++anIter)
|
||||
{
|
||||
aSharePointers[anIter] = std::tr1::dynamic_pointer_cast<typename TTo::element_type, TFrom> (theSharePtr);
|
||||
aSharePointers[anIter] = std::dynamic_pointer_cast<typename TTo::element_type, TFrom> (theSharePtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -524,7 +520,7 @@ namespace
|
||||
}
|
||||
theDI << "\nC++ dynamic_pointer_cast: ";
|
||||
{
|
||||
std::tr1::shared_ptr<typename TAs::element_type> aPtr ((typename TAs::element_type* )theInst.Clone());
|
||||
std::shared_ptr<typename TAs::element_type> aPtr ((typename TAs::element_type* )theInst.Clone());
|
||||
QA_TEST_CAST10(0, doShareCast);
|
||||
QA_TEST_CAST10(1, doShareCast);
|
||||
QA_TEST_CAST10(2, doShareCast);
|
||||
|
@@ -489,6 +489,7 @@ void TestForwardIterator ()
|
||||
|
||||
typename CollectionType::const_iterator::value_type ct = *cit;
|
||||
ct = *cit;
|
||||
(void)ct;
|
||||
// *cit2 = ct;
|
||||
// *(cit2.operator-> ()) = t;
|
||||
|
||||
|
Reference in New Issue
Block a user