fix several kind of warnings:

+ fix -Wparentheses/-Wlogical-op-parentheses
+ fix -Wunused-variable
+ disable -Wundefined-var-template due to many false-positives (clang)
+ fix -Winconsistent-missing-override
+ fix -Wmaybe-uninitialized
This commit is contained in:
wmayer
2017-10-15 19:12:07 +02:00
parent 33b3a202ed
commit 8b2fcf3677
5 changed files with 8 additions and 9 deletions

View File

@@ -101,6 +101,9 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
endif(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
if(CMAKE_COMPILER_IS_CLANGXX)
# Disable warning about potentially uninstantiated static members
# because it leads to a lot of false-positives.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-undefined-var-template")
# older boost.preprocessor turn off variadics for clang
add_definitions(-DBOOST_PP_VARIADICS=1)
message(STATUS "Force BOOST_PP_VARIADICS=1 for clang")

View File

@@ -289,7 +289,6 @@ void Gui::QuantitySpinBox::setExpression(boost::shared_ptr<Expression> expr)
QString QuantitySpinBox::boundToName() const
{
Q_D(const QuantitySpinBox);
if (isBound()) {
std::string path = getPath().toString();
return QString::fromStdString(path);
@@ -305,7 +304,6 @@ QString QuantitySpinBox::boundToName() const
*/
void QuantitySpinBox::setBoundToByName(const QString &name)
{
Q_D(QuantitySpinBox);
try {
// get document
App::Document *doc = App::GetApplication().getActiveDocument();
@@ -350,7 +348,6 @@ void QuantitySpinBox::setBoundToByName(const QString &name)
QString Gui::QuantitySpinBox::expressionText() const
{
Q_D(const QuantitySpinBox);
try {
if (hasExpression()) {
return QString::fromStdString(getExpressionString());

View File

@@ -22,6 +22,7 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <cfloat>
#endif
#include <boost/version.hpp>
@@ -2804,9 +2805,8 @@ std::list<TopoDS_Shape> Area::sortWires(const std::list<TopoDS_Shape> &shapes,
double max_dist = sort_mode==SortModeGreedy?threshold*threshold:0;
while(shape_list.size()) {
AREA_TRACE("sorting " << shape_list.size() << ' ' << AREA_XYZ(pstart));
double best_d;
double best_d = DBL_MAX;
auto best_it = shape_list.begin();
bool first = true;
for(auto it=best_it;it!=shape_list.end();++it) {
double d;
gp_Pnt pt;
@@ -2814,8 +2814,7 @@ std::list<TopoDS_Shape> Area::sortWires(const std::list<TopoDS_Shape> &shapes,
d = it->myPln.SquareDistance(pstart);
else
d = it->nearest(pstart);
if(first || d<best_d) {
first = false;
if(d < best_d) {
best_it = it;
best_d = d;
}

View File

@@ -2463,7 +2463,7 @@ void ViewProviderSketch::doBoxSelection(const SbVec2s &startPos, const SbVec2s &
// forces the user to select much more than the curve (all the poles) and it would not select the curve in cases
// where it is indeed comprised in the box.
// The implementation of the touch mode is also far from a desirable "touch" as it only recognizes touched points not the curve itself
if (pnt1Inside && pnt2Inside || (touchMode && (pnt1Inside || pnt2Inside))) {
if ((pnt1Inside && pnt2Inside) || (touchMode && (pnt1Inside || pnt2Inside))) {
std::stringstream ss;
ss << "Edge" << GeoId + 1;
Gui::Selection().addSelection(doc->getName(), sketchObject->getNameInDocument(), ss.str().c_str());

View File

@@ -50,7 +50,7 @@ namespace TechDraw
*/
class TechDrawExport DrawViewMulti : public DrawViewPart
{
PROPERTY_HEADER(Part::DrawViewMulti);
PROPERTY_HEADER_WITH_OVERRIDE(Part::DrawViewMulti);
public:
/// Constructor