[build] Remove -wno-sign-compare
authorParichay Kapoor <pk.kapoor@samsung.com>
Mon, 30 Dec 2019 11:56:11 +0000 (20:56 +0900)
committerwooksong <wook16.song@samsung.com>
Thu, 2 Jan 2020 02:30:10 +0000 (11:30 +0900)
Remove -Wno-sign-compare
Apply corresponding fixes

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
ext/nnstreamer/tensor_filter/meson.build
ext/nnstreamer/tensor_filter/tensor_filter_caffe2.cc
ext/nnstreamer/tensor_filter/tensor_filter_python.cc
ext/nnstreamer/tensor_filter/tensor_filter_tensorflow.cc
ext/nnstreamer/tensor_filter/tensor_filter_tensorflow_lite.cc

index e26eb39..e107ecd 100644 (file)
@@ -42,7 +42,6 @@ if get_option('enable-tensorflow')
 
   shared_library('nnstreamer_filter_tensorflow',
     nnstreamer_filter_tf_sources,
-    cpp_args: ['-Wno-sign-compare'],
     dependencies: nnstreamer_filter_tf_deps,
     install: true,
     install_dir: filter_subplugin_install_dir
@@ -50,7 +49,6 @@ if get_option('enable-tensorflow')
 
   static_library('nnstreamer_filter_tensorflow',
     nnstreamer_filter_tf_sources,
-    cpp_args: ['-Wno-sign-compare'],
     dependencies: nnstreamer_filter_tf_deps,
     install: true,
     install_dir: nnstreamer_libdir
@@ -78,7 +76,6 @@ if get_option('enable-tensorflow-lite')
 
   shared_library('nnstreamer_filter_tensorflow-lite',
     nnstreamer_filter_tflite_sources,
-    cpp_args: ['-Wno-sign-compare'],
     dependencies: nnstreamer_filter_tflite_deps,
     install: true,
     install_dir: filter_subplugin_install_dir
@@ -86,7 +83,6 @@ if get_option('enable-tensorflow-lite')
 
   static_library('nnstreamer_filter_tensorflow-lite',
     nnstreamer_filter_tflite_sources,
-    cpp_args: ['-Wno-sign-compare'],
     dependencies: nnstreamer_filter_tflite_deps,
     install: true,
     install_dir: nnstreamer_libdir
@@ -105,7 +101,6 @@ if get_option('enable-pytorch')
 
   shared_library('nnstreamer_filter_pytorch',
     nnstreamer_filter_torch_sources,
-    cpp_args: ['-Wno-sign-compare'],
     dependencies: nnstreamer_filter_torch_deps,
     install: true,
     install_dir: filter_subplugin_install_dir
@@ -113,7 +108,6 @@ if get_option('enable-pytorch')
 
   static_library('nnstreamer_filter_pytorch',
     nnstreamer_filter_torch_sources,
-    cpp_args: ['-Wno-sign-compare'],
     dependencies: nnstreamer_filter_torch_deps,
     install: true,
     install_dir: nnstreamer_libdir
@@ -132,7 +126,6 @@ if get_option('enable-caffe2')
 
   shared_library('nnstreamer_filter_caffe2',
     nnstreamer_filter_caffe2_sources,
-    cpp_args: ['-Wno-sign-compare'],
     dependencies: nnstreamer_filter_caffe2_deps,
     install: true,
     install_dir: filter_subplugin_install_dir
@@ -140,7 +133,6 @@ if get_option('enable-caffe2')
 
   static_library('nnstreamer_filter_caffe2',
     nnstreamer_filter_caffe2_sources,
-    cpp_args: ['-Wno-sign-compare'],
     dependencies: nnstreamer_filter_caffe2_deps,
     install: true,
     install_dir: nnstreamer_libdir
@@ -159,7 +151,6 @@ if have_python2
 
   shared_library('nnstreamer_filter_python2',
     nnstreamer_filter_python_sources,
-    cpp_args: ['-Wno-sign-compare'],
     dependencies: nnstreamer_filter_python_deps,
     install: true,
     install_dir: filter_subplugin_install_dir
@@ -167,7 +158,6 @@ if have_python2
 
   static_library('nnstreamer_filter_python2',
     nnstreamer_filter_python_sources,
-    cpp_args: ['-Wno-sign-compare'],
     dependencies: nnstreamer_filter_python_deps,
     install: true,
     install_dir: nnstreamer_libdir
@@ -187,7 +177,6 @@ if have_python3
 
   shared_library('nnstreamer_filter_python3',
     nnstreamer_filter_python_sources,
-    cpp_args: ['-Wno-sign-compare'],
     dependencies: nnstreamer_filter_python_deps,
     install: true,
     install_dir: filter_subplugin_install_dir
@@ -195,7 +184,6 @@ if have_python3
 
   static_library('nnstreamer_filter_python3',
     nnstreamer_filter_python_sources,
-    cpp_args: ['-Wno-sign-compare'],
     dependencies: nnstreamer_filter_python_deps,
     install: true,
     install_dir: nnstreamer_libdir
index 0bd3e8a..95cadb2 100644 (file)
@@ -305,7 +305,7 @@ Caffe2Core::getOutputTensorDim (GstTensorsInfo * info)
 int
 Caffe2Core::run (const GstTensorMemory * input, GstTensorMemory * output)
 {
-  int i;
+  unsigned int i;
 #if (DBG)
   gint64 start_time = g_get_real_time ();
 #endif
index ef6728d..9f4fc6d 100644 (file)
@@ -461,7 +461,7 @@ PYCore::setInputTensorDim (const GstTensorsInfo * in_info, GstTensorsInfo * out_
   g_assert (param);
 
   inputTensorMeta.num_tensors = in_info->num_tensors;
-  for (int i = 0; i < in_info->num_tensors; i++) {
+  for (unsigned int i = 0; i < in_info->num_tensors; i++) {
     PyObject *shape = PyTensorShape_New (&in_info->info[i]);
     assert (shape);
 
@@ -472,7 +472,7 @@ PYCore::setInputTensorDim (const GstTensorsInfo * in_info, GstTensorsInfo * out_
       core_obj, (char*) "setInputDim", (char*) "(O)", param);
 
   /** dereference input param */
-  for (int i = 0; i < in_info->num_tensors; i++) {
+  for (unsigned int i = 0; i < in_info->num_tensors; i++) {
     PyObject *shape = PyList_GetItem(param, (Py_ssize_t) i);
     Py_XDECREF (shape);
   }
@@ -535,7 +535,7 @@ PYCore::parseOutputTensors(PyObject* result, GstTensorsInfo * info)
 
   info->num_tensors = PyList_Size(result);
 
-  for (int i = 0; i < info->num_tensors; i++) {
+  for (unsigned int i = 0; i < info->num_tensors; i++) {
     /** don't own the reference */
     PyObject *tensor_shape = PyList_GetItem(result, (Py_ssize_t) i);
     g_assert(tensor_shape);
@@ -582,7 +582,7 @@ PYCore::run (const GstTensorMemory * input, GstTensorMemory * output)
   Py_LOCK();
 
   PyObject *param = PyList_New(0);
-  for (int i = 0; i < inputTensorMeta.num_tensors; i++) {
+  for (unsigned int i = 0; i < inputTensorMeta.num_tensors; i++) {
     /** create a Numpy array wrapper (1-D) for NNS tensor data */
     npy_intp input_dims[] = {(npy_intp) input[i].size};
     PyObject *input_array = PyArray_SimpleNewFromData(
@@ -592,9 +592,9 @@ PYCore::run (const GstTensorMemory * input, GstTensorMemory * output)
 
   PyObject *result = PyObject_CallMethod(core_obj, (char*) "invoke", (char*) "(O)", param);
   if (result) {
-    g_assert(PyList_Size(result) == outputTensorMeta.num_tensors);
+    g_assert((unsigned int) PyList_Size(result) == outputTensorMeta.num_tensors);
 
-    for (int i = 0; i < outputTensorMeta.num_tensors; i++) {
+    for (unsigned int i = 0; i < outputTensorMeta.num_tensors; i++) {
       PyArrayObject* output_array = (PyArrayObject*) PyList_GetItem(result, (Py_ssize_t) i);
       /** type/size checking */
       if (checkTensorType(&output[i], output_array) &&
@@ -617,7 +617,7 @@ PYCore::run (const GstTensorMemory * input, GstTensorMemory * output)
   }
 
   /** dereference input param */
-  for (int i = 0; i < inputTensorMeta.num_tensors; i++) {
+  for (unsigned int i = 0; i < inputTensorMeta.num_tensors; i++) {
     PyObject *input_array = PyList_GetItem(param, (Py_ssize_t) i);
     Py_XDECREF (input_array);
   }
index 75fd6f2..7c23ecc 100644 (file)
@@ -358,7 +358,7 @@ TFCore::getTensorTypeToTF (tensor_type tType)
 int
 TFCore::validateTensor (const GstTensorsInfo * tensorInfo, int is_input)
 {
-  for (int i = 0; i < tensorInfo->num_tensors; i++) {
+  for (unsigned int i = 0; i < tensorInfo->num_tensors; i++) {
     /* set the name of tensor */
     TF_Operation *op = TF_GraphOperationByName (graph, tensorInfo->info[i].name);
 
@@ -485,7 +485,7 @@ TFCore::run (const GstTensorMemory * input, GstTensorMemory * output)
   int ret = 0;
 
   /* create input tensor for the graph from `input` */
-  for (int i = 0; i < inputTensorMeta.num_tensors; i++) {
+  for (unsigned int i = 0; i < inputTensorMeta.num_tensors; i++) {
     TF_Tensor* in_tensor = nullptr;
     TF_Output input_op = {
       TF_GraphOperationByName (graph, inputTensorMeta.info[i].name), 0
@@ -539,7 +539,7 @@ TFCore::run (const GstTensorMemory * input, GstTensorMemory * output)
   }
 
   /* create output tensor for the graph from `output` */
-  for (int i = 0; i < outputTensorMeta.num_tensors; i++) {
+  for (unsigned int i = 0; i < outputTensorMeta.num_tensors; i++) {
     TF_Output output_op = {
       TF_GraphOperationByName (graph, outputTensorMeta.info[i].name), 0
       };
@@ -568,13 +568,13 @@ TFCore::run (const GstTensorMemory * input, GstTensorMemory * output)
     goto failed;
   }
 
-  for (int i = 0; i < outputTensorMeta.num_tensors; i++) {
+  for (unsigned int i = 0; i < outputTensorMeta.num_tensors; i++) {
     output[i].data = TF_TensorData (output_tensors[i]);
     outputTensorMap.insert (std::make_pair (output[i].data, output_tensors[i]));
   }
 
 failed:
-  for (int i = 0; i < input_tensors.size(); i++) {
+  for (unsigned int i = 0; i < input_tensors.size(); i++) {
     TF_DeleteTensor (input_tensors[i]);
   }
 
index 83eeb05..8fa3edc 100644 (file)
@@ -196,7 +196,7 @@ TFLiteInterpreter::invoke (const GstTensorMemory * input,
   TfLiteTensor *tensor_ptr;
   TfLiteStatus status;
 
-  for (int i = 0; i < outputTensorMeta.num_tensors; ++i) {
+  for (unsigned int i = 0; i < outputTensorMeta.num_tensors; ++i) {
     tensor_idx = interpreter->outputs ()[i];
     tensor_ptr = interpreter->tensor (tensor_idx);
 
@@ -205,7 +205,7 @@ TFLiteInterpreter::invoke (const GstTensorMemory * input,
     tensors_idx.push_back (tensor_idx);
   }
 
-  for (int i = 0; i < inputTensorMeta.num_tensors; ++i) {
+  for (unsigned int i = 0; i < inputTensorMeta.num_tensors; ++i) {
     tensor_idx = interpreter->inputs ()[i];
     tensor_ptr = interpreter->tensor (tensor_idx);
 
@@ -376,7 +376,7 @@ TFLiteInterpreter::setTensorProp (const std::vector<int> &tensor_idx_list,
 {
   tensorMeta->num_tensors = tensor_idx_list.size ();
 
-  for (int i = 0; i < tensorMeta->num_tensors; ++i) {
+  for (unsigned int i = 0; i < tensorMeta->num_tensors; ++i) {
     if (getTensorDim (tensor_idx_list[i], tensorMeta->info[i].dimension)) {
       g_critical ("failed to get the dimension of input tensors");
       return -1;
@@ -431,7 +431,7 @@ TFLiteInterpreter::setInputTensorsInfo (const GstTensorsInfo * info)
   if (info->num_tensors != input_idx_list.size ())
     return -EINVAL;
 
-  for (int tensor_idx = 0; tensor_idx < info->num_tensors; ++tensor_idx) {
+  for (unsigned int tensor_idx = 0; tensor_idx < info->num_tensors; ++tensor_idx) {
     tensor_type tf_type;
     const GstTensorInfo *tensor_info;
     int input_rank;