From: Hwankyu Jhun Date: Wed, 2 Sep 2020 00:17:00 +0000 (+0900) Subject: Fix static analysis issues X-Git-Tag: accepted/tizen/6.0/unified/20201030.115946~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=94562e34e484413ab9e7c8c93557306da9ceb27e;p=platform%2Fcore%2Fappfw%2Ftidl.git Fix static analysis issues Issues: - UNREACHABLE - UNINIT.CTOR Change-Id: Ia4dc13bfd35f9a70d21b9a2a978a68f27e16ab69 Signed-off-by: Hwankyu Jhun --- diff --git a/idlc/options.cc b/idlc/options.cc index b9eaa76..435eb44 100644 --- a/idlc/options.cc +++ b/idlc/options.cc @@ -149,25 +149,35 @@ std::shared_ptr Options::Parse(int argc, char** argv) { if (cmd[CMD_HELP]) { options->PrintUsage(); return std::shared_ptr(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(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(nullptr); - } else if (!opt[OPT_INPUT]) { + } + + if (!opt[OPT_INPUT]) { std::cerr << "No input file." << std::endl; options->PrintSample(); return std::shared_ptr(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(nullptr); } - } else if (!opt[OPT_OUTPUT]) { + } + + if (!opt[OPT_OUTPUT]) { std::cerr << "No out file." << std::endl; options->PrintSample(); return std::shared_ptr(nullptr); diff --git a/idlc/options.h b/idlc/options.h index 3a09cfb..d0d2536 100644 --- a/idlc/options.h +++ b/idlc/options.h @@ -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_