This is an automated email from the ASF dual-hosted git repository.

lausen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/master by this push:
     new 4f5cd92  Fix compiler warnings in new FFI (#17718)
4f5cd92 is described below

commit 4f5cd92711c0a51e6355ab100902033da7e45d53
Author: Haozheng Fan <fhztc1997...@gmail.com>
AuthorDate: Sat Feb 29 02:20:05 2020 +0800

    Fix compiler warnings in new FFI (#17718)
    
    Introduced in https://github.com/apache/incubator-mxnet/pull/17510
---
 include/mxnet/ir/expr.h            |  4 +--
 include/mxnet/node/container.h     |  2 +-
 include/mxnet/runtime/container.h  |  4 +--
 include/mxnet/runtime/ffi_helper.h | 10 +++---
 include/mxnet/runtime/object.h     | 66 ++++++++++++++++++--------------------
 5 files changed, 42 insertions(+), 44 deletions(-)

diff --git a/include/mxnet/ir/expr.h b/include/mxnet/ir/expr.h
index b9483c7..a9f4ff2 100644
--- a/include/mxnet/ir/expr.h
+++ b/include/mxnet/ir/expr.h
@@ -141,7 +141,7 @@ class IntImmNode : public PrimExprNode {
   int64_t value;
 
   static constexpr const char* _type_key = "IntImm";
-  MXNET_DECLARE_FINAL_OBJECT_INFO(IntImmNode, PrimExprNode);
+  MXNET_DECLARE_FINAL_OBJECT_INFO(IntImmNode, PrimExprNode)
 };
 
 /*!
@@ -186,7 +186,7 @@ class FloatImmNode : public PrimExprNode {
   double value;
 
   static constexpr const char* _type_key = "FloatImm";
-  MXNET_DECLARE_FINAL_OBJECT_INFO(FloatImmNode, PrimExprNode);
+  MXNET_DECLARE_FINAL_OBJECT_INFO(FloatImmNode, PrimExprNode)
 };
 
 /*!
diff --git a/include/mxnet/node/container.h b/include/mxnet/node/container.h
index 27b9853..e164f64 100644
--- a/include/mxnet/node/container.h
+++ b/include/mxnet/node/container.h
@@ -42,7 +42,7 @@ class ArrayNode : public Object {
   std::vector<ObjectRef> data;
 
   static constexpr const char* _type_key = "Array";
-  MXNET_DECLARE_FINAL_OBJECT_INFO(ArrayNode, Object);
+  MXNET_DECLARE_FINAL_OBJECT_INFO(ArrayNode, Object)
 };
 
 /*!
diff --git a/include/mxnet/runtime/container.h 
b/include/mxnet/runtime/container.h
index 3dd7e0f..cd719aa 100644
--- a/include/mxnet/runtime/container.h
+++ b/include/mxnet/runtime/container.h
@@ -173,7 +173,7 @@ class ADTObj : public Object, public 
InplaceArrayBase<ADTObj, ObjectRef> {
 
   static constexpr const uint32_t _type_index = TypeIndex::kMXNetADT;
   static constexpr const char* _type_key = "MXNet.ADT";
-  MXNET_DECLARE_FINAL_OBJECT_INFO(ADTObj, Object);
+  MXNET_DECLARE_FINAL_OBJECT_INFO(ADTObj, Object)
 
  private:
   /*!
@@ -273,7 +273,7 @@ class ADT : public ObjectRef {
     return ADT(0, std::forward<Args>(args)...);
   }
 
-  MXNET_DEFINE_OBJECT_REF_METHODS(ADT, ObjectRef, ADTObj);
+  MXNET_DEFINE_OBJECT_REF_METHODS(ADT, ObjectRef, ADTObj)
 };
 
 }  // namespace runtime
diff --git a/include/mxnet/runtime/ffi_helper.h 
b/include/mxnet/runtime/ffi_helper.h
index b539524..49134ca 100644
--- a/include/mxnet/runtime/ffi_helper.h
+++ b/include/mxnet/runtime/ffi_helper.h
@@ -38,7 +38,7 @@ class EllipsisObj : public Object {
  public:
   static constexpr const uint32_t _type_index = TypeIndex::kEllipsis;
   static constexpr const char* _type_key = "MXNet.Ellipsis";
-  MXNET_DECLARE_FINAL_OBJECT_INFO(EllipsisObj, Object);
+  MXNET_DECLARE_FINAL_OBJECT_INFO(EllipsisObj, Object)
 };
 
 inline ObjectRef CreateEllipsis() {
@@ -54,7 +54,7 @@ class SliceObj : public Object {
 
   static constexpr const uint32_t _type_index = TypeIndex::kSlice;
   static constexpr const char* _type_key = "MXNet.Slice";
-  MXNET_DECLARE_FINAL_OBJECT_INFO(SliceObj, Object);
+  MXNET_DECLARE_FINAL_OBJECT_INFO(SliceObj, Object)
 };
 
 class Slice : public ObjectRef {
@@ -74,7 +74,7 @@ class Slice : public ObjectRef {
   // constant to represent None.
   static constexpr int64_t kNoneValue = std::numeric_limits<int64_t>::min();
 
-  MXNET_DEFINE_OBJECT_REF_METHODS(Slice, ObjectRef, SliceObj);
+  MXNET_DEFINE_OBJECT_REF_METHODS(Slice, ObjectRef, SliceObj)
 };
 
 int64_t inline SliceNoneValue() {
@@ -86,7 +86,7 @@ class IntegerObj: public Object {
   int64_t value;
   static constexpr const uint32_t _type_index = TypeIndex::kInteger;
   static constexpr const char* _type_key = "MXNet.Integer";
-  MXNET_DECLARE_FINAL_OBJECT_INFO(IntegerObj, Object);
+  MXNET_DECLARE_FINAL_OBJECT_INFO(IntegerObj, Object)
 };
 
 class Integer: public ObjectRef {
@@ -96,7 +96,7 @@ class Integer: public ObjectRef {
     data->value = value;
     data_ = std::move(data);
   }
-  MXNET_DEFINE_OBJECT_REF_METHODS(Integer, ObjectRef, IntegerObj);
+  MXNET_DEFINE_OBJECT_REF_METHODS(Integer, ObjectRef, IntegerObj)
 };
 
 //  Helper functions for fast FFI implementations
diff --git a/include/mxnet/runtime/object.h b/include/mxnet/runtime/object.h
index e2fb067..a031a56 100644
--- a/include/mxnet/runtime/object.h
+++ b/include/mxnet/runtime/object.h
@@ -644,22 +644,20 @@ struct ObjectEqual {
  * \param TypeName The name of the current type.
  * \param ParentType The name of the ParentType
  */
-#define MXNET_DECLARE_BASE_OBJECT_INFO(TypeName, ParentType)              \
-  static const uint32_t RuntimeTypeIndex()  {                           \
-    if (TypeName::_type_index != ::mxnet::runtime::TypeIndex::kDynamic) { \
-      return TypeName::_type_index;                                     \
-    }                                                                   \
-    return _GetOrAllocRuntimeTypeIndex();                               \
-  }                                                                     \
-  static const uint32_t _GetOrAllocRuntimeTypeIndex()  {                \
-    static uint32_t tidx = GetOrAllocRuntimeTypeIndex(                  \
-        TypeName::_type_key,                                            \
-        TypeName::_type_index,                                          \
-        ParentType::_GetOrAllocRuntimeTypeIndex(),                      \
-        TypeName::_type_child_slots,                                    \
-        TypeName::_type_child_slots_can_overflow);                      \
-    return tidx;                                                        \
-  }                                                                     \
+#define MXNET_DECLARE_BASE_OBJECT_INFO(TypeName, ParentType)                \
+  static uint32_t RuntimeTypeIndex()  {                                     \
+    return TypeName::_type_index != ::mxnet::runtime::TypeIndex::kDynamic ? \
+           TypeName::_type_index : _GetOrAllocRuntimeTypeIndex();           \
+  }                                                                         \
+  static uint32_t _GetOrAllocRuntimeTypeIndex()  {                          \
+    static uint32_t tidx = GetOrAllocRuntimeTypeIndex(                      \
+        TypeName::_type_key,                                                \
+        TypeName::_type_index,                                              \
+        ParentType::_GetOrAllocRuntimeTypeIndex(),                          \
+        TypeName::_type_child_slots,                                        \
+        TypeName::_type_child_slots_can_overflow);                          \
+    return tidx;                                                            \
+  }
 
 /*!
  * \brief helper macro to declare type information in a final class.
@@ -667,8 +665,8 @@ struct ObjectEqual {
   * \param ParentType The name of the ParentType
   */
 #define MXNET_DECLARE_FINAL_OBJECT_INFO(TypeName, ParentType)             \
-  static const constexpr bool _type_final = true;                       \
-  static const constexpr int _type_child_slots = 0;                     \
+  static const constexpr bool _type_final = true;                         \
+  static const constexpr int _type_child_slots = 0;                       \
   MXNET_DECLARE_BASE_OBJECT_INFO(TypeName, ParentType)                    \
 
 
@@ -684,25 +682,25 @@ struct ObjectEqual {
 
 
 #define MXNET_DEFINE_OBJECT_REF_METHODS(TypeName, ParentType, ObjectName) \
-  TypeName() {}                                                         \
-  explicit TypeName(                                                    \
-      ::mxnet::runtime::ObjectPtr<::mxnet::runtime::Object> n)              \
-      : ParentType(n) {}                                                \
-  const ObjectName* operator->() const {                                \
-    return static_cast<const ObjectName*>(data_.get());                 \
-  }                                                                     \
-  operator bool() const { return data_ != nullptr; }                    \
+  TypeName() {}                                                           \
+  explicit TypeName(                                                      \
+      ::mxnet::runtime::ObjectPtr<::mxnet::runtime::Object> n)            \
+      : ParentType(n) {}                                                  \
+  const ObjectName* operator->() const {                                  \
+    return static_cast<const ObjectName*>(data_.get());                   \
+  }                                                                       \
+  operator bool() const { return data_ != nullptr; }                      \
   using ContainerType = ObjectName;
 
 #define MXNET_DEFINE_OBJECT_REF_METHODS_MUT(TypeName, ParentType, ObjectName) \
-  TypeName() {}                                                             \
-  explicit TypeName(                                                        \
-      ::mxnet::runtime::ObjectPtr<::mxnet::runtime::Object> n)                 
 \
-      : ParentType(n) {}                                                    \
-  ObjectName* operator->() {                                    \
-    return static_cast<ObjectName*>(data_.get());                     \
-  }                                                                         \
-  operator bool() const { return data_ != nullptr; }                        \
+  TypeName() {}                                                               \
+  explicit TypeName(                                                          \
+      ::mxnet::runtime::ObjectPtr<::mxnet::runtime::Object> n)                \
+      : ParentType(n) {}                                                      \
+  ObjectName* operator->() {                                                  \
+    return static_cast<ObjectName*>(data_.get());                             \
+  }                                                                           \
+  operator bool() const { return data_ != nullptr; }                          \
   using ContainerType = ObjectName;
 
 // Implementations details below

Reply via email to