فهرست منبع

fix clang-tidy warning performance-noexcept-move-constructor

Fabian Peter Hammerle 6 سال پیش
والد
کامیت
1f74fc0938
8فایلهای تغییر یافته به همراه16 افزوده شده و 17 حذف شده
  1. 0 1
      .clang-tidy
  2. 2 2
      include/hdf4cpp/HdfAttribute.h
  3. 2 2
      include/hdf4cpp/HdfFile.h
  4. 2 2
      include/hdf4cpp/HdfItem.h
  5. 4 4
      include/hdf4cpp/HdfObject.h
  6. 2 2
      lib/HdfAttribute.cpp
  7. 2 2
      lib/HdfFile.cpp
  8. 2 2
      lib/HdfItem.cpp

+ 0 - 1
.clang-tidy

@@ -41,4 +41,3 @@ WarningsAsErrors: >-
   -cppcoreguidelines-pro-type-member-init,
   -modernize-use-noexcept,
   -performance-move-const-arg,
-  -performance-noexcept-move-constructor,

+ 2 - 2
include/hdf4cpp/HdfAttribute.h

@@ -89,9 +89,9 @@ class HdfAttribute : public HdfObject {
 
   public:
     HdfAttribute(const HdfAttribute &) = delete;
-    HdfAttribute(HdfAttribute &&other);
+    HdfAttribute(HdfAttribute &&other) noexcept;
     HdfAttribute &operator=(const HdfAttribute &attribute) = delete;
-    HdfAttribute &operator=(HdfAttribute &&other);
+    HdfAttribute &operator=(HdfAttribute &&other) noexcept;
     /// \returns the number of elements of the attribute data
     int32 size() const;
 

+ 2 - 2
include/hdf4cpp/HdfFile.h

@@ -20,9 +20,9 @@ class HdfFile : public HdfObject {
   public:
     HdfFile(const std::string &path);
     HdfFile(const HdfFile &file) = delete;
-    HdfFile(HdfFile &&file);
+    HdfFile(HdfFile &&file) noexcept;
     HdfFile &operator=(const HdfFile &file) = delete;
-    HdfFile &operator=(HdfFile &&file);
+    HdfFile &operator=(HdfFile &&file) noexcept;
     ~HdfFile();
 
     int32 getSId() const;

+ 2 - 2
include/hdf4cpp/HdfItem.h

@@ -61,9 +61,9 @@ class HdfAttribute;
 class HdfItem : public HdfObject {
   public:
     HdfItem(const HdfItem &item) = delete;
-    HdfItem(HdfItem &&other);
+    HdfItem(HdfItem &&other) noexcept;
     HdfItem &operator=(const HdfItem &item) = delete;
-    HdfItem &operator=(HdfItem &&it);
+    HdfItem &operator=(HdfItem &&it) noexcept;
 
     /// \returns The name of the item
     std::string getName() const;

+ 4 - 4
include/hdf4cpp/HdfObject.h

@@ -54,12 +54,12 @@ class HdfObject {
 
   public:
     /// \returns the type of the object
-    virtual Type getType() const {
+    virtual Type getType() const noexcept {
         return type;
     }
 
     /// \returns the class type of the object
-    virtual ClassType getClassType() const {
+    virtual ClassType getClassType() const noexcept {
         return classType;
     }
 
@@ -75,10 +75,10 @@ class HdfObject {
         , chain(object->chain) {
     }
 
-    virtual void setType(const Type &type) {
+    virtual void setType(const Type &type) noexcept {
         this->type = type;
     }
-    virtual void setClassType(const ClassType &classType) {
+    virtual void setClassType(const ClassType &classType) noexcept {
         this->classType = classType;
     }
 

+ 2 - 2
lib/HdfAttribute.cpp

@@ -84,11 +84,11 @@ void hdf4cpp::HdfAttribute::HdfDataAttribute::get(void *dest) {
 int32 hdf4cpp::HdfAttribute::HdfDataAttribute::getDataType() const {
     return dataType;
 }
-hdf4cpp::HdfAttribute::HdfAttribute(HdfAttribute &&other)
+hdf4cpp::HdfAttribute::HdfAttribute(HdfAttribute &&other) noexcept
     : HdfObject(other.getType(), other.getClassType(), std::move(other.chain))
     , attribute(std::move(other.attribute)) {
 }
-hdf4cpp::HdfAttribute &hdf4cpp::HdfAttribute::operator=(HdfAttribute &&other) {
+hdf4cpp::HdfAttribute &hdf4cpp::HdfAttribute::operator=(HdfAttribute &&other) noexcept {
     attribute = std::move(other.attribute);
     setType(attribute->getType());
     setClassType(attribute->getClassType());

+ 2 - 2
lib/HdfFile.cpp

@@ -41,14 +41,14 @@ hdf4cpp::HdfFile::HdfFile(const std::string &path)
         loneRefs.emplace_back(ref, VDATA);
     }
 }
-hdf4cpp::HdfFile::HdfFile(HdfFile &&file)
+hdf4cpp::HdfFile::HdfFile(HdfFile &&file) noexcept
     : HdfObject(file.getType(), file.getClassType(), std::move(file.chain)) {
     sId = file.sId;
     vId = file.vId;
     loneRefs = std::move(file.loneRefs);
     file.sId = file.vId = FAIL;
 }
-hdf4cpp::HdfFile &hdf4cpp::HdfFile::operator=(HdfFile &&file) {
+hdf4cpp::HdfFile &hdf4cpp::HdfFile::operator=(HdfFile &&file) noexcept {
     setType(file.getType());
     setClassType(file.getClassType());
     chain = std::move(file.chain);

+ 2 - 2
lib/HdfItem.cpp

@@ -79,13 +79,13 @@ hdf4cpp::HdfItem::HdfItem(HdfItemBase *item, int32 sId, int32 vId)
     , sId(sId)
     , vId(vId) {
 }
-hdf4cpp::HdfItem::HdfItem(HdfItem &&other)
+hdf4cpp::HdfItem::HdfItem(HdfItem &&other) noexcept
     : HdfObject(other.getType(), other.getClassType(), std::move(other.chain))
     , item(std::move(other.item))
     , sId(other.sId)
     , vId(other.vId) {
 }
-hdf4cpp::HdfItem &hdf4cpp::HdfItem::operator=(HdfItem &&it) {
+hdf4cpp::HdfItem &hdf4cpp::HdfItem::operator=(HdfItem &&it) noexcept {
     setType(it.getType());
     setClassType(it.getClassType());
     chain = std::move(it.chain);