From: David Reiss Date: Wed, 27 Feb 2008 22:28:12 +0000 (+0000) Subject: Fix a subtle bug in cpp_use_include_path. X-Git-Tag: 0.2.0~942 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=4b6a3c7a686a401e3e0eac972bfa1a96eabc198b;p=common%2Fthrift.git Fix a subtle bug in cpp_use_include_path. Summary: I thought I had eliminated all the places where work was only done if cpp_use_include_path was set. I guess I missed one. Reviewed By: mcslee, mrabkin, kholst Test Plan: Built BigGrep and looked at the generated code. Revert Plan: ok DiffCamp Revision: 8375 git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665530 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/compiler/cpp/src/main.cc b/compiler/cpp/src/main.cc index 75d23e22..80da53a6 100644 --- a/compiler/cpp/src/main.cc +++ b/compiler/cpp/src/main.cc @@ -1160,19 +1160,19 @@ int main(int argc, char** argv) { if (out_path.size()) { program->set_out_path(out_path); } - if (g_cpp_use_include_prefix) { - // infer this from the filename passed in - string input_filename = argv[i]; - string include_prefix; - - string::size_type last_slash = string::npos; - if ((last_slash = input_filename.rfind("/")) != string::npos) { - include_prefix = input_filename.substr(0, last_slash); - } - program->set_include_prefix(include_prefix); + // Compute the cpp include prefix. + // infer this from the filename passed in + string input_filename = argv[i]; + string include_prefix; + + string::size_type last_slash = string::npos; + if ((last_slash = input_filename.rfind("/")) != string::npos) { + include_prefix = input_filename.substr(0, last_slash); } + program->set_include_prefix(include_prefix); + // Initialize global types g_type_void = new t_base_type("void", t_base_type::TYPE_VOID); g_type_string = new t_base_type("string", t_base_type::TYPE_STRING);