[poppler] cpp/poppler-destination.cpp cpp/poppler-destination.h cpp/poppler-page.cpp cpp/poppler-page.h .gitlab-ci.yml poppler/CertificateInfo.cc poppler/CertificateInfo.h poppler/Object.h poppler/PDFDoc.cc qt5/src splash/SplashPath.cc splash/SplashPath.h

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Sep 30 13:06:26 UTC 2019


 .gitlab-ci.yml                |    4 ++--
 cpp/poppler-destination.cpp   |    4 ++--
 cpp/poppler-destination.h     |    5 +++--
 cpp/poppler-page.cpp          |    6 +++---
 cpp/poppler-page.h            |    6 +++---
 poppler/CertificateInfo.cc    |   19 ++++++++++++++-----
 poppler/CertificateInfo.h     |   10 +++++-----
 poppler/Object.h              |    4 ++--
 poppler/PDFDoc.cc             |    4 ++--
 qt5/src/poppler-annotation.cc |    2 +-
 qt5/src/poppler-link.cc       |    2 +-
 qt5/src/poppler-outline.cc    |    5 +++--
 qt5/src/poppler-qt5.h         |    4 ++--
 splash/SplashPath.cc          |    4 ++--
 splash/SplashPath.h           |    4 ++--
 15 files changed, 47 insertions(+), 36 deletions(-)

New commits:
commit dbd3e82f648df57cf2b4c26a0bc016c983f79138
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Sep 27 23:23:24 2019 +0200

    Run clang-tidy on CI
    
    Only with the performance- checks enabled for now

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 47991d44..71b4e5cc 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -9,7 +9,7 @@ before_script:
   - echo 'deb-src http://deb.debian.org/debian unstable main' >> /etc/apt/sources.list
   - apt-get update
   - apt-get build-dep --yes --no-install-recommends poppler
-  - apt-get install --yes --no-install-recommends ninja-build libcurl4-openssl-dev git ca-certificates locales libc++-dev libc++abi-dev clang libgtk-3-dev
+  - apt-get install --yes --no-install-recommends ninja-build libcurl4-openssl-dev git ca-certificates locales libc++-dev libc++abi-dev clang libgtk-3-dev clang-tidy
   - echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen
   - locale-gen
 
@@ -40,7 +40,7 @@ build_clang_libcpp:
   script:
     - git clone --branch ${CI_COMMIT_REF_NAME} --depth 1 ${TEST_DATA_URL} test-data || git clone --depth 1 ${UPSTREAM_TEST_DATA_URL} test-data
     - mkdir -p build && cd build
-    - CC=clang CXX=clang++ cmake -G Ninja -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DTESTDATADIR=$PWD/../test-data ..
+    - CC=clang CXX=clang++ cmake -G Ninja -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DTESTDATADIR=$PWD/../test-data -DCMAKE_CXX_CLANG_TIDY="clang-tidy;-header-filter=.;-checks=-*,performance-*;-warnings-as-errors=*" ..
     - ninja
     - ctest --output-on-failure
 
diff --git a/cpp/poppler-destination.cpp b/cpp/poppler-destination.cpp
index eb955815..e74da584 100644
--- a/cpp/poppler-destination.cpp
+++ b/cpp/poppler-destination.cpp
@@ -173,7 +173,7 @@ destination::destination(destination_private *dd)
 /**
  Move constructor.
  */
-destination::destination(destination &&other)
+destination::destination(destination &&other) noexcept
 {
     *this = std::move(other);
 }
@@ -270,7 +270,7 @@ bool destination::is_change_zoom() const
 /**
  Move assignment operator.
  */
-destination& destination::operator=(destination &&other)
+destination& destination::operator=(destination &&other) noexcept
 {
     if (this != &other) {
         d = other.d;
diff --git a/cpp/poppler-destination.h b/cpp/poppler-destination.h
index 964c1b5f..7036b0be 100644
--- a/cpp/poppler-destination.h
+++ b/cpp/poppler-destination.h
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2019, Masamichi Hosoda <trueroad at trueroad.jp>
+ * Copyright (C) 2019, Albert Astals Cid <aacid at 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
@@ -41,7 +42,7 @@ public:
     };
 
     ~destination();
-    destination(destination &&other);
+    destination(destination &&other) noexcept;
 
     type_enum type() const;
     int page_number() const;
@@ -54,7 +55,7 @@ public:
     bool is_change_top() const;
     bool is_change_zoom() const;
 
-    destination& operator=(destination &&other);
+    destination& operator=(destination &&other) noexcept;
 
 private:
     destination(destination_private *dd);
diff --git a/cpp/poppler-page.cpp b/cpp/poppler-page.cpp
index 426f0dbd..1f767584 100644
--- a/cpp/poppler-page.cpp
+++ b/cpp/poppler-page.cpp
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2009-2010, Pino Toscano <pino at kde.org>
- * Copyright (C) 2017, 2018, Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2017-2019, Albert Astals Cid <aacid at kde.org>
  * Copyright (C) 2017, Jason Alan Palmer <jalanpalmer at gmail.com>
  * Copyright (C) 2018, Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
  * Copyright (C) 2018, Adam Reichold <adam.reichold at t-online.de>
@@ -300,8 +300,8 @@ text_box_data::~text_box_data() = default;
 
 text_box::~text_box() = default;
 
-text_box& text_box::operator=(text_box&& a) = default;
-text_box::text_box(text_box&& a) = default;
+text_box& text_box::operator=(text_box&& a) noexcept = default;
+text_box::text_box(text_box&& a) noexcept = default;
 
 text_box::text_box(text_box_data *data) : m_data{data}
 {
diff --git a/cpp/poppler-page.h b/cpp/poppler-page.h
index a7dcc872..bd7f1fcf 100644
--- a/cpp/poppler-page.h
+++ b/cpp/poppler-page.h
@@ -1,7 +1,7 @@
 /*
  * Copyright (C) 2009-2010, Pino Toscano <pino at kde.org>
  * Copyright (C) 2018, Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
- * Copyright (C) 2018, Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2018, 2019, Albert Astals Cid <aacid at kde.org>
  * Copyright (C) 2018, Zsombor Hollay-Horvath <hollay.horvath at gmail.com>
  * Copyright (C) 2018, Aleksey Nikolaev <nae202 at gmail.com>
  *
@@ -36,8 +36,8 @@ class POPPLER_CPP_EXPORT text_box
 {
     friend class page;
 public:
-    text_box(text_box&&);
-    text_box& operator=(text_box&&);
+    text_box(text_box&&) noexcept;
+    text_box& operator=(text_box&&) noexcept;
 
     ~text_box();
 
diff --git a/poppler/CertificateInfo.cc b/poppler/CertificateInfo.cc
index c33705c5..70aff819 100644
--- a/poppler/CertificateInfo.cc
+++ b/poppler/CertificateInfo.cc
@@ -5,7 +5,7 @@
 // This file is licensed under the GPLv2 or later
 //
 // Copyright 2018 Chinmoy Ranjan Pradhan <chinmoyrp65 at gmail.com>
-// Copyright 2018 Albert Astals Cid <aacid at kde.org>
+// Copyright 2018, 2019 Albert Astals Cid <aacid at kde.org>
 // Copyright 2018 Oliver Sander <oliver.sander at tu-dresden.de>
 //
 //========================================================================
@@ -21,14 +21,14 @@ X509CertificateInfo::PublicKeyInfo::PublicKeyInfo() :
 {
 }
 
-X509CertificateInfo::PublicKeyInfo::PublicKeyInfo(X509CertificateInfo::PublicKeyInfo &&other)
+X509CertificateInfo::PublicKeyInfo::PublicKeyInfo(X509CertificateInfo::PublicKeyInfo &&other) noexcept
 {
   publicKey = std::move(other.publicKey);
   publicKeyType = other.publicKeyType;
   publicKeyStrength = other.publicKeyStrength;
 }
 
-X509CertificateInfo::PublicKeyInfo &X509CertificateInfo::PublicKeyInfo::operator=(X509CertificateInfo::PublicKeyInfo &&other)
+X509CertificateInfo::PublicKeyInfo &X509CertificateInfo::PublicKeyInfo::operator=(X509CertificateInfo::PublicKeyInfo &&other) noexcept
 {
   publicKey = std::move(other.publicKey);
   publicKeyType = other.publicKeyType;
@@ -40,9 +40,18 @@ X509CertificateInfo::EntityInfo::EntityInfo() = default;
 
 X509CertificateInfo::EntityInfo::~EntityInfo() = default;
 
-X509CertificateInfo::EntityInfo::EntityInfo(X509CertificateInfo::EntityInfo &&other) = default;
+X509CertificateInfo::EntityInfo::EntityInfo(X509CertificateInfo::EntityInfo &&other) noexcept = default;
 
-X509CertificateInfo::EntityInfo &X509CertificateInfo::EntityInfo::operator=(X509CertificateInfo::EntityInfo &&other) = default;
+// TODO when we stop supporting gcc 5.4 use this instead of the manually defined one
+// X509CertificateInfo::EntityInfo &X509CertificateInfo::EntityInfo::operator=(X509CertificateInfo::EntityInfo &&other) noexcept = default;
+X509CertificateInfo::EntityInfo &X509CertificateInfo::EntityInfo::operator=(X509CertificateInfo::EntityInfo &&other) noexcept
+{
+  commonName = std::move(other.commonName);
+  distinguishedName = std::move(other.distinguishedName);
+  email = std::move(other.email);
+  organization = std::move(other.organization);
+  return *this;
+}
 
 X509CertificateInfo::X509CertificateInfo() :
   ku_extensions(KU_NONE),
diff --git a/poppler/CertificateInfo.h b/poppler/CertificateInfo.h
index ec51e723..fde3b0d1 100644
--- a/poppler/CertificateInfo.h
+++ b/poppler/CertificateInfo.h
@@ -5,7 +5,7 @@
 // This file is licensed under the GPLv2 or later
 //
 // Copyright 2018 Chinmoy Ranjan Pradhan <chinmoyrp65 at gmail.com>
-// Copyright 2018 Albert Astals Cid <aacid at kde.org>
+// Copyright 2018, 2019 Albert Astals Cid <aacid at kde.org>
 // Copyright 2018 Oliver Sander <oliver.sander at tu-dresden.de>
 //
 //========================================================================
@@ -46,8 +46,8 @@ public:
   struct PublicKeyInfo {
     PublicKeyInfo();
 
-    PublicKeyInfo(PublicKeyInfo &&);
-    PublicKeyInfo &operator=(PublicKeyInfo &&);
+    PublicKeyInfo(PublicKeyInfo &&) noexcept;
+    PublicKeyInfo &operator=(PublicKeyInfo &&) noexcept;
 
     PublicKeyInfo(const PublicKeyInfo &) = delete;
     PublicKeyInfo &operator=(const PublicKeyInfo &) = delete;
@@ -61,8 +61,8 @@ public:
     EntityInfo();
     ~EntityInfo();
 
-    EntityInfo(EntityInfo &&);
-    EntityInfo &operator=(EntityInfo &&);
+    EntityInfo(EntityInfo &&) noexcept;
+    EntityInfo &operator=(EntityInfo &&) noexcept;
 
     EntityInfo(const EntityInfo &) = delete;
     EntityInfo &operator=(const EntityInfo &) = delete;
diff --git a/poppler/Object.h b/poppler/Object.h
index 2dbc9e96..77ae34bf 100644
--- a/poppler/Object.h
+++ b/poppler/Object.h
@@ -183,13 +183,13 @@ public:
 
   template<typename T> Object(T) = delete;
 
-  Object(Object&& other)
+  Object(Object&& other) noexcept
   {
     std::memcpy(reinterpret_cast<void*>(this), &other, sizeof(Object));
     other.type = objDead;
   }
 
-  Object& operator=(Object&& other)
+  Object& operator=(Object&& other) noexcept
   {
     free();
 
diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index dd619c62..60defc2c 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -473,7 +473,7 @@ bool PDFDoc::checkEncryption(const GooString *ownerPassword, const GooString *us
 static PDFSubtypePart pdfPartFromString(PDFSubtype subtype, GooString *pdfSubtypeVersion) {
   const std::regex regex("PDF/(?:A|X|VT|E|UA)-([[:digit:]])(?:[[:alpha:]]{1,2})?:?([[:digit:]]{4})?");
   std::smatch match;
-  std::string pdfsubver = pdfSubtypeVersion->toStr();
+  const std::string &pdfsubver = pdfSubtypeVersion->toStr();
   PDFSubtypePart subtypePart = subtypePartNone;
 
   if (std::regex_search(pdfsubver, match, regex)) {
@@ -533,7 +533,7 @@ static PDFSubtypePart pdfPartFromString(PDFSubtype subtype, GooString *pdfSubtyp
 static PDFSubtypeConformance pdfConformanceFromString(GooString *pdfSubtypeVersion) {
   const std::regex regex("PDF/(?:A|X|VT|E|UA)-[[:digit:]]([[:alpha:]]+)");
   std::smatch match;
-  const std::string pdfsubver = pdfSubtypeVersion->toStr();
+  const std::string &pdfsubver = pdfSubtypeVersion->toStr();
   PDFSubtypeConformance pdfConf = subtypeConfNone;
 
   // match contains the PDF conformance (A, B, G, N, P, PG or U)
diff --git a/qt5/src/poppler-annotation.cc b/qt5/src/poppler-annotation.cc
index 5f23782d..bb5be98f 100644
--- a/qt5/src/poppler-annotation.cc
+++ b/qt5/src/poppler-annotation.cc
@@ -1244,7 +1244,7 @@ void Annotation::storeBaseAnnotationProperties( QDomNode & annNode, QDomDocument
     bE.setAttribute( QStringLiteral("b"), QString::number( (double)brect.bottom() ) );
 
     // Sub-Node-2 - penStyle
-    const QVector<double> dashArray = s.dashArray();
+    const QVector<double> &dashArray = s.dashArray();
     if ( s.width() != 1 || s.lineStyle() != Solid || s.xCorners() != 0 ||
          s.yCorners() != 0.0 || dashArray.size() != 1 || dashArray[0] != 3 )
     {
diff --git a/qt5/src/poppler-link.cc b/qt5/src/poppler-link.cc
index f2d1655f..d4730948 100644
--- a/qt5/src/poppler-link.cc
+++ b/qt5/src/poppler-link.cc
@@ -434,7 +434,7 @@ class LinkMoviePrivate : public LinkPrivate
 		: Link( *new LinkGotoPrivate( linkArea, destination ) )
 	{
 		Q_D( LinkGoto );
-		d->extFileName = extFileName;
+		d->extFileName = std::move(extFileName); // TODO remove when extFileName moves to be a const &
 	}
 	
 	LinkGoto::~LinkGoto()
diff --git a/qt5/src/poppler-outline.cc b/qt5/src/poppler-outline.cc
index ad83139c..dd452b47 100644
--- a/qt5/src/poppler-outline.cc
+++ b/qt5/src/poppler-outline.cc
@@ -2,6 +2,7 @@
  *
  * Copyright (C) 2018 Adam Reichold <adam.reichold at t-online.de>
  * Copyright (C) 2019 Oliver Sander <oliver.sander at tu-dresden.de>
+ * Copyright (C) 2019 Albert Astals Cid <aacid at 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
@@ -50,12 +51,12 @@ OutlineItem &OutlineItem::operator=(const OutlineItem &other)
   return *this;
 }
 
-OutlineItem::OutlineItem(OutlineItem &&other) : m_data{other.m_data}
+OutlineItem::OutlineItem(OutlineItem &&other) noexcept : m_data{other.m_data}
 {
   other.m_data = nullptr;
 }
 
-OutlineItem &OutlineItem::operator=(OutlineItem &&other)
+OutlineItem &OutlineItem::operator=(OutlineItem &&other) noexcept
 {
   qSwap(m_data, other.m_data);
 
diff --git a/qt5/src/poppler-qt5.h b/qt5/src/poppler-qt5.h
index 847671ea..1460690f 100644
--- a/qt5/src/poppler-qt5.h
+++ b/qt5/src/poppler-qt5.h
@@ -1006,8 +1006,8 @@ delete it;
       OutlineItem(const OutlineItem &other);
       OutlineItem &operator=(const OutlineItem &other);
 
-      OutlineItem(OutlineItem &&other);
-      OutlineItem &operator=(OutlineItem &&other);
+      OutlineItem(OutlineItem &&other) noexcept;
+      OutlineItem &operator=(OutlineItem &&other) noexcept;
 
       /**
 	 Indicates whether an item is null, i.e. whether it does not represent a valid item in the outline of some PDF document.
diff --git a/splash/SplashPath.cc b/splash/SplashPath.cc
index 163ab77a..32bbd4f1 100644
--- a/splash/SplashPath.cc
+++ b/splash/SplashPath.cc
@@ -12,7 +12,7 @@
 // under GPL version 2 or later
 //
 // Copyright (C) 2018 Stefan Brüns <stefan.bruens at rwth-aachen.de>
-// Copyright (C) 2018 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2018, 2019 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2018 Adam Reichold <adam.reichold at t-online.de>
 //
 // To see a description of the changes please see the Changelog file that
@@ -69,7 +69,7 @@ SplashPath::SplashPath(SplashPath *path) {
   }
 }
 
-SplashPath::SplashPath(SplashPath&& path) {
+SplashPath::SplashPath(SplashPath&& path) noexcept {
   length = path.length;
   size = path.size;
   pts = path.pts;
diff --git a/splash/SplashPath.h b/splash/SplashPath.h
index e20d5335..95514b47 100644
--- a/splash/SplashPath.h
+++ b/splash/SplashPath.h
@@ -11,7 +11,7 @@
 // All changes made under the Poppler project to this file are licensed
 // under GPL version 2 or later
 //
-// Copyright (C) 2018 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2018, 2019 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2018 Stefan Brüns <stefan.bruens at rwth-aachen.de>
 //
 // To see a description of the changes please see the Changelog file that
@@ -75,7 +75,7 @@ public:
 
   SplashPath(const SplashPath&) = delete;
   SplashPath& operator=(const SplashPath&) = delete;
-  SplashPath(SplashPath&& path);
+  SplashPath(SplashPath&& path) noexcept;
 
   // Append <path> to <this>.
   void append(SplashPath *path);


More information about the poppler mailing list