Skip to content

Commit

Permalink
THRIFT-1552 Include paths for c/c++ should be prefixed with 'thrift/'
Browse files Browse the repository at this point in the history
To ensure there are no include path collisions the C and C++ header
include paths should include 'thrift' as the root leaf. This will
prevent having to place /usr/include/thrift into the compilers include
header search path, which might otherwise result in the compiler
accidentally picking up headers that it shouldn't.

e.g. #include <foo/bar.h> should be #include <thrift/foo/bar.h>

Change-Id: I48f2b0f549bda0fc81e85506ac857adc800b98a1

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1325674 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
bufferoverflow committed Apr 13, 2012
1 parent 49ef658 commit 49ff8b1
Show file tree
Hide file tree
Showing 223 changed files with 800 additions and 1,496 deletions.
40 changes: 20 additions & 20 deletions LICENSE
Expand Up @@ -223,25 +223,25 @@ the Thrift Software License (see doc/old-thrift-license.txt), and relicensed
under the Apache 2.0 License:

compiler/cpp/Makefile.am
compiler/cpp/src/generate/t_cocoa_generator.cc
compiler/cpp/src/generate/t_cpp_generator.cc
compiler/cpp/src/generate/t_csharp_generator.cc
compiler/cpp/src/generate/t_erl_generator.cc
compiler/cpp/src/generate/t_hs_generator.cc
compiler/cpp/src/generate/t_java_generator.cc
compiler/cpp/src/generate/t_ocaml_generator.cc
compiler/cpp/src/generate/t_perl_generator.cc
compiler/cpp/src/generate/t_php_generator.cc
compiler/cpp/src/generate/t_py_generator.cc
compiler/cpp/src/generate/t_rb_generator.cc
compiler/cpp/src/generate/t_st_generator.cc
compiler/cpp/src/generate/t_xsd_generator.cc
compiler/cpp/src/main.cc
compiler/cpp/src/parse/t_field.h
compiler/cpp/src/parse/t_program.h
compiler/cpp/src/platform.h
compiler/cpp/src/thriftl.ll
compiler/cpp/src/thrifty.yy
compiler/cpp/src/thrift/generate/t_cocoa_generator.cc
compiler/cpp/src/thrift/generate/t_cpp_generator.cc
compiler/cpp/src/thrift/generate/t_csharp_generator.cc
compiler/cpp/src/thrift/generate/t_erl_generator.cc
compiler/cpp/src/thrift/generate/t_hs_generator.cc
compiler/cpp/src/thrift/generate/t_java_generator.cc
compiler/cpp/src/thrift/generate/t_ocaml_generator.cc
compiler/cpp/src/thrift/generate/t_perl_generator.cc
compiler/cpp/src/thrift/generate/t_php_generator.cc
compiler/cpp/src/thrift/generate/t_py_generator.cc
compiler/cpp/src/thrift/generate/t_rb_generator.cc
compiler/cpp/src/thrift/generate/t_st_generator.cc
compiler/cpp/src/thrift/generate/t_xsd_generator.cc
compiler/cpp/src/thrift/main.cc
compiler/cpp/src/thrift/parse/t_field.h
compiler/cpp/src/thrift/parse/t_program.h
compiler/cpp/src/thrift/platform.h
compiler/cpp/src/thrift/thriftl.ll
compiler/cpp/src/thrift/thrifty.yy
lib/csharp/src/Protocol/TBinaryProtocol.cs
lib/csharp/src/Protocol/TField.cs
lib/csharp/src/Protocol/TList.cs
Expand Down Expand Up @@ -289,7 +289,7 @@ For the aclocal/ax_boost_base.m4 and contrib/fb303/aclocal/ax_boost_base.m4 comp
# the copyright notice and this notice are preserved.

--------------------------------------------------
For the compiler/cpp/src/md5.[ch] components:
For the compiler/cpp/src/thrift/md5.[ch] components:

/*
Copyright (C) 1999, 2000, 2002 Aladdin Enterprises. All rights reserved.
Expand Down
134 changes: 67 additions & 67 deletions compiler/cpp/compiler.vcxproj
Expand Up @@ -19,66 +19,66 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\generate\t_generator.h" />
<ClInclude Include="src\generate\t_generator_registry.h" />
<ClInclude Include="src\generate\t_oop_generator.h" />
<ClInclude Include="src\globals.h" />
<ClInclude Include="src\main.h" />
<ClInclude Include="src\md5.h" />
<ClInclude Include="src\parse\t_base_type.h" />
<ClInclude Include="src\parse\t_const.h" />
<ClInclude Include="src\parse\t_const_value.h" />
<ClInclude Include="src\parse\t_container.h" />
<ClInclude Include="src\parse\t_doc.h" />
<ClInclude Include="src\parse\t_enum.h" />
<ClInclude Include="src\parse\t_enum_value.h" />
<ClInclude Include="src\parse\t_field.h" />
<ClInclude Include="src\parse\t_function.h" />
<ClInclude Include="src\parse\t_list.h" />
<ClInclude Include="src\parse\t_map.h" />
<ClInclude Include="src\parse\t_program.h" />
<ClInclude Include="src\parse\t_scope.h" />
<ClInclude Include="src\parse\t_service.h" />
<ClInclude Include="src\parse\t_set.h" />
<ClInclude Include="src\parse\t_struct.h" />
<ClInclude Include="src\parse\t_type.h" />
<ClInclude Include="src\parse\t_typedef.h" />
<ClInclude Include="src\platform.h" />
<ClInclude Include="src\thrifty.h" />
<ClInclude Include="src\windows\config.h" />
<ClInclude Include="src\windows\version.h" />
<ClInclude Include="src\thrift\generate\t_generator.h" />
<ClInclude Include="src\thrift\generate\t_generator_registry.h" />
<ClInclude Include="src\thrift\generate\t_oop_generator.h" />
<ClInclude Include="src\thrift\globals.h" />
<ClInclude Include="src\thrift\main.h" />
<ClInclude Include="src\thrift\md5.h" />
<ClInclude Include="src\thrift\parse\t_base_type.h" />
<ClInclude Include="src\thrift\parse\t_const.h" />
<ClInclude Include="src\thrift\parse\t_const_value.h" />
<ClInclude Include="src\thrift\parse\t_container.h" />
<ClInclude Include="src\thrift\parse\t_doc.h" />
<ClInclude Include="src\thrift\parse\t_enum.h" />
<ClInclude Include="src\thrift\parse\t_enum_value.h" />
<ClInclude Include="src\thrift\parse\t_field.h" />
<ClInclude Include="src\thrift\parse\t_function.h" />
<ClInclude Include="src\thrift\parse\t_list.h" />
<ClInclude Include="src\thrift\parse\t_map.h" />
<ClInclude Include="src\thrift\parse\t_program.h" />
<ClInclude Include="src\thrift\parse\t_scope.h" />
<ClInclude Include="src\thrift\parse\t_service.h" />
<ClInclude Include="src\thrift\parse\t_set.h" />
<ClInclude Include="src\thrift\parse\t_struct.h" />
<ClInclude Include="src\thrift\parse\t_type.h" />
<ClInclude Include="src\thrift\parse\t_typedef.h" />
<ClInclude Include="src\thrift\platform.h" />
<ClInclude Include="src\thrift\thrifty.h" />
<ClInclude Include="src\thrift\windows\config.h" />
<ClInclude Include="src\thrift\windows\version.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\generate\t_as3_generator.cc" />
<ClCompile Include="src\generate\t_cocoa_generator.cc" />
<ClCompile Include="src\generate\t_cpp_generator.cc" />
<ClCompile Include="src\generate\t_csharp_generator.cc" />
<ClCompile Include="src\generate\t_c_glib_generator.cc" />
<ClCompile Include="src\generate\t_erl_generator.cc" />
<ClCompile Include="src\generate\t_generator.cc" />
<ClCompile Include="src\generate\t_go_generator.cc" />
<ClCompile Include="src\generate\t_hs_generator.cc" />
<ClCompile Include="src\generate\t_html_generator.cc" />
<ClCompile Include="src\generate\t_javame_generator.cc" />
<ClCompile Include="src\generate\t_java_generator.cc" />
<ClCompile Include="src\generate\t_js_generator.cc" />
<ClCompile Include="src\generate\t_ocaml_generator.cc" />
<ClCompile Include="src\generate\t_perl_generator.cc" />
<ClCompile Include="src\generate\t_php_generator.cc" />
<ClCompile Include="src\generate\t_py_generator.cc" />
<ClCompile Include="src\generate\t_rb_generator.cc" />
<ClCompile Include="src\generate\t_st_generator.cc" />
<ClCompile Include="src\generate\t_xsd_generator.cc" />
<ClCompile Include="src\main.cc" />
<ClCompile Include="src\md5.c" />
<ClCompile Include="src\parse\parse.cc" />
<ClCompile Include="src\thriftl.cc" />
<ClCompile Include="src\thrifty.cc" />
<ClCompile Include="src\thrift\generate\t_as3_generator.cc" />
<ClCompile Include="src\thrift\generate\t_cocoa_generator.cc" />
<ClCompile Include="src\thrift\generate\t_cpp_generator.cc" />
<ClCompile Include="src\thrift\generate\t_csharp_generator.cc" />
<ClCompile Include="src\thrift\generate\t_c_glib_generator.cc" />
<ClCompile Include="src\thrift\generate\t_erl_generator.cc" />
<ClCompile Include="src\thrift\generate\t_generator.cc" />
<ClCompile Include="src\thrift\generate\t_go_generator.cc" />
<ClCompile Include="src\thrift\generate\t_hs_generator.cc" />
<ClCompile Include="src\thrift\generate\t_html_generator.cc" />
<ClCompile Include="src\thrift\generate\t_javame_generator.cc" />
<ClCompile Include="src\thrift\generate\t_java_generator.cc" />
<ClCompile Include="src\thrift\generate\t_js_generator.cc" />
<ClCompile Include="src\thrift\generate\t_ocaml_generator.cc" />
<ClCompile Include="src\thrift\generate\t_perl_generator.cc" />
<ClCompile Include="src\thrift\generate\t_php_generator.cc" />
<ClCompile Include="src\thrift\generate\t_py_generator.cc" />
<ClCompile Include="src\thrift\generate\t_rb_generator.cc" />
<ClCompile Include="src\thrift\generate\t_st_generator.cc" />
<ClCompile Include="src\thrift\generate\t_xsd_generator.cc" />
<ClCompile Include="src\thrift\main.cc" />
<ClCompile Include="src\thrift\md5.c" />
<ClCompile Include="src\thrift\parse\parse.cc" />
<ClCompile Include="src\thrift\thriftl.cc" />
<ClCompile Include="src\thrift\thrifty.cc" />
</ItemGroup>
<ItemGroup>
<None Include="README_WINDOWS" />
<None Include="src\thriftl.ll" />
<None Include="src\thrifty.yy" />
<None Include="src\thrift\thriftl.ll" />
<None Include="src\thrift\thrifty.yy" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{89975A1A-F799-4556-98B8-64E30AB39A90}</ProjectGuid>
Expand Down Expand Up @@ -126,25 +126,25 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(ProjectDir)\src\;$(ProjectDir)\src\windows\;$(IncludePath)</IncludePath>
<IncludePath>$(ProjectDir)\src\thrift\;$(ProjectDir)\src\windows\;$(IncludePath)</IncludePath>
<TargetName>thrift</TargetName>
<ExecutablePath>$(ExecutablePath);C:\Program Files (x86)\Git\bin</ExecutablePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(ProjectDir)\src\;$(ProjectDir)\src\windows\;$(IncludePath)</IncludePath>
<IncludePath>$(ProjectDir)\src\thrift\;$(ProjectDir)\src\windows\;$(IncludePath)</IncludePath>
<TargetName>thrift</TargetName>
<ExecutablePath>$(ExecutablePath);C:\Program Files (x86)\Git\bin</ExecutablePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(ProjectDir)\src\;$(ProjectDir)\src\windows\;$(IncludePath)</IncludePath>
<IncludePath>$(ProjectDir)\src\thrift\;$(ProjectDir)\src\windows\;$(IncludePath)</IncludePath>
<TargetName>thrift</TargetName>
<ExecutablePath>$(ExecutablePath);C:\Program Files (x86)\Git\bin</ExecutablePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(ProjectDir)\src\;$(ProjectDir)\src\windows\;$(IncludePath)</IncludePath>
<IncludePath>$(ProjectDir)\src\thrift\;$(ProjectDir)\src\windows\;$(IncludePath)</IncludePath>
<TargetName>thrift</TargetName>
<ExecutablePath>$(ExecutablePath);C:\Program Files (x86)\Git\bin</ExecutablePath>
</PropertyGroup>
Expand All @@ -163,8 +163,8 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PreBuildEvent>
<Command>flex -o "src/thriftl.cc" src/thriftl.ll
bison -y -o "src/thrifty.cc" --defines="src/thrifty.h" src/thrifty.yy</Command>
<Command>flex -o "src\thrift\thriftl.cc" src/thriftl.ll
bison -y -o "src\thrift\thrifty.cc" --defines="src/thrifty.h" src/thrifty.yy</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
Expand All @@ -182,8 +182,8 @@ bison -y -o "src/thrifty.cc" --defines="src/thrifty.h" src/thrifty.yy</Command>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PreBuildEvent>
<Command>flex -o "src/thriftl.cc" src/thriftl.ll
bison -y -o "src/thrifty.cc" --defines="src/thrifty.h" src/thrifty.yy</Command>
<Command>flex -o "src\thrift\thriftl.cc" src/thriftl.ll
bison -y -o "src\thrift\thrifty.cc" --defines="src/thrifty.h" src/thrifty.yy</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
Expand All @@ -205,8 +205,8 @@ bison -y -o "src/thrifty.cc" --defines="src/thrifty.h" src/thrifty.yy</Command>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<PreBuildEvent>
<Command>flex -o "src/thriftl.cc" src/thriftl.ll
bison -y -o "src/thrifty.cc" --defines="src/thrifty.h" src/thrifty.yy</Command>
<Command>flex -o "src\thrift\thriftl.cc" src/thriftl.ll
bison -y -o "src\thrift\thrifty.cc" --defines="src/thrifty.h" src/thrifty.yy</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
Expand All @@ -228,8 +228,8 @@ bison -y -o "src/thrifty.cc" --defines="src/thrifty.h" src/thrifty.yy</Command>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<PreBuildEvent>
<Command>flex -o "src/thriftl.cc" src/thriftl.ll
bison -y -o "src/thrifty.cc" --defines="src/thrifty.h" src/thrifty.yy</Command>
<Command>flex -o "src\thrift\thriftl.cc" src/thriftl.ll
bison -y -o "src\thrift\thrifty.cc" --defines="src/thrifty.h" src/thrifty.yy</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
Expand Down
6 changes: 3 additions & 3 deletions compiler/cpp/src/generate/t_c_glib_generator.cc
Expand Up @@ -186,7 +186,7 @@ void t_c_glib_generator::init_generator() {
"/* base includes */" << endl <<
"#include <glib-object.h>" << endl <<
"#include <thrift_struct.h>" << endl <<
"#include <protocol/thrift_protocol.h>" << endl;
"#include <thrift/protocol/thrift_protocol.h>" << endl;

/* include other thrift includes */
const vector<t_program *> &includes = program_->get_includes();
Expand Down Expand Up @@ -217,7 +217,7 @@ void t_c_glib_generator::init_generator() {
endl <<
"#include \"" << this->nspace_lc << program_name_u <<
"_types.h\"" << endl <<
"#include <thrift.h>" << endl <<
"#include <thrift/thrift.h>" << endl <<
endl;

f_types_ <<
Expand Down Expand Up @@ -410,7 +410,7 @@ void t_c_glib_generator::generate_service (t_service *tservice) {
// include the headers
f_service_ <<
"#include <string.h>" << endl <<
"#include <thrift.h>" << endl <<
"#include <thrift/thrift.h>" << endl <<
"#include <thrift_application_exception.h>" << endl <<
"#include \"" << filename << ".h\"" << endl <<
endl;
Expand Down
32 changes: 16 additions & 16 deletions compiler/cpp/src/generate/t_cpp_generator.cc
Expand Up @@ -343,10 +343,10 @@ void t_cpp_generator::init_generator() {

// Include base types
f_types_ <<
"#include <Thrift.h>" << endl <<
"#include <TApplicationException.h>" << endl <<
"#include <protocol/TProtocol.h>" << endl <<
"#include <transport/TTransport.h>" << endl <<
"#include <thrift/Thrift.h>" << endl <<
"#include <thrift/TApplicationException.h>" << endl <<
"#include <thrift/protocol/TProtocol.h>" << endl <<
"#include <thrift/transport/TTransport.h>" << endl <<
endl;

// Include other Thrift includes
Expand Down Expand Up @@ -392,7 +392,7 @@ void t_cpp_generator::init_generator() {
// the definition of TypeSpec.
if (gen_dense_) {
f_types_impl_ <<
"#include <TReflectionLocal.h>" << endl <<
"#include <thrift/TReflectionLocal.h>" << endl <<
endl;
}

Expand Down Expand Up @@ -1571,17 +1571,17 @@ void t_cpp_generator::generate_service(t_service* tservice) {
endl;
if (gen_cob_style_) {
f_header_ <<
"#include <transport/TBufferTransports.h>" << endl << // TMemoryBuffer
"#include <thrift/transport/TBufferTransports.h>" << endl << // TMemoryBuffer
"#include <tr1/functional>" << endl <<
"namespace apache { namespace thrift { namespace async {" << endl <<
"class TAsyncChannel;" << endl <<
"}}}" << endl;
}
f_header_ <<
"#include <TDispatchProcessor.h>" << endl;
"#include <thrift/TDispatchProcessor.h>" << endl;
if (gen_cob_style_) {
f_header_ <<
"#include <async/TAsyncDispatchProcessor.h>" << endl;
"#include <thrift/async/TAsyncDispatchProcessor.h>" << endl;
}
f_header_ <<
"#include \"" << get_include_prefix(*get_program()) << program_name_ <<
Expand All @@ -1608,7 +1608,7 @@ void t_cpp_generator::generate_service(t_service* tservice) {
"#include \"" << get_include_prefix(*get_program()) << svcname << ".h\"" << endl;
if (gen_cob_style_) {
f_service_ <<
"#include \"async/TAsyncChannel.h\"" << endl;
"#include \"thrift/async/TAsyncChannel.h\"" << endl;
}
if (gen_templates_) {
f_service_ <<
Expand All @@ -1630,7 +1630,7 @@ void t_cpp_generator::generate_service(t_service* tservice) {

if (gen_cob_style_) {
f_service_tcc_ <<
"#include \"async/TAsyncChannel.h\"" << endl;
"#include \"thrift/async/TAsyncChannel.h\"" << endl;
}
}

Expand Down Expand Up @@ -1974,8 +1974,8 @@ void t_cpp_generator::generate_service_async_skeleton(t_service* tservice) {
"// that would otherwise introduce unwanted latency." << endl <<
endl <<
"#include \"" << get_include_prefix(*get_program()) << svcname << ".h\"" << endl <<
"#include <protocol/TBinaryProtocol.h>" << endl <<
"#include <async/TEventServer.h>" << endl <<
"#include <thrift/protocol/TBinaryProtocol.h>" << endl <<
"#include <thrift/async/TEventServer.h>" << endl <<
endl <<
"using namespace ::apache::thrift;" << endl <<
"using namespace ::apache::thrift::protocol;" << endl <<
Expand Down Expand Up @@ -3703,10 +3703,10 @@ void t_cpp_generator::generate_service_skeleton(t_service* tservice) {
"// You should copy it to another filename to avoid overwriting it." << endl <<
endl <<
"#include \"" << get_include_prefix(*get_program()) << svcname << ".h\"" << endl <<
"#include <protocol/TBinaryProtocol.h>" << endl <<
"#include <server/TSimpleServer.h>" << endl <<
"#include <transport/TServerSocket.h>" << endl <<
"#include <transport/TBufferTransports.h>" << endl <<
"#include <thrift/protocol/TBinaryProtocol.h>" << endl <<
"#include <thrift/server/TSimpleServer.h>" << endl <<
"#include <thrift/transport/TServerSocket.h>" << endl <<
"#include <thrift/transport/TBufferTransports.h>" << endl <<
endl <<
"using namespace ::apache::thrift;" << endl <<
"using namespace ::apache::thrift::protocol;" << endl <<
Expand Down
8 changes: 4 additions & 4 deletions contrib/async-test/test-server.cpp
@@ -1,8 +1,8 @@
#include <tr1/functional>
#include "protocol/TBinaryProtocol.h"
#include "async/TAsyncProtocolProcessor.h"
#include "async/TEvhttpServer.h"
#include "async/TEvhttpClientChannel.h"
#include <thrift/protocol/TBinaryProtocol.h>
#include <thrift/async/TAsyncProtocolProcessor.h>
#include <thrift/async/TEvhttpServer.h>
#include <thrift/async/TEvhttpClientChannel.h>
#include "Aggr.h"

using std::tr1::bind;
Expand Down
2 changes: 1 addition & 1 deletion contrib/fb303/TClientInfo.cpp
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

#include <server/TClientInfo.h>
#include <thrift/server/TClientInfo.h>

namespace apache { namespace thrift { namespace server {

Expand Down

0 comments on commit 49ff8b1

Please sign in to comment.