Commit e0f45add authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Enable -Wweak-vtables in clang

Read https://stackoverflow.com/a/23749273/11956287 for a full
explanation, but basically this is important for headers like the
interfaces/ and kdocumentviewer.h that are supposed to be used by third
partyies where it may happen that wrong things happen because the whole
class is inline in a header

For the classes that are defined in the .cpp or are not installed
headers this would not be necessary but it's not so hard to add a few
default defined destructors, so do that :)
parent f44eceba
Pipeline #40202 passed with stage
in 10 minutes and 28 seconds
......@@ -163,6 +163,10 @@ if(BUILD_COVERAGE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov")
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wweak-vtables")
endif()
add_subdirectory( ui )
if(BUILD_DESKTOP)
add_subdirectory( shell )
......@@ -224,6 +228,7 @@ set(okularcore_SRCS
core/script/event.cpp
core/synctex/synctex_parser.c
core/synctex/synctex_parser_utils.c
interfaces/interfaces.cpp
)
qt5_add_resources(okularcore_SRCS
core/script/builtin.qrc
......
......@@ -27,10 +27,7 @@ public:
{
}
virtual ~ActionPrivate()
{
qDeleteAll(m_nextActions);
}
virtual ~ActionPrivate();
ActionPrivate(const ActionPrivate &) = delete;
ActionPrivate &operator=(const ActionPrivate &) = delete;
......@@ -39,6 +36,11 @@ public:
QVector<Action *> m_nextActions;
};
Okular::ActionPrivate::~ActionPrivate()
{
qDeleteAll(m_nextActions);
}
Action::Action(ActionPrivate &dd)
: d_ptr(&dd)
{
......@@ -98,11 +100,15 @@ public:
{
}
~GotoActionPrivate() override;
QString m_extFileName;
DocumentViewport m_vp;
QString m_dest;
};
Okular::GotoActionPrivate::~GotoActionPrivate() = default;
GotoAction::GotoAction(const QString &fileName, const DocumentViewport &viewport)
: Action(*new GotoActionPrivate(fileName, viewport))
{
......@@ -164,10 +170,14 @@ public:
{
}
~ExecuteActionPrivate() override;
QString m_fileName;
QString m_parameters;
};
ExecuteActionPrivate::~ExecuteActionPrivate() = default;
ExecuteAction::ExecuteAction(const QString &file, const QString &parameters)
: Action(*new ExecuteActionPrivate(file, parameters))
{
......@@ -211,9 +221,13 @@ public:
{
}
~BrowseActionPrivate() override;
QUrl m_url;
};
BrowseActionPrivate::~BrowseActionPrivate() = default;
BrowseAction::BrowseAction(const QUrl &url)
: Action(*new BrowseActionPrivate(url))
{
......@@ -256,9 +270,13 @@ public:
{
}
~DocumentActionPrivate() override;
DocumentAction::DocumentActionType m_type;
};
DocumentActionPrivate::~DocumentActionPrivate() = default;
DocumentAction::DocumentAction(enum DocumentActionType documentActionType)
: Action(*new DocumentActionPrivate(documentActionType))
{
......@@ -327,10 +345,7 @@ public:
{
}
~SoundActionPrivate() override
{
delete m_sound;
}
~SoundActionPrivate() override;
double m_volume;
bool m_sync : 1;
......@@ -339,6 +354,11 @@ public:
Okular::Sound *m_sound;
};
SoundActionPrivate::~SoundActionPrivate()
{
delete m_sound;
}
SoundAction::SoundAction(double volume, bool sync, bool repeat, bool mix, Okular::Sound *sound)
: Action(*new SoundActionPrivate(volume, sync, repeat, mix, sound))
{
......@@ -400,10 +420,14 @@ public:
{
}
~ScriptActionPrivate() override;
ScriptType m_scriptType;
QString m_script;
};
ScriptActionPrivate::~ScriptActionPrivate() = default;
ScriptAction::ScriptAction(enum ScriptType type, const QString &script)
: Action(*new ScriptActionPrivate(type, script))
{
......@@ -453,10 +477,14 @@ public:
{
}
~MovieActionPrivate() override;
MovieAction::OperationType m_operation;
MovieAnnotation *m_annotation;
};
MovieActionPrivate::~MovieActionPrivate() = default;
MovieAction::MovieAction(OperationType operation)
: Action(*new MovieActionPrivate(operation))
{
......@@ -509,6 +537,8 @@ public:
{
}
~RenditionActionPrivate() override;
RenditionAction::OperationType m_operation;
Okular::Movie *m_movie;
ScriptType m_scriptType;
......@@ -516,6 +546,8 @@ public:
ScreenAnnotation *m_annotation;
};
RenditionActionPrivate::~RenditionActionPrivate() = default;
RenditionAction::RenditionAction(OperationType operation, Okular::Movie *movie, enum ScriptType scriptType, const QString &script)
: Action(*new RenditionActionPrivate(operation, movie, scriptType, script))
{
......
......@@ -56,6 +56,8 @@ Okular::NormalizedRect buildBoundingRectangleForButtons(const QList<Okular::Form
return boundingRect;
}
OkularUndoCommand::~OkularUndoCommand() = default;
AddAnnotationCommand::AddAnnotationCommand(Okular::DocumentPrivate *docPriv, Okular::Annotation *annotation, int pageNumber)
: m_docPriv(docPriv)
, m_annotation(annotation)
......
......@@ -31,6 +31,7 @@ class Page;
class OkularUndoCommand : public QUndoCommand
{
public:
~OkularUndoCommand() override;
virtual bool refreshInternalPageReferences(const QVector<Okular::Page *> &newPagesVector) = 0;
};
......
......@@ -126,6 +126,8 @@ public:
{
}
~FormFieldButtonPrivate() override;
Q_DECLARE_PUBLIC(FormFieldButton)
void setValue(const QString &v) override
......@@ -141,6 +143,8 @@ public:
}
};
FormFieldButtonPrivate::~FormFieldButtonPrivate() = default;
FormFieldButton::FormFieldButton()
: FormField(*new FormFieldButtonPrivate())
{
......@@ -166,6 +170,8 @@ public:
{
}
~FormFieldTextPrivate() override;
Q_DECLARE_PUBLIC(FormFieldText)
void setValue(const QString &v) override
......@@ -181,6 +187,8 @@ public:
}
};
FormFieldTextPrivate::~FormFieldTextPrivate() = default;
FormFieldText::FormFieldText()
: FormField(*new FormFieldTextPrivate())
{
......@@ -227,6 +235,8 @@ public:
{
}
~FormFieldChoicePrivate() override;
Q_DECLARE_PUBLIC(FormFieldChoice)
void setValue(const QString &v) override
......@@ -259,6 +269,8 @@ public:
QMap<QString, QString> exportValues;
};
FormFieldChoicePrivate::~FormFieldChoicePrivate() = default;
FormFieldChoice::FormFieldChoice()
: FormField(*new FormFieldChoicePrivate())
{
......@@ -321,6 +333,8 @@ public:
{
}
~FormFieldSignaturePrivate() override;
Q_DECLARE_PUBLIC(FormFieldSignature)
void setValue(const QString &v) override
......@@ -334,6 +348,8 @@ public:
}
};
FormFieldSignaturePrivate::~FormFieldSignaturePrivate() = default;
FormFieldSignature::FormFieldSignature()
: FormField(*new FormFieldSignaturePrivate())
{
......
......@@ -72,6 +72,8 @@ Q_DECLARE_METATYPE(const Poppler::LinkOCGState *)
static const int defaultPageWidth = 595;
static const int defaultPageHeight = 842;
PDFEmbeddedFile::~PDFEmbeddedFile() = default;
class PDFOptionsPage : public Okular::PrintOptionsWidget
{
Q_OBJECT
......
......@@ -22,6 +22,8 @@ public:
{
}
~PDFEmbeddedFile() override;
QString name() const override
{
return ef->name();
......
......@@ -45,9 +45,7 @@ public:
/**
* Destroys the config interface.
*/
virtual ~ConfigInterface()
{
}
virtual ~ConfigInterface();
ConfigInterface(const ConfigInterface &) = delete;
ConfigInterface &operator=(const ConfigInterface &) = delete;
......
......@@ -46,9 +46,7 @@ public:
/**
* Destroys the gui interface.
*/
~GuiInterface() override
{
}
~GuiInterface() override;
GuiInterface(const GuiInterface &) = delete;
GuiInterface &operator=(const GuiInterface &) = delete;
......
/***************************************************************************
* Copyright (C) 2020 by Albert Astals Cid <aacid@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#include "configinterface.h"
#include "guiinterface.h"
#include "printinterface.h"
#include "saveinterface.h"
#include "viewerinterface.h"
Okular::ConfigInterface::~ConfigInterface() = default;
Okular::GuiInterface::~GuiInterface() = default;
Okular::PrintInterface::~PrintInterface() = default;
Okular::SaveInterface::~SaveInterface() = default;
Okular::ViewerInterface::~ViewerInterface() = default;
......@@ -46,9 +46,7 @@ public:
/**
* Destroys the printer interface.
*/
virtual ~PrintInterface()
{
}
virtual ~PrintInterface();
PrintInterface(const PrintInterface &) = delete;
PrintInterface &operator=(const PrintInterface &) = delete;
......
......@@ -55,9 +55,7 @@ public:
/**
* Destroys the save interface.
*/
virtual ~SaveInterface()
{
}
virtual ~SaveInterface();
SaveInterface(const SaveInterface &) = delete;
SaveInterface &operator=(const SaveInterface &) = delete;
......
......@@ -34,9 +34,7 @@ public:
ViewerInterface()
{
}
virtual ~ViewerInterface()
{
}
virtual ~ViewerInterface();
ViewerInterface(const ViewerInterface &) = delete;
ViewerInterface &operator=(const ViewerInterface &) = delete;
......
......@@ -27,9 +27,7 @@ public:
KDocumentViewer()
{
}
virtual ~KDocumentViewer()
{
}
virtual ~KDocumentViewer();
KDocumentViewer(const KDocumentViewer &) = delete;
KDocumentViewer &operator=(const KDocumentViewer &) = delete;
......
......@@ -119,6 +119,8 @@
#include "xmlgui_helper.h"
#include <memory>
KDocumentViewer::~KDocumentViewer() = default;
#ifdef OKULAR_KEEP_FILE_OPEN
class FileKeeper
{
......
......@@ -51,6 +51,8 @@ public:
setData(0, PageItemDelegate::PageRole, QString::number(m_viewport.pageNumber + 1));
}
~BookmarkItem() override;
BookmarkItem(const BookmarkItem &) = delete;
BookmarkItem &operator=(const BookmarkItem &) = delete;
......@@ -93,6 +95,8 @@ private:
Okular::DocumentViewport m_viewport;
};
BookmarkItem::~BookmarkItem() = default;
class FileItem : public QTreeWidgetItem
{
public:
......@@ -105,6 +109,8 @@ public:
setData(0, UrlRole, QVariant::fromValue(url));
}
~FileItem() override;
FileItem(const FileItem &) = delete;
FileItem &operator=(const FileItem &) = delete;
......@@ -118,6 +124,8 @@ public:
}
};
FileItem::~FileItem() = default;
BookmarkList::BookmarkList(Okular::Document *document, QWidget *parent)
: QWidget(parent)
, m_document(document)
......
......@@ -44,6 +44,8 @@ protected:
{
}
~ColorActionIconEngine() override;
ColorActionIconEngine(const ColorActionIconEngine &) = delete;
ColorActionIconEngine &operator=(const ColorActionIconEngine &) = delete;
......@@ -91,6 +93,8 @@ protected:
};
};
ColorAction::ColorActionIconEngine::~ColorActionIconEngine() = default;
DrawingToolActions::DrawingToolActions(KActionCollection *parent)
: QObject(parent)
{
......
......@@ -73,6 +73,8 @@ public:
pixmap = GuiUtils::loadStamp(hoverIconName, size);
}
~PickPointEngine() override;
QRect event(EventType type, Button button, Modifiers modifiers, double nX, double nY, double xScale, double yScale, const Okular::Page *page) override
{
xscale = xScale;
......@@ -309,6 +311,8 @@ private:
bool m_block;
};
PickPointEngine::~PickPointEngine() = default;
/** @short PolyLineEngine */
class PolyLineEngine : public AnnotatorEngine
{
......@@ -330,6 +334,8 @@ public:
numofpoints = -1;
}
~PolyLineEngine() override;
static Okular::NormalizedPoint constrainAngle(const Okular::NormalizedPoint &p1, double x, double y, double xScale, double yScale, double angleIncrement)
{
// given the normalized point (x, y), return the closest point such that the line segment from p1 forms an angle
......@@ -484,6 +490,8 @@ private:
int numofpoints;
};
PolyLineEngine::~PolyLineEngine() = default;
/** @short TextSelectorEngine */
class TextSelectorEngine : public AnnotatorEngine
{
......@@ -495,6 +503,8 @@ public:
// parse engine specific attributes
}
~TextSelectorEngine() override;
QRect event(EventType type, Button button, Modifiers /*modifiers*/, double nX, double nY, double xScale, double yScale, const Okular::Page * /*page*/) override
{
// only proceed if pressing left button
......@@ -620,6 +630,8 @@ private:
QRect rect;
};
TextSelectorEngine::~TextSelectorEngine() = default;
/** @short AnnotationTools*/
class AnnotationTools
{
......
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