Commit 6d0d61c2 authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Enable clazy copyable-polymorphic

parent 93540ac1
......@@ -48,7 +48,7 @@ build_clazy_clang_tidy:
script:
- srcdir=`pwd` && mkdir -p /tmp/okular_build && cd /tmp/okular_build && CC=clang CXX=clazy CXXFLAGS="-Werror -Wno-deprecated-declarations" cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -G Ninja $srcdir && cat compile_commands.json | jq '[.[] | select(.file | contains("'"$srcdir"'"))]' > compile_commands.aux.json && cat compile_commands.aux.json | jq '[.[] | select(.file | contains("/synctex/")| not)]' > compile_commands.json
- CLAZY_IGNORE_DIRS="settings_core.cpp|settings.cpp" CLAZY_CHECKS="level0,level1,level2,no-ctor-missing-parent-argument,no-copyable-polymorphic,no-qstring-allocations,no-missing-qobject-macro" ninja
- CLAZY_IGNORE_DIRS="settings_core.cpp|settings.cpp" CLAZY_CHECKS="level0,level1,level2,no-ctor-missing-parent-argument,no-qstring-allocations,no-missing-qobject-macro" ninja
# Fix the poppler header, remove when debian:unstable ships poppler 0.82 or later
- sed -i "N;N;N;N; s#class MediaRendition\;\nclass MovieAnnotation\;\nclass ScreenAnnotation;#class MediaRendition\;#g" /usr/include/poppler/qt5/poppler-link.h
- "run-clang-tidy -header-filter='.*/okular/.*' -checks='-*,performance-*,bugprone-*,readability-inconsistent-declaration-parameter-name,readability-string-compare,modernize-redundant-void-arg,modernize-use-bool-literals,modernize-make-unique,modernize-make-shared,modernize-use-override,modernize-use-equals-delete,modernize-use-emplace,modernize-loop-convert,modernize-use-nullptr,-bugprone-macro-parentheses,-bugprone-narrowing-conversions,-bugprone-branch-clone,-bugprone-incorrect-roundings' -config=\"{WarningsAsErrors: '*'}\""
......@@ -32,6 +32,9 @@ class Okular::ActionPrivate
qDeleteAll( m_nextActions );
}
ActionPrivate(const ActionPrivate &) = delete;
ActionPrivate &operator=(const ActionPrivate &) = delete;
QVariant m_nativeId;
QVector< Action * > m_nextActions;
};
......
......@@ -168,6 +168,10 @@ QRect AnnotationUtils::annotationGeometry( const Annotation * annotation,
}
//END AnnotationUtils implementation
AnnotationProxy::AnnotationProxy()
{
}
AnnotationProxy::~AnnotationProxy()
{
}
......
......@@ -716,11 +716,16 @@ class OKULARCORE_EXPORT AnnotationProxy
Removal ///< Generator can remove native annotations
};
AnnotationProxy();
/**
* Destroys the annotation proxy.
*/
virtual ~AnnotationProxy();
AnnotationProxy(const AnnotationProxy &) = delete;
AnnotationProxy &operator=(const AnnotationProxy &) = delete;
/**
* Query for the supported capabilities.
*/
......
......@@ -32,6 +32,9 @@ class AnnotationPrivate
virtual ~AnnotationPrivate();
AnnotationPrivate(const AnnotationPrivate &) = delete;
AnnotationPrivate &operator=(const AnnotationPrivate &) = delete;
/**
* Transforms the annotation coordinates with the transformation
* defined by @p matrix.
......
......@@ -493,6 +493,9 @@ class OKULARCORE_EXPORT ObjectRect
*/
virtual ~ObjectRect();
ObjectRect(const ObjectRect &o) = delete;
ObjectRect &operator=(const ObjectRect &o) = delete;
/**
* Returns the object type of the object rectangle.
* @see ObjectType
......
......@@ -106,6 +106,9 @@ class BookmarkManager::Private : public KBookmarkOwner
// delete manager;
}
Private(const Private &) = delete;
Private &operator=(const Private &) = delete;
QUrl currentUrl() const override;
QString currentTitle() const override;
bool enableOption(BookmarkOption option) const override;
......
......@@ -1410,6 +1410,9 @@ class OKULARCORE_EXPORT EmbeddedFile
*/
virtual ~EmbeddedFile();
EmbeddedFile(const EmbeddedFile &) = delete;
EmbeddedFile &operator=(const EmbeddedFile &) = delete;
/**
* Returns the name of the file
*/
......
......@@ -25,6 +25,9 @@ class FormFieldPrivate
explicit FormFieldPrivate( FormField::FieldType type );
virtual ~FormFieldPrivate();
FormFieldPrivate(const FormFieldPrivate &) = delete;
FormFieldPrivate &operator=(const FormFieldPrivate &) = delete;
void setDefault();
virtual void setValue( const QString& ) = 0;
......
......@@ -37,6 +37,9 @@ class OKULARCORE_EXPORT DocumentObserver
*/
virtual ~DocumentObserver();
DocumentObserver(const DocumentObserver &) = delete;
DocumentObserver &operator=(const DocumentObserver &) = delete;
/**
* Flags that can be sent from the document to all observers to
* inform them about the type of object that has been changed.
......
......@@ -33,6 +33,9 @@ class RotationJobInternal : public ThreadWeaver::Job
Rotation rotation() const;
NormalizedRect rect() const;
RotationJobInternal(const RotationJobInternal &) = delete;
RotationJobInternal &operator=(const RotationJobInternal &) = delete;
protected:
void run(ThreadWeaver::JobPointer self, ThreadWeaver::Thread *thread) override;
......
......@@ -24,6 +24,9 @@ class ViewPrivate
ViewPrivate();
virtual ~ViewPrivate();
ViewPrivate(const ViewPrivate &) = delete;
ViewPrivate &operator=(const ViewPrivate &) = delete;
QString name;
DocumentPrivate *document;
};
......
......@@ -37,6 +37,9 @@ public:
ProtocolMSITS ( const QByteArray&, const QByteArray& );
~ProtocolMSITS() override;
ProtocolMSITS(const ProtocolMSITS &) = delete;
ProtocolMSITS &operator=(const ProtocolMSITS &) = delete;
void get (const QUrl & ) override;
void listDir (const QUrl & url) override;
void stat (const QUrl & url) override;
......
......@@ -84,6 +84,9 @@ class EBook
EBook();
virtual ~EBook();
EBook(const EBook &) = delete;
EBook &operator=(const EBook &) = delete;
/*!
* \brief Attempts to load chm or epub file.
* \param archiveName filename.
......
......@@ -29,6 +29,9 @@ class UnrarFlavour
public:
virtual ~UnrarFlavour();
UnrarFlavour(const UnrarFlavour &) = delete;
UnrarFlavour &operator=(const UnrarFlavour &) = delete;
virtual QStringList processListing( const QStringList &data ) = 0;
virtual QString name() const = 0;
......
......@@ -70,8 +70,12 @@ class KDjVu
friend class KDjVu;
public:
Link() = default;
virtual ~Link();
Link(const Link &) = delete;
Link &operator=(const Link &) = delete;
enum LinkType { PageLink, UrlLink };
enum LinkArea { UnknownArea, RectArea, EllipseArea, PolygonArea };
virtual int type() const = 0;
......@@ -130,6 +134,9 @@ class KDjVu
public:
virtual ~Annotation();
Annotation(const Annotation &) = delete;
Annotation &operator=(const Annotation &) = delete;
enum AnnotationType { TextAnnotation, LineAnnotation };
virtual int type() const = 0;
QPoint point() const;
......
......@@ -23,6 +23,9 @@ class TeXFont {
virtual ~TeXFont();
TeXFont(const TeXFont &) = delete;
TeXFont &operator=(const TeXFont &) = delete;
void setDisplayResolution()
{
for(glyph &g : glyphtable)
......
......@@ -9,14 +9,6 @@
#include "dviPageInfo.h"
dviPageInfo::dviPageInfo( const dviPageInfo &dvipi )
{
width = dvipi.width;
height = dvipi.height;
resolution = dvipi.resolution;
pageNumber = dvipi.pageNumber;
}
dviPageInfo::dviPageInfo()
{
sourceHyperLinkList.reserve(200);
......
......@@ -26,10 +26,12 @@ public:
PageNumber pageNumber;
dviPageInfo();
dviPageInfo( const dviPageInfo &dvipi );
virtual ~dviPageInfo();
dviPageInfo(const dviPageInfo &) = delete;
dviPageInfo &operator=(const dviPageInfo &) = delete;
virtual void clear();
/** \brief List of source hyperlinks
......
......@@ -212,17 +212,12 @@ QImage DviGenerator::image( Okular::PixmapRequest *request )
if (s.isValid())
{
ps = s; /* it should be the user specified size, if any, instead */
pageInfo->resolution = (double)(pageInfo->width)/s.width().getLength_in_inch();
}
else
{
pageInfo->resolution = (double)(pageInfo->width)/ps.width().getLength_in_inch();
}
pageInfo->resolution = (double)(pageInfo->width)/ps.width().getLength_in_inch();
#if 0
qCDebug(OkularDviDebug) << *request
<< ", res:" << pageInfo->resolution << " - (" << pageInfo->width << ","
<< ps.width().getLength_in_inch() << ")," << ps.width().getLength_in_mm()
<< endl;
#endif
m_dviRenderer->drawPage( pageInfo );
......
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