[Meson] add minimal warning flag
authorJaeyun <jy1210.jung@samsung.com>
Fri, 3 May 2019 08:02:08 +0000 (17:02 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Sat, 11 May 2019 13:12:53 +0000 (22:12 +0900)
add minimal flags to prevent build warning

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
ext/nnstreamer/tensor_filter/tensor_filter_tensorflow_core.h
meson.build

index 0d9730a..8dc712a 100644 (file)
 #include <algorithm>
 #include <vector>
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wredundant-decls"
 #include <tensorflow/c/c_api.h>
 #include <tensorflow/c/c_api_internal.h>
 #include <tensorflow/core/public/session.h>
+#pragma GCC diagnostic pop
 
 using namespace tensorflow;
 
index a53f431..b619e18 100644 (file)
@@ -18,6 +18,44 @@ add_project_arguments('-DVERSION="'+meson.project_version()+'"', language: ['c',
 cc = meson.get_compiler('c')
 cxx = meson.get_compiler('cpp')
 
+warning_flags = [
+  '-Wredundant-decls',
+  '-Wwrite-strings',
+  '-Wformat',
+  '-Wformat-nonliteral',
+  '-Wformat-security',
+  '-Winit-self',
+  '-Wmissing-include-dirs',
+  '-Waddress',
+  '-Wno-multichar',
+  '-Wvla',
+  '-Wpointer-arith'
+]
+
+warning_c_flags = [
+  '-Wmissing-declarations',
+  '-Wmissing-prototypes',
+  '-Wnested-externs',
+  '-Waggregate-return',
+  '-Wold-style-definition',
+  '-Wdeclaration-after-statement'
+]
+
+foreach extra_arg : warning_flags
+  if cc.has_argument (extra_arg)
+    add_project_arguments([extra_arg], language: 'c')
+  endif
+  if cxx.has_argument (extra_arg)
+    add_project_arguments([extra_arg], language: 'cpp')
+  endif
+endforeach
+
+foreach extra_arg : warning_c_flags
+  if cc.has_argument (extra_arg)
+    add_project_arguments([extra_arg], language: 'c')
+  endif
+endforeach
+
 gst_api_verision = '1.0'
 
 # Set configuration