From d1fb1807fe63732d2e5e27fb22f29321676be1c0 Mon Sep 17 00:00:00 2001 From: Jake Farrell Date: Sat, 23 Mar 2013 21:35:03 -0400 Subject: [PATCH] Thrift-1859: Generated error c++ code with -out and include_prefix param Client: cpp Patch: Jingxu Chen Updates output directory to no longer include gen-cpp folder when using -out. --- compiler/cpp/src/generate/t_cpp_generator.cc | 12 +++++++----- compiler/cpp/src/parse/t_program.h | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/compiler/cpp/src/generate/t_cpp_generator.cc b/compiler/cpp/src/generate/t_cpp_generator.cc index 34a112d2..9eaf7ad2 100644 --- a/compiler/cpp/src/generate/t_cpp_generator.cc +++ b/compiler/cpp/src/generate/t_cpp_generator.cc @@ -2147,11 +2147,11 @@ void t_cpp_generator::generate_service_multiface(t_service* tservice) { indent() << "size_t sz = ifaces_.size();" << endl << indent() << "size_t i = 0;" << endl << indent() << "for (; i < (sz - 1); ++i) {" << endl; - indent_up(); - f_header_ << + indent_up(); + f_header_ << indent() << call << ";" << endl; - indent_down(); - f_header_ << + indent_down(); + f_header_ << indent() << "}" << endl; if (!(*f_iter)->get_returntype()->is_void()) { @@ -4615,7 +4615,9 @@ string t_cpp_generator::get_include_prefix(const t_program& program) const { string::size_type last_slash = string::npos; if ((last_slash = include_prefix.rfind("/")) != string::npos) { - return include_prefix.substr(0, last_slash) + "/" + out_dir_base_ + "/"; + return include_prefix.substr(0, last_slash) + + (get_program()->is_out_path_absolute() ? "/" : "/" + out_dir_base_ + "/"); + } return ""; diff --git a/compiler/cpp/src/parse/t_program.h b/compiler/cpp/src/parse/t_program.h index 60a47d04..12fcf0e3 100644 --- a/compiler/cpp/src/parse/t_program.h +++ b/compiler/cpp/src/parse/t_program.h @@ -80,7 +80,7 @@ class t_program : public t_doc { const std::string& get_out_path() const { return out_path_; } // Create gen-* dir accessor - bool is_out_path_absolute() { return out_path_is_absolute_; } + const bool is_out_path_absolute() const { return out_path_is_absolute_; } // Name accessor const std::string& get_name() const { return name_; } -- 2.17.1