You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by jf...@apache.org on 2013/03/24 02:37:30 UTC

git commit: Thrift-1859: Generated error c++ code with -out and include_prefix param Client: cpp Patch: Jingxu Chen

Updated Branches:
  refs/heads/master 1f9717d19 -> d1fb1807f


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.


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/d1fb1807
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/d1fb1807
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/d1fb1807

Branch: refs/heads/master
Commit: d1fb1807fe63732d2e5e27fb22f29321676be1c0
Parents: 1f9717d
Author: Jake Farrell <jf...@apache.org>
Authored: Sat Mar 23 21:35:03 2013 -0400
Committer: Jake Farrell <jf...@apache.org>
Committed: Sat Mar 23 21:35:03 2013 -0400

----------------------------------------------------------------------
 compiler/cpp/src/generate/t_cpp_generator.cc |   12 +++++++-----
 compiler/cpp/src/parse/t_program.h           |    2 +-
 2 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/d1fb1807/compiler/cpp/src/generate/t_cpp_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/generate/t_cpp_generator.cc b/compiler/cpp/src/generate/t_cpp_generator.cc
index 34a112d..9eaf7ad 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 "";

http://git-wip-us.apache.org/repos/asf/thrift/blob/d1fb1807/compiler/cpp/src/parse/t_program.h
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/parse/t_program.h b/compiler/cpp/src/parse/t_program.h
index 60a47d0..12fcf0e 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_; }