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 75d23e2..80da53a 100644
--- a/compiler/cpp/src/main.cc
+++ b/compiler/cpp/src/main.cc
@@ -1160,19 +1160,19 @@
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);
- }
+ // Compute the cpp include prefix.
+ // infer this from the filename passed in
+ string input_filename = argv[i];
+ string include_prefix;
- program->set_include_prefix(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);