THRIFT-877. compiler: smalltalk namespace doesn't work
This patch adds a special case to map 'smalltalk' to 'st' when checking for valid namespace declarations.
Patch: Bruce Lowekamp
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@990866 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/generate/t_st_generator.cc b/compiler/cpp/src/generate/t_st_generator.cc
index 42c8f93..11d2394 100644
--- a/compiler/cpp/src/generate/t_st_generator.cc
+++ b/compiler/cpp/src/generate/t_st_generator.cc
@@ -121,6 +121,7 @@
void st_accessors(std::ofstream &out, std::string cls, std::string name, std::string type);
std::string class_name();
+ static bool is_valid_namespace(const std::string& sub_namespace);
std::string client_class_name();
std::string prefix(std::string name);
std::string declare_field(t_field* tfield);
@@ -181,7 +182,7 @@
return capitalize(program_name_);
}
-static bool is_valid_namespace(const std::string& sub_namespace) {
+bool t_st_generator::is_valid_namespace(const std::string& sub_namespace) {
return sub_namespace == "prefix" || sub_namespace == "category";
}
diff --git a/compiler/cpp/src/parse/t_program.h b/compiler/cpp/src/parse/t_program.h
index ddf7cd1..4f8f151 100644
--- a/compiler/cpp/src/parse/t_program.h
+++ b/compiler/cpp/src/parse/t_program.h
@@ -164,6 +164,11 @@
std::string base_language = language.substr(0, sub_index);
std::string sub_namespace;
+ if(base_language == "smalltalk") {
+ pwarning(1, "Namespace 'smalltalk' is deprecated. Use 'st' instead");
+ base_language = "st";
+ }
+
t_generator_registry::gen_map_t my_copy = t_generator_registry::get_generator_map();
t_generator_registry::gen_map_t::iterator it;