Support clang/clang++
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Fri, 13 Oct 2023 09:16:58 +0000 (18:16 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Mon, 16 Oct 2023 04:22:32 +0000 (13:22 +0900)
Fix clang's complaints.
Addressing #3979

To build w/ LLVM, do
$ CC=clang CXX=clang++ meson ...

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
meson.build
tests/meson.build
tests/nnstreamer_filter_reload/tensor_filter_reload_test.c
tools/development/parser/toplevel.c

index b22af08..d71908e 100644 (file)
@@ -57,6 +57,10 @@ warning_flags = [
   '-Wvla',
   '-Wpointer-arith'
 ]
+if cxx.get_id() == 'clang'
+  # For the usage of GstTensorFilterFramework in tensor_filter_support_cc.cc
+  warning_flags += '-Wno-c99-designator'
+endif
 
 warning_c_flags = [
   '-Wmissing-declarations',
index 5318f9d..e40cbc8 100644 (file)
@@ -50,7 +50,16 @@ endif
 # gtest
 gtest_dep = dependency('gtest', required: false)
 if gtest_dep.found()
-  lesser_code_quality_accepted_for_unittest_code = declare_dependency(compile_args: ['-Wno-unused-parameter', '-Wno-missing-field-initializers', '-Wno-maybe-uninitialized'])
+  gtest_compile_args = ['-Wno-unused-parameter', '-Wno-missing-field-initializers', '-Wno-format-nonliteral']
+  if cc.get_id() == 'clang' and cxx.get_id() == 'clang'
+    gtest_compile_args += '-Wno-uninitialized'
+    gtest_compile_args += '-Wno-format-nonliteral'
+    gtest_compile_args += '-Wno-deprecated-copy'
+  else
+    gtest_compile_args += '-Wno-maybe-uninitialized'
+  endif
+
+  lesser_code_quality_accepted_for_unittest_code = declare_dependency(compile_args: gtest_compile_args)
 
   nnstreamer_unittest_deps = [
     unittest_util_dep,
index a49c10f..312eb54 100644 (file)
@@ -209,7 +209,7 @@ main (int argc, char *argv[])
           &second_model_path,
           "The path of second model file",
         "e.g., models/mobilenet_v2_1.0_224_quant.tflite"},
-    {NULL}
+    {0}
   };
 
   /* parse options */
index 902396d..d64d013 100644 (file)
@@ -31,7 +31,7 @@ static GOptionEntry entries[] = {
         "From pbtxt to gst pipeline", NULL},
   {"verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "Enable verbose messages",
         NULL},
-  {NULL}
+  {0}
 };
 
 /** @brief Get input string for parsing */