Clang warnings.

--HG--
branch : release
This commit is contained in:
Roman Telezhynskyi 2015-03-16 14:23:02 +02:00
parent cabac6f3d0
commit 7555c67c3e
21 changed files with 93 additions and 43 deletions

View File

@ -99,6 +99,12 @@ CONFIG(debug, debug|release){
-isystem "$${OUT_PWD}/$${MOC_DIR}" \
-isystem "$${OUT_PWD}/$${RCC_DIR}" \
$$CLANG_DEBUG_CXXFLAGS # See Valentina.pri for more details.
# -isystem key works only for headers. In some cases it's not enough. But we can't delete this warnings and
# want them in global list. Compromise decision delete them from local list.
QMAKE_CXXFLAGS -= \
-Wmissing-prototypes \
-Wundefined-reinterpret-cast
}
} else {
*-g++{

View File

@ -98,7 +98,8 @@ void DialogLayoutSettings::SetPaperWidth(int value)
//---------------------------------------------------------------------------------------------------------------------
unsigned int DialogLayoutSettings::GetShift() const
{
return qFloor(VAbstractMeasurements::UnitConvertor(ui->doubleSpinBoxShift->value(), oldLayoutUnit, Unit::Px));
return static_cast<quint32>(qFloor(VAbstractMeasurements::UnitConvertor(ui->doubleSpinBoxShift->value(),
oldLayoutUnit, Unit::Px)));
}
//---------------------------------------------------------------------------------------------------------------------
@ -110,7 +111,8 @@ void DialogLayoutSettings::SetShift(unsigned int value)
//---------------------------------------------------------------------------------------------------------------------
unsigned int DialogLayoutSettings::GetLayoutWidth() const
{
return qFloor(VAbstractMeasurements::UnitConvertor(ui->doubleSpinBoxLayoutWidth->value(), oldLayoutUnit, Unit::Px));
return static_cast<quint32>(qFloor(VAbstractMeasurements::UnitConvertor(ui->doubleSpinBoxLayoutWidth->value(),
oldLayoutUnit, Unit::Px)));
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -401,7 +401,7 @@ void DialogArc::ShowLineAngles()
//---------------------------------------------------------------------------------------------------------------------
void DialogArc::CheckAngles()
{
if (angleF1 == INT_MIN || angleF2 == INT_MIN)
if (static_cast<int>(angleF1) == INT_MIN || static_cast<int>(angleF2) == INT_MIN)
{
return;
}

View File

@ -175,7 +175,6 @@ void DialogLineIntersect::SaveData()
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief P1Line1Changed changed first point of first line
* @param index index in list
*/
void DialogLineIntersect::PointChanged()
{

View File

@ -51,7 +51,6 @@ public:
signals:
/**
* @brief NewLastValue help reset last value in const method (hack).
* @param text text.
*/
void NewLastValue(const qreal &newLastValue) const;
public slots:

View File

@ -473,6 +473,7 @@ void VPattern::setCurrentData()
}
catch (VExceptionBadId &e)
{
Q_UNUSED(e)
qCDebug(vXML)<<"List of tools doesn't containe id="<<id;
return;
}

View File

@ -73,6 +73,11 @@ CONFIG(debug, debug|release){
# Key -isystem disable checking errors in system headers.
-isystem "$${OUT_PWD}/$${MOC_DIR}" \
$$CLANG_DEBUG_CXXFLAGS # See Valentina.pri for more details.
# -isystem key works only for headers. In some cases it's not enough. But we can't delete this warnings and
# want them in global list. Compromise decision delete them from local list.
QMAKE_CXXFLAGS -= \
-Wmissing-prototypes
}
} else {
*-g++{

View File

@ -169,6 +169,7 @@ bool VAbstractConverter::SaveDocument(const QString &fileName, QString &error) c
}
catch (const VExceptionWrongId &e)
{
Q_UNUSED(e)
error = tr("Error no unique id.");
return false;
}

View File

@ -75,9 +75,7 @@ public:
static const QString UnitINCH;
static const QString UnitPX;
static const QString TagVersion;
/**
* @param data container with variables
*/
VDomDocument();
virtual ~VDomDocument();
QDomElement elementById(const QString& id);

View File

@ -115,6 +115,9 @@ void VPatternConverter::ApplyPatches()
const QString schema = XSDSchema(0x000101);
ValidateXML(schema, fileName);
// continue conversion
#ifdef Q_CC_CLANG
[[clang::fallthrough]];
#endif
}
case (0x000101):
{
@ -122,6 +125,9 @@ void VPatternConverter::ApplyPatches()
const QString schema = XSDSchema(0x000102);
ValidateXML(schema, fileName);
// continue conversion
#ifdef Q_CC_CLANG
[[clang::fallthrough]];
#endif
}
case (0x000102):
{
@ -129,6 +135,9 @@ void VPatternConverter::ApplyPatches()
const QString schema = XSDSchema(0x000103);
ValidateXML(schema, fileName);
// continue conversion
#ifdef Q_CC_CLANG
[[clang::fallthrough]];
#endif
}
case (0x000103):
break;

View File

@ -65,6 +65,11 @@ CONFIG(debug, debug|release){
# Key -isystem disable checking errors in system headers.
-isystem "$${OUT_PWD}/$${MOC_DIR}" \
$$CLANG_DEBUG_CXXFLAGS # See Valentina.pri for more details.
# -isystem key works only for headers. In some cases it's not enough. But we can't delete this warnings and
# want them in global list. Compromise decision delete them from local list.
QMAKE_CXXFLAGS -= \
-Wundefined-reinterpret-cast
}
} else {
*-g++{

View File

@ -100,7 +100,7 @@ void VLayoutGenerator::Generate()
VLayoutPaper paper(paperHeight, paperWidth);
paper.SetShift(shift);
paper.SetLayoutWidth(bank->GetLayoutWidth());
paper.SetPaperIndex(papers.count());
paper.SetPaperIndex(static_cast<quint32>(papers.count()));
paper.SetRotate(rotate);
paper.SetRotationIncrease(rotationIncrease);
do

View File

@ -203,7 +203,7 @@ bool VLayoutPaper::AddToSheet(const VLayoutDetail &detail, bool &stop)
threads.append(thread);
thread_pool->start(thread);
d->frame = d->frame + 3 + 360/d->rotationIncrease*2;
d->frame = d->frame + 3 + static_cast<unsigned int>(360/d->rotationIncrease*2);
}
}

View File

@ -170,6 +170,9 @@ void VPosition::DrawDebug(const VContour &contour, const VLayoutDetail &detail,
p = DrawContour(detail.GetLayoutAllowencePoints());
p.translate(contour.GetWidth()/2, contour.GetHeight()/2);
paint.drawPath(p);
#else
Q_UNUSED(detail)
Q_UNUSED(details)
#endif
#ifdef ARRANGED_DETAILS
@ -177,6 +180,8 @@ void VPosition::DrawDebug(const VContour &contour, const VLayoutDetail &detail,
p = DrawDetails(details);
p.translate(contour.GetWidth()/2, contour.GetHeight()/2);
paint.drawPath(p);
#else
Q_UNUSED(details)
#endif
paint.end();
@ -241,6 +246,7 @@ bool VPosition::CheckCombineEdges(VLayoutDetail &detail, int j, int &dEdge) cons
default:
break;
}
break;
}
default:
break;
@ -288,6 +294,7 @@ bool VPosition::CheckCombineEdges(VLayoutDetail &detail, int j, int &dEdge) cons
default:
break;
}
break;
}
default:
break;
@ -338,6 +345,7 @@ bool VPosition::CheckRotationEdges(VLayoutDetail &detail, int j, int dEdge, int
default:
break;
}
break;
}
default:
break;

View File

@ -70,12 +70,8 @@ typedef int (*incircle_predicate_t)(del_point2d_t* p0, del_point2d_t* p1, del_p
/*
* build the 2D Delaunay triangulation given a set of points of at least 3 points
*
* @points: point set given as a sequence of tuple x0, y0, x1, y1, ....
* @num_points: number of given point
* @preds: the incircle predicate
* @faces: the triangles given as a sequence: num verts, verts indices, num verts, verts indices
* first face is the external face
* @pred: incircle predicate
* @param points point set given as a sequence of tuple x0, y0, x1, y1, ....
* @param num_points number of given point
* @return: the number of created faces
*/
delaunay2d_t* delaunay2d_from(del_point2d_t *points, unsigned int num_points);

View File

@ -35,12 +35,21 @@
//---------------------------------------------------------------------------------------------------------------------
static inline QPaintEngine::PaintEngineFeatures svgEngineFeatures()
{
#ifdef Q_CC_CLANG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wsign-conversion"
#endif
return QPaintEngine::PaintEngineFeatures(
QPaintEngine::AllFeatures
& ~QPaintEngine::PatternBrush
& ~QPaintEngine::PerspectiveTransform
& ~QPaintEngine::ConicalGradientFill
& ~QPaintEngine::PorterDuff);
#ifdef Q_CC_CLANG
#pragma clang diagnostic pop
#endif
}
//---------------------------------------------------------------------------------------------------------------------
@ -163,11 +172,11 @@ void VObjEngine::drawPath(const QPainterPath &path)
{
skipFace=false;
}
int num_verts = res->faces[offset];
int num_verts = static_cast<int>(res->faces[offset]);
offset++;
for ( int j = 0; j < num_verts; j++ )
{
int p0 = res->faces[offset + j];
int p0 = static_cast<int>(res->faces[offset + j]);
pf[j] = QPointF(points[p0].x, points[p0].y);
}
if (skipFace == false )
@ -201,7 +210,7 @@ void VObjEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawM
for (int i = 0; i < pointCount; ++i)
{
*stream << QString(" %1").arg(globalPointsCount - pointCount + i + 1);
*stream << QString(" %1").arg(globalPointsCount - static_cast<unsigned int>(pointCount + i + 1));
}
*stream << endl;
}

View File

@ -149,7 +149,7 @@ int VObjPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const
case QPaintDevice::PdmWidthMM:
return qRound(engine->getSize().width() * 25.4 / engine->getResolution());
case QPaintDevice::PdmNumColors:
return 0xffffffff;
return static_cast<int>(0xffffffff);
case QPaintDevice::PdmPhysicalDpiX:
return engine->getResolution();
case QPaintDevice::PdmPhysicalDpiY:

View File

@ -24,8 +24,13 @@
#include <QPushButton>
#include <QSettings>
static const char kDoNotAskAgainKey[] = "DoNotAskAgain";
namespace Utils
{
/*!
\class Utils::CheckableMessageBox
\class CheckableMessageBox
\brief The CheckableMessageBox class implements a message box suitable for
questions with a
@ -34,12 +39,6 @@
Emulates the QMessageBox API with
static conveniences. The message label can open external URLs.
*/
static const char kDoNotAskAgainKey[] = "DoNotAskAgain";
namespace Utils
{
class CheckableMessageBoxPrivate
{
public:
@ -55,8 +54,7 @@ public:
pixmapLabel->setSizePolicy(sizePolicy);
pixmapLabel->setVisible(false);
QSpacerItem *pixmapSpacer =
new QSpacerItem(0, 5, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
QSpacerItem *pixmapSpacer = new QSpacerItem(0, 5, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
messageLabel = new QLabel(q);
messageLabel->setMinimumSize(QSize(300, 0));
@ -64,10 +62,8 @@ public:
messageLabel->setOpenExternalLinks(true);
messageLabel->setTextInteractionFlags(Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse);
QSpacerItem *checkBoxRightSpacer =
new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum);
QSpacerItem *buttonSpacer =
new QSpacerItem(0, 1, QSizePolicy::Minimum, QSizePolicy::Minimum);
QSpacerItem *checkBoxRightSpacer = new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum);
QSpacerItem *buttonSpacer = new QSpacerItem(0, 1, QSizePolicy::Minimum, QSizePolicy::Minimum);
checkBox = new QCheckBox(q);
checkBox->setText(CheckableMessageBox::tr("Do not ask again"));
@ -112,8 +108,7 @@ CheckableMessageBox::CheckableMessageBox(QWidget *parent) :
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
connect(d->buttonBox, SIGNAL(accepted()), SLOT(accept()));
connect(d->buttonBox, SIGNAL(rejected()), SLOT(reject()));
connect(d->buttonBox, SIGNAL(clicked(QAbstractButton*)),
SLOT(slotClicked(QAbstractButton*)));
connect(d->buttonBox, SIGNAL(clicked(QAbstractButton*)), SLOT(slotClicked(QAbstractButton*)));
}
CheckableMessageBox::~CheckableMessageBox()
@ -286,7 +281,7 @@ QMessageBox::StandardButton CheckableMessageBox::dialogButtonBoxToMessageBoxButt
return static_cast<QMessageBox::StandardButton>(int(db));
}
bool askAgain(QSettings *settings, const QString &settingsSubKey)
bool CheckableMessageBox::askAgain(QSettings *settings, const QString &settingsSubKey)
{
//QTC_CHECK(settings);
if (settings)
@ -302,12 +297,10 @@ bool askAgain(QSettings *settings, const QString &settingsSubKey)
return true;
}
enum DoNotAskAgainType{Question, Information};
void initDoNotAskAgainMessageBox(CheckableMessageBox &messageBox, const QString &title,
const QString &text, QDialogButtonBox::StandardButtons buttons,
QDialogButtonBox::StandardButton defaultButton,
DoNotAskAgainType type)
void CheckableMessageBox::initDoNotAskAgainMessageBox(CheckableMessageBox &messageBox, const QString &title,
const QString &text, QDialogButtonBox::StandardButtons buttons,
QDialogButtonBox::StandardButton defaultButton,
DoNotAskAgainType type)
{
messageBox.setWindowTitle(title);
messageBox.setIconPixmap(QMessageBox::standardIcon(type == Information
@ -322,7 +315,7 @@ void initDoNotAskAgainMessageBox(CheckableMessageBox &messageBox, const QString
messageBox.setDefaultButton(defaultButton);
}
void doNotAskAgain(QSettings *settings, const QString &settingsSubKey)
void CheckableMessageBox::doNotAskAgain(QSettings *settings, const QString &settingsSubKey)
{
if (!settings)
{

View File

@ -122,6 +122,14 @@ private slots:
private:
Q_DISABLE_COPY(CheckableMessageBox)
CheckableMessageBoxPrivate *d;
enum DoNotAskAgainType{Question, Information};
static bool askAgain(QSettings *settings, const QString &settingsSubKey);
static void initDoNotAskAgainMessageBox(CheckableMessageBox &messageBox, const QString &title,
const QString &text, QDialogButtonBox::StandardButtons buttons,
QDialogButtonBox::StandardButton defaultButton,
DoNotAskAgainType type);
static void doNotAskAgain(QSettings *settings, const QString &settingsSubKey);
};
} // namespace Utils

View File

@ -83,11 +83,17 @@ CONFIG(debug, debug|release){
QMAKE_CFLAGS+=-fsanitize=address -fno-omit-frame-pointer
QMAKE_LFLAGS+=-fsanitize=address
}
clang*{
QMAKE_CXXFLAGS += \
# Key -isystem disable checking errors in system headers.
-isystem "$${OUT_PWD}/$${MOC_DIR}" \
$$CLANG_DEBUG_CXXFLAGS # See Valentina.pri for more details.
# -isystem key works only for headers. In some cases it's not enough. But we can't delete this warnings and
# want them in global list. Compromise decision delete them from local list.
QMAKE_CXXFLAGS -= \
-Wundefined-reinterpret-cast
}
} else {
*-g++{

View File

@ -62,6 +62,11 @@ CONFIG(debug, debug|release){
clang*{
QMAKE_CXXFLAGS += \
$$CLANG_DEBUG_CXXFLAGS # See Valentina.pri for more details.
# -isystem key works only for headers. In some cases it's not enough. But we can't delete this warnings and
# want them in global list. Compromise decision delete them from local list.
QMAKE_CXXFLAGS -= \
-Wmissing-prototypes
}
} else {
*-g++{