diff --git a/CMakeLists.txt b/CMakeLists.txt index 269fadac5..a263da35d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,7 +45,11 @@ endif(WIN32) # ================================================================================ -if(CMAKE_COMPILER_IS_GNUCXX) +if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") + set(CMAKE_COMPILER_IS_CLANGXX TRUE) +endif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX) include(cMake/ConfigureChecks.cmake) configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) add_definitions(-DHAVE_CONFIG_H) @@ -55,7 +59,7 @@ if(CMAKE_COMPILER_IS_GNUCXX) if(UNIX) # SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined") endif(UNIX) -endif(CMAKE_COMPILER_IS_GNUCXX) +endif(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX) # ================================================================================ diff --git a/src/Base/UnitsSchema.h b/src/Base/UnitsSchema.h index 012cd0917..4e68feb19 100644 --- a/src/Base/UnitsSchema.h +++ b/src/Base/UnitsSchema.h @@ -23,7 +23,7 @@ #ifndef BASE_UNITSSCHEMA_H #define BASE_UNITSSCHEMA_H - + #include #include @@ -50,6 +50,7 @@ enum UnitSystem { class UnitsSchema { public: + virtual ~UnitsSchema(){} /** get called if this schema gets activated. * Here its theoretical possible that you can change the static factors * for certain Units (e.g. mi = 1,8km instead of mi=1.6km). @@ -59,7 +60,7 @@ public: virtual void resetSchemaUnits(void){} /// this methode translate the quantity in a string as the user may expect it - virtual QString schemaTranslate(Base::Quantity quant,double &factor,QString &unitString)=0; + virtual QString schemaTranslate(Base::Quantity quant,double &factor,QString &unitString)=0; }; diff --git a/src/Base/Vector3D.cpp b/src/Base/Vector3D.cpp index 03239a858..5d11e61d9 100644 --- a/src/Base/Vector3D.cpp +++ b/src/Base/Vector3D.cpp @@ -411,5 +411,7 @@ void Vector3<_Precision>::TransformToCoordinateSystem (const Vector3 &rclBase, } // explicit template instantiation +namespace Base { template class BaseExport Vector3; template class BaseExport Vector3; +} diff --git a/src/Gui/Selection.h b/src/Gui/Selection.h index fa810f56b..fbcde44dc 100644 --- a/src/Gui/Selection.h +++ b/src/Gui/Selection.h @@ -88,20 +88,20 @@ public: // Export an instance of the base class (to avoid warning C4275, see also // C++ Language Reference/General Rules and Limitations on MSDN for more details.) // -// For compiler gcc4.1 we need to define the template class outside namespace 'Gui' +// For compiler gcc4.1 we need to define the template class outside namespace 'Gui' // otherwise we get the compiler error: -// 'explicit instantiation of 'class Base::Subject' -// in namespace 'Gui' (which does not enclose namespace 'Base') -// -// It seems that this costruct is not longer needed for gcc4.4 and even leads to +// 'explicit instantiation of 'class Base::Subject' +// in namespace 'Gui' (which does not enclose namespace 'Base') +// +// It seems that this costruct is not longer needed for gcc4.4 and even leads to // errors under Mac OS X. Thus, we check for version between 4.1 and 4.4. // It seems that for Mac OS X this can be completely ignored -#if defined(__GNUC__) && defined(__GNUC_MINOR__) && !defined(FC_OS_MACOSX) +#if defined(__GNUC__) && defined(__GNUC_MINOR__) && !defined(FC_OS_MACOSX) #define GNUC_VERSION (((__GNUC__)<<16)+((__GNUC_MINOR__)<<8)) #if GNUC_VERSION >= 0x040100 && GNUC_VERSION < 0x040400 -template class GuiExport Base::Subject; -#endif +template class GuiExport Base::Subject; +#endif #undef GNUC_VERSION #endif @@ -130,11 +130,11 @@ public: void detachSelection(); private: - virtual void onSelectionChanged(const SelectionChanges& msg) = 0; - -private: - typedef boost::signals::connection Connection; - Connection connectSelection; + virtual void onSelectionChanged(const SelectionChanges& msg) = 0; + +private: + typedef boost::signals::connection Connection; + Connection connectSelection; }; /** @@ -156,7 +156,7 @@ public: static void removeObserver(const Py::Object& obj); private: - void onSelectionChanged(const SelectionChanges& msg); + void onSelectionChanged(const SelectionChanges& msg); void addSelection(const SelectionChanges&); void removeSelection(const SelectionChanges&); void setSelection(const SelectionChanges&); @@ -165,8 +165,8 @@ private: void removePreselection(const SelectionChanges&); private: - Py::Object inst; - static std::vector _instances; + Py::Object inst; + static std::vector _instances; }; /** SelectionGate @@ -176,6 +176,7 @@ private: class SelectionGate { public: + virtual ~SelectionGate(){} virtual bool allow(App::Document*,App::DocumentObject*, const char*)=0; }; diff --git a/src/Mod/Fem/Gui/TaskObjectName.cpp b/src/Mod/Fem/Gui/TaskObjectName.cpp index 890e2f5ad..55ed8510a 100644 --- a/src/Mod/Fem/Gui/TaskObjectName.cpp +++ b/src/Mod/Fem/Gui/TaskObjectName.cpp @@ -60,7 +60,7 @@ TaskObjectName::TaskObjectName(App::DocumentObject *pcObject,QWidget *parent) QObject::connect(ui->lineEdit_ObjectName,SIGNAL(textChanged (const QString&)),this,SLOT(TextChanged(const QString&))); - if(pcObject->Label.getValue() != "") + if(strcmp(pcObject->Label.getValue(),"") != 0) ui->lineEdit_ObjectName->setText(QString::fromUtf8(pcObject->Label.getValue())); else ui->lineEdit_ObjectName->setText(QString::fromAscii(pcObject->getNameInDocument())); diff --git a/src/Mod/Mesh/App/Core/Iterator.h b/src/Mod/Mesh/App/Core/Iterator.h index db610d4fb..d24d482e2 100644 --- a/src/Mod/Mesh/App/Core/Iterator.h +++ b/src/Mod/Mesh/App/Core/Iterator.h @@ -27,7 +27,7 @@ #include "MeshKernel.h" #include "Elements.h" #include -#include +#include #include namespace MeshCore { @@ -382,7 +382,7 @@ inline MeshFacetIterator& MeshFacetIterator::operator = (const MeshFacetIterator _bApply = rpI._bApply; _clTrf = rpI._clTrf; // dirty flat copy of reference - memcpy((void*)&_rclMesh, &rpI._rclMesh, sizeof(&_rclMesh)); + memcpy((void*)&_rclMesh, &rpI._rclMesh, sizeof(MeshKernel*)); return *this; } @@ -470,7 +470,7 @@ inline MeshPointIterator& MeshPointIterator::operator = (const MeshPointIterator _bApply = rpI._bApply; _clTrf = rpI._clTrf; // dirty flat copy of reference - memcpy((void*)&_rclMesh, &rpI._rclMesh, sizeof(&_rclMesh)); + memcpy((void*)&_rclMesh, &rpI._rclMesh, sizeof(MeshKernel*)); return *this; } diff --git a/src/Mod/Mesh/App/MeshPyImp.cpp b/src/Mod/Mesh/App/MeshPyImp.cpp index e10eea3f4..704e22679 100644 --- a/src/Mod/Mesh/App/MeshPyImp.cpp +++ b/src/Mod/Mesh/App/MeshPyImp.cpp @@ -1031,11 +1031,11 @@ PyObject* MeshPy::splitEdge(PyObject *args) const MeshCore::MeshKernel& kernel = getMeshObjectPtr()->getKernel(); PY_TRY { - if (facet < 0 || facet >= kernel.CountFacets()) { + if (facet >= kernel.CountFacets()) { PyErr_SetString(PyExc_IndexError, "Facet index out of range"); return NULL; } - if (neighbour < 0 || neighbour >= kernel.CountFacets()) { + if (neighbour >= kernel.CountFacets()) { PyErr_SetString(PyExc_IndexError, "Facet index out of range"); return NULL; } @@ -1072,7 +1072,7 @@ PyObject* MeshPy::splitFacet(PyObject *args) const MeshCore::MeshKernel& kernel = getMeshObjectPtr()->getKernel(); PY_TRY { - if (facet < 0 || facet >= kernel.CountFacets()) { + if (facet >= kernel.CountFacets()) { PyErr_SetString(PyExc_IndexError, "Facet index out of range"); return NULL; } @@ -1091,11 +1091,11 @@ PyObject* MeshPy::swapEdge(PyObject *args) const MeshCore::MeshKernel& kernel = getMeshObjectPtr()->getKernel(); PY_TRY { - if (facet < 0 || facet >= kernel.CountFacets()) { + if (facet >= kernel.CountFacets()) { PyErr_SetString(PyExc_IndexError, "Facet index out of range"); return NULL; } - if (neighbour < 0 || neighbour >= kernel.CountFacets()) { + if (neighbour >= kernel.CountFacets()) { PyErr_SetString(PyExc_IndexError, "Facet index out of range"); return NULL; } @@ -1121,11 +1121,11 @@ PyObject* MeshPy::collapseEdge(PyObject *args) const MeshCore::MeshKernel& kernel = getMeshObjectPtr()->getKernel(); PY_TRY { - if (facet < 0 || facet >= kernel.CountFacets()) { + if (facet >= kernel.CountFacets()) { PyErr_SetString(PyExc_IndexError, "Facet index out of range"); return NULL; } - if (neighbour < 0 || neighbour >= kernel.CountFacets()) { + if (neighbour >= kernel.CountFacets()) { PyErr_SetString(PyExc_IndexError, "Facet index out of range"); return NULL; } @@ -1150,7 +1150,7 @@ PyObject* MeshPy::collapseFacet(PyObject *args) return NULL; PY_TRY { - if (facet < 0 || facet >= getMeshObjectPtr()->countFacets()) { + if (facet >= getMeshObjectPtr()->countFacets()) { PyErr_SetString(PyExc_IndexError, "Facet index out of range"); return NULL; } @@ -1173,7 +1173,7 @@ PyObject* MeshPy::insertVertex(PyObject *args) Base::Vector3f v((float)val->x,(float)val->y,(float)val->z); PY_TRY { - if (facet < 0 || facet >= getMeshObjectPtr()->countFacets()) { + if (facet >= getMeshObjectPtr()->countFacets()) { PyErr_SetString(PyExc_IndexError, "Facet index out of range"); return NULL; } @@ -1196,7 +1196,7 @@ PyObject* MeshPy::snapVertex(PyObject *args) Base::Vector3f v((float)val->x,(float)val->y,(float)val->z); PY_TRY { - if (facet < 0 || facet >= getMeshObjectPtr()->countFacets()) { + if (facet >= getMeshObjectPtr()->countFacets()) { PyErr_SetString(PyExc_IndexError, "Facet index out of range"); return NULL; } diff --git a/src/Mod/Raytracing/Gui/Command.cpp b/src/Mod/Raytracing/Gui/Command.cpp index 08aff2a28..275a36dd3 100644 --- a/src/Mod/Raytracing/Gui/Command.cpp +++ b/src/Mod/Raytracing/Gui/Command.cpp @@ -558,7 +558,7 @@ CmdRaytracingRender::CmdRaytracingRender() void CmdRaytracingRender::activated(int iMsg) { // determining render type - const char* renderType; + std::string renderType; unsigned int n1 = getSelection().countObjectsOfType(Raytracing::RayProject::getClassTypeId()); if (n1 != 1) { unsigned int n2 = getSelection().countObjectsOfType(Raytracing::LuxProject::getClassTypeId());