From 291bd68494bd3c07053deaf464c27ea4088009e4 Mon Sep 17 00:00:00 2001
From: Olivier BICHLER <olivier.bichler@cea.fr>
Date: Tue, 29 Aug 2023 17:46:17 +0200
Subject: [PATCH] Corrected MSVC errors

---
 include/aidge/operator/Add.hpp           |  3 ++-
 include/aidge/operator/AvgPooling.hpp    |  6 ++++--
 include/aidge/operator/BatchNorm.hpp     |  3 ++-
 include/aidge/operator/Conv.hpp          |  3 ++-
 include/aidge/operator/ConvDepthWise.hpp |  3 ++-
 include/aidge/operator/FC.hpp            |  4 ++--
 include/aidge/operator/LeakyReLU.hpp     | 15 ++++++++++-----
 include/aidge/operator/Matmul.hpp        |  8 +++++---
 include/aidge/operator/Producer.hpp      |  4 ++--
 include/aidge/operator/ReLU.hpp          | 15 ++++++++++-----
 include/aidge/operator/Softmax.hpp       | 15 ++++++++++-----
 python_binding/data/pybind_Tensor.cpp    |  6 +++---
 src/graph/GraphView.cpp                  |  4 ++--
 src/graph/Node.cpp                       |  2 +-
 14 files changed, 57 insertions(+), 34 deletions(-)

diff --git a/include/aidge/operator/Add.hpp b/include/aidge/operator/Add.hpp
index 2575e165b..aa249a228 100644
--- a/include/aidge/operator/Add.hpp
+++ b/include/aidge/operator/Add.hpp
@@ -108,8 +108,9 @@ public:
         assert(static_cast<std::size_t>(inputIdx) < NUM && "wrong inputIdx for Add operator.");
         return std::static_pointer_cast<Data>(mInputs[inputIdx]);
     }
-    std::shared_ptr<Data> getRawOutput(const IOIndex_t /*outputIdx*/) const override final {
+    std::shared_ptr<Data> getRawOutput(const IOIndex_t outputIdx) const override final {
         assert(outputIdx == 0 && "operator supports only 1 output");
+        (void) outputIdx; // avoid unused warning
         return std::static_pointer_cast<Data>(mOutput);
     }
 
diff --git a/include/aidge/operator/AvgPooling.hpp b/include/aidge/operator/AvgPooling.hpp
index a43184437..bfd5dc89b 100644
--- a/include/aidge/operator/AvgPooling.hpp
+++ b/include/aidge/operator/AvgPooling.hpp
@@ -108,12 +108,14 @@ public:
     }
 
 
-    std::shared_ptr<Data> getRawInput(const IOIndex_t /*inputIdx*/) const override final {
+    std::shared_ptr<Data> getRawInput(const IOIndex_t inputIdx) const override final {
         assert(inputIdx == 0 && "operators supports only 1 inputs");
+        (void) inputIdx; // avoid unused warning
         return std::static_pointer_cast<Data>(mInput);
     }
-    std::shared_ptr<Data> getRawOutput(const IOIndex_t /*outputIdx*/) const override final {
+    std::shared_ptr<Data> getRawOutput(const IOIndex_t outputIdx) const override final {
         assert(outputIdx == 0 && "operator supports only 1 output");
+        (void) outputIdx; // avoid unused warning
         return std::static_pointer_cast<Data>(mOutput);
     }
 
diff --git a/include/aidge/operator/BatchNorm.hpp b/include/aidge/operator/BatchNorm.hpp
index cecf006b0..4817ce5f5 100644
--- a/include/aidge/operator/BatchNorm.hpp
+++ b/include/aidge/operator/BatchNorm.hpp
@@ -107,8 +107,9 @@ public:
         assert(inputIdx < 5 && "operators supports only 5 inputs");
         return std::static_pointer_cast<Data>(mInputs[inputIdx]);
     }
-    std::shared_ptr<Data> getRawOutput(const IOIndex_t /*outputIdx*/) const override final {
+    std::shared_ptr<Data> getRawOutput(const IOIndex_t outputIdx) const override final {
         assert(outputIdx == 0 && "operator supports only 1 output");
+        (void) outputIdx; // avoid unused warning
         return std::static_pointer_cast<Data>(mOutput);
     }
 
diff --git a/include/aidge/operator/Conv.hpp b/include/aidge/operator/Conv.hpp
index df0876941..51e4f36c9 100644
--- a/include/aidge/operator/Conv.hpp
+++ b/include/aidge/operator/Conv.hpp
@@ -121,8 +121,9 @@ public:
         assert(inputIdx < 3 && "Conv Operators supports only 3 inputs");
         return mInputs[inputIdx];
     }
-    inline std::shared_ptr<Tensor> getOutput(const IOIndex_t /*outputIdx*/) const override final {
+    inline std::shared_ptr<Tensor> getOutput(const IOIndex_t outputIdx) const override final {
         assert((outputIdx == 0) && "Conv Operator has only 1 output");
+        (void) outputIdx; // avoid unused warning
         return mOutput;
     }
 
diff --git a/include/aidge/operator/ConvDepthWise.hpp b/include/aidge/operator/ConvDepthWise.hpp
index e3102d385..788541564 100644
--- a/include/aidge/operator/ConvDepthWise.hpp
+++ b/include/aidge/operator/ConvDepthWise.hpp
@@ -121,8 +121,9 @@ class ConvDepthWise_Op : public Operator,
         assert(inputIdx < 3 && "ConvDepthWise Operators supports only 3 inputs");
         return mInputs[inputIdx];
     }
-    inline std::shared_ptr<Tensor> getOutput(const IOIndex_t /*outputIdx*/) const override final {
+    inline std::shared_ptr<Tensor> getOutput(const IOIndex_t outputIdx) const override final {
         assert((outputIdx == 0) && "ConvDepthWise Operator has only 1 output");
+        (void) outputIdx; // avoid unused warning
         return mOutput;
     }
 
diff --git a/include/aidge/operator/FC.hpp b/include/aidge/operator/FC.hpp
index 5b8128239..6e4c54a03 100644
--- a/include/aidge/operator/FC.hpp
+++ b/include/aidge/operator/FC.hpp
@@ -98,7 +98,7 @@ public:
     }
     inline std::shared_ptr<Tensor> getOutput(const IOIndex_t outputIdx) const override final {
         assert((outputIdx == 0) && "FC Operator has only 1 output");
-        (void) outputIdx;
+        (void) outputIdx; // avoid unused warning
         return mOutput;
     }
 
@@ -109,7 +109,7 @@ public:
     }
     std::shared_ptr<Data> getRawOutput(const IOIndex_t outputIdx) const override final {
         assert(outputIdx == 0 && "operator supports only 1 output");
-        (void) outputIdx;
+        (void) outputIdx; // avoid unused warning
         return std::static_pointer_cast<Data>(mOutput);
     }
 
diff --git a/include/aidge/operator/LeakyReLU.hpp b/include/aidge/operator/LeakyReLU.hpp
index 4270ab487..64587d51d 100644
--- a/include/aidge/operator/LeakyReLU.hpp
+++ b/include/aidge/operator/LeakyReLU.hpp
@@ -53,8 +53,9 @@ public:
         setDatatype(DataType::Float32);
     }
 
-    void associateInput(const IOIndex_t /*inputIdx*/, std::shared_ptr<Data> data) override final {
+    void associateInput(const IOIndex_t inputIdx, std::shared_ptr<Data> data) override final {
         assert(inputIdx == 0 && "operator supports only 1 input");
+        (void) inputIdx; // avoid unused warning
         assert(strcmp(data->type(), Tensor::Type)==0 && "input data must be of Tensor type");
         mInput = std::dynamic_pointer_cast<Tensor>(data);
     }
@@ -73,22 +74,26 @@ public:
     inline Tensor& output(const IOIndex_t /*outputIdx*/) const override final { return *(mOutput.get()); }
 
 
-    inline std::shared_ptr<Tensor> getInput(const IOIndex_t /*inputIdx*/) const override final {
+    inline std::shared_ptr<Tensor> getInput(const IOIndex_t inputIdx) const override final {
         assert((inputIdx == 0) && "LeakyReLU Operator has only 1 input");
+        (void) inputIdx; // avoid unused warning
         return mInput;
     }
-    inline std::shared_ptr<Tensor> getOutput(const IOIndex_t /*outputIdx*/) const override final {
+    inline std::shared_ptr<Tensor> getOutput(const IOIndex_t outputIdx) const override final {
         assert((outputIdx == 0) && "LeakyReLU Operator has only 1 output");
+        (void) outputIdx; // avoid unused warning
         return mOutput;
     }
 
 
-    std::shared_ptr<Data> getRawInput(const IOIndex_t /*inputIdx*/) const override final {
+    std::shared_ptr<Data> getRawInput(const IOIndex_t inputIdx) const override final {
         assert(inputIdx == 0 && "operator supports only 1 input");
+        (void) inputIdx; // avoid unused warning
         return std::static_pointer_cast<Data>(mInput);
     }
-    std::shared_ptr<Data> getRawOutput(const IOIndex_t /*outputIdx*/) const override final {
+    std::shared_ptr<Data> getRawOutput(const IOIndex_t outputIdx) const override final {
         assert(outputIdx == 0 && "operator supports only 1 output");
+        (void) outputIdx; // avoid unused warning
         return mOutput;
     }
 
diff --git a/include/aidge/operator/Matmul.hpp b/include/aidge/operator/Matmul.hpp
index 58ea91b91..b44e8a9b9 100644
--- a/include/aidge/operator/Matmul.hpp
+++ b/include/aidge/operator/Matmul.hpp
@@ -55,7 +55,7 @@ public:
         setDatatype(DataType::Float32);
     }
 
-    void associateInput(const IOIndex_t /*inputIdx*/, std::shared_ptr<Data> data) override final {
+    void associateInput(const IOIndex_t inputIdx, std::shared_ptr<Data> data) override final {
         assert(inputIdx < 2 && "operators supports only 2 inputs");
         assert(strcmp(data->type(), Tensor::Type)==0 && "input data must be of Tensor type");
         mInputs[inputIdx] = std::dynamic_pointer_cast<Tensor>(data);
@@ -88,8 +88,9 @@ public:
         assert(inputIdx < 2 && "MatMul Operators has 2 inputs");
         return mInputs[inputIdx];
     }
-    inline std::shared_ptr<Tensor> getOutput(const IOIndex_t /*outputIdx*/) const override final {
+    inline std::shared_ptr<Tensor> getOutput(const IOIndex_t outputIdx) const override final {
         assert((outputIdx == 0) && "MatMul Operators has 1 output");
+        (void) outputIdx; // avoid unused warning
         return mOutput;
     }
 
@@ -98,8 +99,9 @@ public:
         assert(inputIdx < 2 && "operators supports only 2 inputs");
         return std::static_pointer_cast<Data>(mInputs[inputIdx]);
     }
-    std::shared_ptr<Data> getRawOutput(const IOIndex_t /*outputIdx*/) const override final {
+    std::shared_ptr<Data> getRawOutput(const IOIndex_t outputIdx) const override final {
         assert(outputIdx == 0 && "operator supports only 1 output");
+        (void) outputIdx; // avoid unused warning
         return std::static_pointer_cast<Data>(mOutput);
     }
 
diff --git a/include/aidge/operator/Producer.hpp b/include/aidge/operator/Producer.hpp
index cc02a9af0..1f77400ce 100644
--- a/include/aidge/operator/Producer.hpp
+++ b/include/aidge/operator/Producer.hpp
@@ -73,7 +73,7 @@ public:
     }
     inline std::shared_ptr<Tensor> getOutput(const IOIndex_t outputIdx) const override final {
       assert((outputIdx == 0) && "Producer Operator has only 1 output");
-      (void) outputIdx;
+      (void) outputIdx; // avoid unused warning
       return mOutput;
     }
 
@@ -85,7 +85,7 @@ public:
 
     std::shared_ptr<Data> getRawOutput(const IOIndex_t outputIdx) const override final {
         assert(outputIdx == 0 && "operator supports only 1 output");
-        (void) outputIdx;
+        (void) outputIdx; // avoid unused warning
         return std::static_pointer_cast<Data>(mOutput);
     }
 
diff --git a/include/aidge/operator/ReLU.hpp b/include/aidge/operator/ReLU.hpp
index 972a73388..3ea90462c 100644
--- a/include/aidge/operator/ReLU.hpp
+++ b/include/aidge/operator/ReLU.hpp
@@ -42,8 +42,9 @@ public:
         setDatatype(DataType::Float32);
     }
 
-    void associateInput(const IOIndex_t /*inputIdx*/, std::shared_ptr<Data> data) override final {
+    void associateInput(const IOIndex_t inputIdx, std::shared_ptr<Data> data) override final {
         assert(inputIdx == 0 && "operator supports only 1 input");
+        (void) inputIdx; // avoid unused warning
         assert(strcmp(data->type(), Tensor::Type)==0 && "input data must be of Tensor type");
         mInput = std::dynamic_pointer_cast<Tensor>(data);
     }
@@ -62,22 +63,26 @@ public:
     inline Tensor& output(const IOIndex_t /*outputIdx*/) const override final { return *(mOutput.get()); }
 
 
-    inline std::shared_ptr<Tensor> getInput(const IOIndex_t /*inputIdx*/) const override final {
+    inline std::shared_ptr<Tensor> getInput(const IOIndex_t inputIdx) const override final {
         assert((inputIdx == 0) && "ReLU Operator has only 1 input");
+        (void) inputIdx; // avoid unused warning
         return mInput;
     }
-    inline std::shared_ptr<Tensor> getOutput(const IOIndex_t /*outputIdx*/) const override final {
+    inline std::shared_ptr<Tensor> getOutput(const IOIndex_t outputIdx) const override final {
         assert((outputIdx == 0) && "ReLU Operator has only 1 output");
+        (void) outputIdx; // avoid unused warning
         return mOutput;
     }
 
 
-    std::shared_ptr<Data> getRawInput(const IOIndex_t /*inputIdx*/) const override final {
+    std::shared_ptr<Data> getRawInput(const IOIndex_t inputIdx) const override final {
         assert(inputIdx == 0 && "operator supports only 1 input");
+        (void) inputIdx; // avoid unused warning
         return std::static_pointer_cast<Data>(mInput);
     }
-    std::shared_ptr<Data> getRawOutput(const IOIndex_t /*outputIdx*/) const override final {
+    std::shared_ptr<Data> getRawOutput(const IOIndex_t outputIdx) const override final {
         assert(outputIdx == 0 && "operator supports only 1 output");
+        (void) outputIdx; // avoid unused warning
         return std::static_pointer_cast<Data>(mOutput);
     }
 
diff --git a/include/aidge/operator/Softmax.hpp b/include/aidge/operator/Softmax.hpp
index 81eb7fa90..93eb262f7 100644
--- a/include/aidge/operator/Softmax.hpp
+++ b/include/aidge/operator/Softmax.hpp
@@ -42,8 +42,9 @@ public:
         setDatatype(DataType::Float32);
     }
 
-    void associateInput(const IOIndex_t /*inputIdx*/, std::shared_ptr<Data> data) override final {
+    void associateInput(const IOIndex_t inputIdx, std::shared_ptr<Data> data) override final {
         assert(inputIdx == 0 && "operator supports only 1 input");
+        (void) inputIdx; // avoid unused warning
         assert(strcmp(data->type(), Tensor::Type)==0 && "input data must be of Tensor type");
         mInput = std::dynamic_pointer_cast<Tensor>(data);
     }
@@ -62,22 +63,26 @@ public:
     inline Tensor& output(const IOIndex_t /*outputIdx*/) const override final { return *(mOutput.get()); }
 
 
-    inline std::shared_ptr<Tensor> getInput(const IOIndex_t /*inputIdx*/) const override final {
+    inline std::shared_ptr<Tensor> getInput(const IOIndex_t inputIdx) const override final {
         assert((inputIdx == 0) && "Softmax Operator has only 1 input");
+        (void) inputIdx; // avoid unused warning
         return mInput;
     }
-    inline std::shared_ptr<Tensor> getOutput(const IOIndex_t /*outputIdx*/) const override final {
+    inline std::shared_ptr<Tensor> getOutput(const IOIndex_t outputIdx) const override final {
         assert((outputIdx == 0) && "Softmax Operator has only 1 output");
+        (void) outputIdx; // avoid unused warning
         return mOutput;
     }
 
 
-    std::shared_ptr<Data> getRawInput(const IOIndex_t /*inputIdx*/) const override final {
+    std::shared_ptr<Data> getRawInput(const IOIndex_t inputIdx) const override final {
         assert(inputIdx == 0 && "operator supports only 1 input");
+        (void) inputIdx; // avoid unused warning
         return std::static_pointer_cast<Data>(mInput);
     }
-    std::shared_ptr<Data> getRawOutput(const IOIndex_t /*outputIdx*/) const override final {
+    std::shared_ptr<Data> getRawOutput(const IOIndex_t outputIdx) const override final {
         assert(outputIdx == 0 && "operator supports only 1 output");
+        (void) outputIdx; // avoid unused warning
         return std::static_pointer_cast<Data>(mOutput);
     }
 
diff --git a/python_binding/data/pybind_Tensor.cpp b/python_binding/data/pybind_Tensor.cpp
index 3f741946d..d6442723e 100644
--- a/python_binding/data/pybind_Tensor.cpp
+++ b/python_binding/data/pybind_Tensor.cpp
@@ -98,9 +98,9 @@ void init_Tensor(py::module& m){
     .def_buffer([](Tensor& b) -> py::buffer_info {
         const std::unique_ptr<TensorImpl>& tensorImpl = b.getImpl();
 
-        std::vector<ssize_t> dims;
-        std::vector<ssize_t> strides;
-        ssize_t stride = tensorImpl->scalarSize();
+        std::vector<size_t> dims;
+        std::vector<size_t> strides;
+        size_t stride = tensorImpl->scalarSize();
 
         for (unsigned int dim = b.nbDims(); dim > 0; dim--) {
             dims.push_back(b.dims()[dim-1]);
diff --git a/src/graph/GraphView.cpp b/src/graph/GraphView.cpp
index e8b29c67c..ad412f5b8 100644
--- a/src/graph/GraphView.cpp
+++ b/src/graph/GraphView.cpp
@@ -30,13 +30,13 @@ Aidge::Connector Aidge::GraphView::operator()(
   assert((ctors.size() == static_cast<std::size_t>(inNode->nbDataInputs())) && "Wrong number of arguments.\n");
   for (std::pair<std::shared_ptr<Node>, IOIndex_t> &input : inNode->inputs()) {
     assert((gk_IODefaultIndex == input.second) && "At least one input connection is not free.\n");
-    (void)input; // Suppress ununsed warning
+    (void)input; // avoid unused warning
   }
 
   for (const Connector &ctor : ctors) {
     assert((ctor.node() != nullptr) &&
            "Input Connector must be associated with a node");
-    (void)ctors; // Suppress ununsed warning
+    (void)ctors; // avoid unused warning
   }
   IOIndex_t inID = 0;
   for (const Connector &ctor : ctors) {
diff --git a/src/graph/Node.cpp b/src/graph/Node.cpp
index f4e2b5818..b3db5befb 100644
--- a/src/graph/Node.cpp
+++ b/src/graph/Node.cpp
@@ -37,7 +37,7 @@ Aidge::Connector Aidge::Node::operator()(const std::vector<Connector> &ctors) {
     assert((ctors.size() == nbDataInputs()) && "Wrong number of arguments.\n");
     for (std::pair<std::shared_ptr<Node>, IOIndex_t> &input : inputs()) {
         assert((gk_IODefaultIndex == input.second) && "At least one input connection is not free.\n");
-        (void) input;
+        (void) input; // avoid unused warning
     }
     IOIndex_t i = 0;
     for (const Connector &ctor : ctors) {
-- 
GitLab