Commit b9f7132e authored by Dmitry Kazakov's avatar Dmitry Kazakov

Fix warnings at the tail of *ASSERT*RECOVER lines

The macro should look like a normal c++ line, that is, ending
with a semicolon.
parent 7ec0e67e
......@@ -73,7 +73,7 @@ KRITAGLOBAL_EXPORT void kis_safe_assert_recoverable(const char *assertion, const
* }
*
*/
#define KIS_ASSERT_RECOVER_BREAK(cond) KIS_ASSERT_RECOVER(cond) { break; }
#define KIS_ASSERT_RECOVER_BREAK(cond) do { KIS_ASSERT_RECOVER(cond) { break; } } while (0)
/**
* Equivalent of the following:
......@@ -83,7 +83,7 @@ KRITAGLOBAL_EXPORT void kis_safe_assert_recoverable(const char *assertion, const
* }
*
*/
#define KIS_ASSERT_RECOVER_RETURN(cond) KIS_ASSERT_RECOVER(cond) { return; }
#define KIS_ASSERT_RECOVER_RETURN(cond) do { KIS_ASSERT_RECOVER(cond) { return; } } while (0)
/**
* Equivalent of the following:
......@@ -93,7 +93,7 @@ KRITAGLOBAL_EXPORT void kis_safe_assert_recoverable(const char *assertion, const
* }
*
*/
#define KIS_ASSERT_RECOVER_RETURN_VALUE(cond, val) KIS_ASSERT_RECOVER(cond) { return (val); }
#define KIS_ASSERT_RECOVER_RETURN_VALUE(cond, val) do { KIS_ASSERT_RECOVER(cond) { return (val); } } while (0)
/**
* Does nothing in case of a failure. Just continues execution.
......@@ -105,7 +105,7 @@ KRITAGLOBAL_EXPORT void kis_safe_assert_recoverable(const char *assertion, const
* }
*
*/
#define KIS_ASSERT_RECOVER_NOOP(cond) KIS_ASSERT_RECOVER(cond) { qt_noop(); }
#define KIS_ASSERT_RECOVER_NOOP(cond) do { KIS_ASSERT_RECOVER(cond) { qt_noop(); } } while (0)
/**
......@@ -135,9 +135,9 @@ KRITAGLOBAL_EXPORT void kis_safe_assert_recoverable(const char *assertion, const
*/
#define KIS_SAFE_ASSERT_RECOVER(cond) if (!(cond) && (kis_safe_assert_recoverable(#cond,__FILE__,__LINE__), true))
#define KIS_SAFE_ASSERT_RECOVER_BREAK(cond) KIS_SAFE_ASSERT_RECOVER(cond) { break; }
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond) KIS_SAFE_ASSERT_RECOVER(cond) { return; }
#define KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(cond, val) KIS_SAFE_ASSERT_RECOVER(cond) { return (val); }
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond) KIS_SAFE_ASSERT_RECOVER(cond) { qt_noop(); }
#define KIS_SAFE_ASSERT_RECOVER_BREAK(cond) do { KIS_SAFE_ASSERT_RECOVER(cond) { break; } } while (0)
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond) do { KIS_SAFE_ASSERT_RECOVER(cond) { return; } } while (0)
#define KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(cond, val) do { KIS_SAFE_ASSERT_RECOVER(cond) { return (val); } } while (0)
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond) do { KIS_SAFE_ASSERT_RECOVER(cond) { qt_noop(); } } while (0)
#endif /* __KIS_ASSERT_H */
......@@ -130,7 +130,7 @@ private:
inline quint32 calculateHash(qint32 col, qint32 row)
{
#ifdef SANITY_CHECK
KIS_ASSERT_RECOVER_NOOP(row < 0x7FFF && col < 0x7FFF)
KIS_ASSERT_RECOVER_NOOP(row < 0x7FFF && col < 0x7FFF);
#endif // SANITY_CHECK
if (col == 0 && row == 0) {
......
......@@ -37,7 +37,7 @@ struct AddReferenceImagesCommand : KoShapeCreateCommand
void redo() override {
auto layer = m_document->referenceImagesLayer();
KIS_SAFE_ASSERT_RECOVER_NOOP(!layer || layer == m_layer)
KIS_SAFE_ASSERT_RECOVER_NOOP(!layer || layer == m_layer);
if (!layer) {
m_document->setReferenceImagesLayer(m_layer, true);
......@@ -78,7 +78,7 @@ struct RemoveReferenceImagesCommand : KoShapeDeleteCommand
void undo() override {
auto layer = m_document->referenceImagesLayer();
KIS_SAFE_ASSERT_RECOVER_NOOP(!layer || layer == m_layer)
KIS_SAFE_ASSERT_RECOVER_NOOP(!layer || layer == m_layer);
if (!layer) {
m_document->setReferenceImagesLayer(m_layer, true);
......
......@@ -330,7 +330,7 @@ void KisShapeLayer::fillMergedLayerTemplate(KisLayerSP dstLayer, KisLayerSP prev
void KisShapeLayer::setParent(KoShapeContainer *parent)
{
Q_UNUSED(parent)
KIS_ASSERT_RECOVER_RETURN(0)
KIS_ASSERT_RECOVER_RETURN(0);
}
QIcon KisShapeLayer::icon() const
......
......@@ -408,7 +408,7 @@ void KisShapeLayerCanvas::resetCache()
void KisShapeLayerCanvas::rerenderAfterBeingInvisible()
{
KIS_SAFE_ASSERT_RECOVER_RETURN(m_parentLayer->visible(true))
KIS_SAFE_ASSERT_RECOVER_RETURN(m_parentLayer->visible(true));
m_hasChangedWhileBeingInvisible = false;
resetCache();
......
......@@ -162,7 +162,7 @@ void AnimaterionRenderer::renderAnimationImpl(KisDocument *doc, KisAnimationRend
const QString savedFilesMask = exporter.savedFilesMask();
const QString resultFile = encoderOptions.resolveAbsoluteVideoFilePath();
KIS_SAFE_ASSERT_RECOVER_NOOP(QFileInfo(resultFile).isAbsolute())
KIS_SAFE_ASSERT_RECOVER_NOOP(QFileInfo(resultFile).isAbsolute());
{
const QFileInfo info(resultFile);
......
......@@ -479,7 +479,7 @@ bool KisSaveXmlVisitor::saveMasks(KisNode * node, QDomElement & layerElement)
bool KisSaveXmlVisitor::saveReferenceImagesLayer(KisExternalLayer *layer)
{
auto *referencesLayer = dynamic_cast<KisReferenceImagesLayer*>(layer);
KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(referencesLayer, false)
KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(referencesLayer, false);
QDomElement layerElement = m_doc.createElement(LAYER);
layerElement.setAttribute(NODE_TYPE, REFERENCE_IMAGES_LAYER);
......
......@@ -90,7 +90,7 @@ void ToolReferenceImages::setReferenceImageLayer(KisSharedPtr<KisReferenceImages
void ToolReferenceImages::addReferenceImage()
{
auto kisCanvas = dynamic_cast<KisCanvas2*>(canvas());
KIS_ASSERT_RECOVER_RETURN(kisCanvas)
KIS_ASSERT_RECOVER_RETURN(kisCanvas);
KoFileDialog dialog(kisCanvas->viewManager()->mainWindow(), KoFileDialog::OpenFile, "OpenReferenceImage");
dialog.setCaption(i18n("Select a Reference Image"));
......@@ -115,7 +115,7 @@ void ToolReferenceImages::addReferenceImage()
void ToolReferenceImages::pasteReferenceImage()
{
KisCanvas2* kisCanvas = dynamic_cast<KisCanvas2*>(canvas());
KIS_ASSERT_RECOVER_RETURN(kisCanvas)
KIS_ASSERT_RECOVER_RETURN(kisCanvas);
KisReferenceImage* reference = KisReferenceImage::fromClipboard(*kisCanvas->coordinatesConverter());
if(reference) {
......@@ -137,7 +137,7 @@ void ToolReferenceImages::removeAllReferenceImages()
void ToolReferenceImages::loadReferenceImages()
{
auto kisCanvas = dynamic_cast<KisCanvas2*>(canvas());
KIS_ASSERT_RECOVER_RETURN(kisCanvas)
KIS_ASSERT_RECOVER_RETURN(kisCanvas);
KoFileDialog dialog(kisCanvas->viewManager()->mainWindow(), KoFileDialog::OpenFile, "OpenReferenceImageCollection");
dialog.setMimeTypeFilters(QStringList() << "application/x-krita-reference-images");
......@@ -179,7 +179,7 @@ void ToolReferenceImages::saveReferenceImages()
if (!layer || layer->shapeCount() == 0) return;
auto kisCanvas = dynamic_cast<KisCanvas2*>(canvas());
KIS_ASSERT_RECOVER_RETURN(kisCanvas)
KIS_ASSERT_RECOVER_RETURN(kisCanvas);
KoFileDialog dialog(kisCanvas->viewManager()->mainWindow(), KoFileDialog::SaveFile, "SaveReferenceImageCollection");
dialog.setMimeTypeFilters(QStringList() << "application/x-krita-reference-images");
......
......@@ -441,7 +441,7 @@ void KisToolSelectMagnetic::reEvaluatePoints()
void KisToolSelectMagnetic::finishSelectionAction()
{
KisCanvas2 *kisCanvas = dynamic_cast<KisCanvas2 *>(canvas());
KIS_ASSERT_RECOVER_RETURN(kisCanvas)
KIS_ASSERT_RECOVER_RETURN(kisCanvas);
kisCanvas->updateCanvas();
setMode(KisTool::HOVER_MODE);
m_complete = false;
......@@ -595,7 +595,7 @@ void KisToolSelectMagnetic::activate(KoToolBase::ToolActivation activation, cons
void KisToolSelectMagnetic::deactivate()
{
KisCanvas2 *kisCanvas = dynamic_cast<KisCanvas2 *>(canvas());
KIS_ASSERT_RECOVER_RETURN(kisCanvas)
KIS_ASSERT_RECOVER_RETURN(kisCanvas);
kisCanvas->updateCanvas();
resetVariables();
m_continuedMode = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment