THRIFT-1907 Compiling namespace and sub-namespace directives for unrecognized generators should only be a warning Patch: Andrew Cox
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/8ad13a38 Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/8ad13a38 Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/8ad13a38 Branch: refs/heads/master Commit: 8ad13a38e895bffdcb78f65e53e7d1f7f999b13e Parents: f837f30 Author: Henrique Mendonça <[email protected]> Authored: Thu May 16 21:26:20 2013 +0200 Committer: Henrique Mendonça <[email protected]> Committed: Thu May 16 21:26:20 2013 +0200 ---------------------------------------------------------------------- compiler/cpp/src/parse/t_program.h | 3 ++- test/ThriftTest.thrift | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/thrift/blob/8ad13a38/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 12fcf0e..dfd9d43 100644 --- a/compiler/cpp/src/parse/t_program.h +++ b/compiler/cpp/src/parse/t_program.h @@ -188,7 +188,8 @@ class t_program : public t_doc { if (sub_index != std::string::npos) { std::string sub_namespace = language.substr(sub_index+1); if ( ! it->second->is_valid_namespace(sub_namespace)) { - throw base_language + " generator does not accept '" + sub_namespace + "' as sub-namespace!"; + std::string warning = base_language + " generator does not accept '" + sub_namespace + "' as sub-namespace!"; + pwarning(1, warning.c_str()); } } } http://git-wip-us.apache.org/repos/asf/thrift/blob/8ad13a38/test/ThriftTest.thrift ---------------------------------------------------------------------- diff --git a/test/ThriftTest.thrift b/test/ThriftTest.thrift index 2be53fa..be000b6 100644 --- a/test/ThriftTest.thrift +++ b/test/ThriftTest.thrift @@ -35,6 +35,12 @@ namespace go ThriftTest namespace php ThriftTest namespace delphi Thrift.Test namespace cocoa ThriftTest + +// Presence of namespaces and sub-namespaces for which there is +// no generator should compile with warnings only +namespace noexist ThriftTest +namespace cpp.noexist ThriftTest + namespace * thrift.test /** @@ -368,4 +374,4 @@ struct StructA { struct StructB { 1: optional StructA aa; 2: required StructA ab; -} \ No newline at end of file +}
