Fix several compiler warnings

* fix -Winconsistent-missing-override
* fix -Wunused-but-set-variable
* fix -Wunused-parameter
* fix -Wunused-lambda-capture
* fix -Wunused-private-field
* fix -Wpessimizing-move
This commit is contained in:
wmayer
2024-04-03 07:29:46 +02:00
committed by wwmayer
parent 4263ab1937
commit c96fd71e4f
9 changed files with 16 additions and 14 deletions

View File

@@ -803,8 +803,7 @@ void Application::createStandardOperations()
void Application::slotNewDocument(const App::Document& Doc, bool isMainDoc)
{
#ifdef FC_DEBUG
std::map<const App::Document*, Gui::Document*>::const_iterator it = d->documents.find(&Doc);
assert(it==d->documents.end());
assert(d->documents.find(&Doc) == d->documents.end());
#endif
auto pDoc = new Gui::Document(const_cast<App::Document*>(&Doc),this);
d->documents[&Doc] = pDoc;

View File

@@ -238,7 +238,7 @@ void WorkbenchTabWidget::buildPrefMenu()
menu->addSeparator();
QAction* preferencesAction = menu->addAction(tr("Preferences"));
connect(preferencesAction, &QAction::triggered, this, [this]() {
connect(preferencesAction, &QAction::triggered, this, []() {
Gui::Dialog::DlgPreferencesImp cDlg(getMainWindow());
cDlg.activateGroupPage(QString::fromUtf8("Workbenches"), 0);
cDlg.exec();

View File

@@ -51,11 +51,11 @@ namespace Part
class PartExport FaceMaker: public BRepBuilderAPI_MakeShape, public Base::BaseClass
{
Q_DECLARE_TR_FUNCTIONS(FaceMaker)
TYPESYSTEM_HEADER();
TYPESYSTEM_HEADER_WITH_OVERRIDE();
public:
FaceMaker() {}
virtual ~FaceMaker() {}
~FaceMaker() override {}
void addTopoShape(const TopoShape &s);
void useTopoCompound(const TopoShape &comp);
@@ -90,7 +90,7 @@ public:
#if OCC_VERSION_HEX >= 0x070600
void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) override;
#else
virtual void Build();
void Build() override;
#endif
//fails to compile, huh!
@@ -132,7 +132,7 @@ protected:
*/
class PartExport FaceMakerPublic : public FaceMaker
{
TYPESYSTEM_HEADER();
TYPESYSTEM_HEADER_WITH_OVERRIDE();
public:
virtual std::string getUserFriendlyName() const = 0;
virtual std::string getBriefExplanation() const = 0;

View File

@@ -1186,6 +1186,7 @@ const App::PropertyComplexGeoData* Feature::getPropertyOfGeometry() const
bool Feature::isElementMappingDisabled(App::PropertyContainer* container)
{
(void)container;
#ifdef FC_USE_TNP_FIX
return false;
#else

View File

@@ -1728,9 +1728,7 @@ public:
if (FC_LOG_INSTANCE.level() <= FC_LOGLEVEL_TRACE) {
return;
}
int idx = 0;
for (auto &info : edges) {
++idx;
if (auto wire = info.wireInfo.get()) {
// Originally here there was a call to the precompiler macro assertCheck(), which

View File

@@ -249,7 +249,7 @@ private:
Obj->getSymmetric(listOfGeoIds, dummy1, dummy2, refGeoId, refPosId);
for (auto* geo : symGeos) {
ShapeGeometry.emplace_back(std::move(std::unique_ptr<Part::Geometry>(geo)));
ShapeGeometry.emplace_back(geo);
}
}
}

View File

@@ -22,6 +22,7 @@
#include "PreCompiled.h"
#ifndef _PreComp_
#include <boost/core/ignore_unused.hpp>
#include <Inventor/SbBox3f.h>
#include <Inventor/SbLine.h>
#include <Inventor/SbTime.h>
@@ -1747,6 +1748,8 @@ void ViewProviderSketch::moveConstraint(Sketcher::Constraint* Constr, int constN
assert(int(geomlist.size()) == extGeoCount + intGeoCount);
assert((Constr->First >= -extGeoCount && Constr->First < intGeoCount)
|| Constr->First != GeoEnum::GeoUndef);
boost::ignore_unused(intGeoCount);
boost::ignore_unused(extGeoCount);
#endif
if (Constr->Type == Distance || Constr->Type == DistanceX || Constr->Type == DistanceY

View File

@@ -59,8 +59,6 @@ protected:
private:
std::unique_ptr<Ui_DlgPrefsTechDrawAnnotationImp> ui;
TechDraw::LineGenerator* m_lineGenerator;
bool m_blockLineStandardOnChanged{false};
};
} // namespace TechDrawGui

View File

@@ -2,6 +2,7 @@
#include "gtest/gtest.h"
#include <boost/core/ignore_unused.hpp>
#include "Mod/Part/App/FeaturePartCommon.h"
#include <src/App/InitApplication.h>
#include <BRepBuilderAPI_MakeVertex.hxx>
@@ -132,7 +133,6 @@ TEST_F(FeaturePartTest, create)
TEST_F(FeaturePartTest, getElementHistory)
{
// Arrange
const char* name = "Part__Box";
const char* name2 = "Edge2"; // Edge, Vertex, or Face. will work here.
// Act
auto result = Feature::getElementHistory(_boxes[0], name2, true, false);
@@ -156,6 +156,7 @@ TEST_F(FeaturePartTest, getRelatedElements)
auto label1 = _common->Label.getValue();
auto label2 = _boxes[1]->Label.getValue();
const TopoShape& ts = _common->Shape.getShape();
boost::ignore_unused(ts);
auto result = Feature::getRelatedElements(_doc->getObject(label1),
"Edge2",
HistoryTraceType::followTypeChange,
@@ -189,6 +190,9 @@ TEST_F(FeaturePartTest, getElementFromSource)
auto label1 = _common->Label.getValue();
auto label2 = _boxes[1]->Label.getValue();
const TopoShape& ts = _common->Shape.getShape();
boost::ignore_unused(label1);
boost::ignore_unused(label2);
boost::ignore_unused(ts);
auto element = Feature::getElementFromSource(_common,
"Part__Box001", // "Edge1",
_boxes[0],
@@ -204,7 +208,6 @@ TEST_F(FeaturePartTest, getSubObject)
_common->Base.setValue(_boxes[0]);
_common->Tool.setValue(_boxes[1]);
App::DocumentObject sourceObject;
const char* sourceSubElement;
PyObject* pyObj;
// Act
_common->execute();