Fix static analysis issues 98/242898/1
authorHwankyu Jhun <h.jhun@samsung.com>
Wed, 2 Sep 2020 00:17:00 +0000 (09:17 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Wed, 2 Sep 2020 00:17:00 +0000 (09:17 +0900)
Issues:
 - UNREACHABLE
 - UNINIT.CTOR

Change-Id: Ia4dc13bfd35f9a70d21b9a2a978a68f27e16ab69
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
idlc/options.cc
idlc/options.h

index b9eaa76..435eb44 100644 (file)
@@ -149,25 +149,35 @@ std::shared_ptr<Options> Options::Parse(int argc, char** argv) {
   if (cmd[CMD_HELP]) {
     options->PrintUsage();
     return std::shared_ptr<Options>(nullptr);
-  } else if (!cmd[CMD_PROXY] && !cmd[CMD_STUB]) {
+  }
+
+  if (!cmd[CMD_PROXY] && !cmd[CMD_STUB]) {
     std::cerr << "Stub or proxy must be specified." << std::endl;
     options->PrintSample();
     return std::shared_ptr<Options>(nullptr);
-  } else if (!opt[OPT_LANGUAGE]) {
+  }
+
+  if (!opt[OPT_LANGUAGE]) {
     std::cerr << "Select a language (C, C++, C#).." << std::endl;
     options->PrintSample();
     return std::shared_ptr<Options>(nullptr);
-  } else if (!opt[OPT_INPUT]) {
+  }
+
+  if (!opt[OPT_INPUT]) {
     std::cerr << "No input file." << std::endl;
     options->PrintSample();
     return std::shared_ptr<Options>(nullptr);
-  } else if (opt[OPT_INPUT]) {
+  }
+
+  if (opt[OPT_INPUT]) {
     std::ifstream in_file(options->input_.c_str());
     if (!in_file.good()) {
       std::cerr << "Not exist input file." << std::endl;
       return std::shared_ptr<Options>(nullptr);
     }
-  } else if (!opt[OPT_OUTPUT]) {
+  }
+
+  if (!opt[OPT_OUTPUT]) {
     std::cerr << "No out file." << std::endl;
     options->PrintSample();
     return std::shared_ptr<Options>(nullptr);
index 3a09cfb..d0d2536 100644 (file)
@@ -60,7 +60,7 @@ class Options {
   void PrintSample();
 
  private:
-  bool isProxy_;
+  bool isProxy_ = false;
   std::string language_;
   std::string input_;
   std::string output_;
@@ -73,4 +73,4 @@ class Options {
 
 }  // namespace tidl
 
-#endif  // TIDL_IDLC_OPTIONS_H_
\ No newline at end of file
+#endif  // TIDL_IDLC_OPTIONS_H_