You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by jf...@apache.org on 2011/12/06 01:59:31 UTC

svn commit: r1210728 - in /thrift/trunk: compiler/cpp/src/generate/t_delphi_generator.cc lib/delphi/test/TestClient.pas

Author: jfarrell
Date: Tue Dec  6 00:59:30 2011
New Revision: 1210728

URL: http://svn.apache.org/viewvc?rev=1210728&view=rev
Log:
Thrift-1446:Compile error with Delphi 2009 in constant initializer
Client: delphi
Patch: Kenjiro Fukumitsu 

Generated code cannot be compiled with Delphi 2009 due to the bug in constant initializer.


Modified:
    thrift/trunk/compiler/cpp/src/generate/t_delphi_generator.cc
    thrift/trunk/lib/delphi/test/TestClient.pas

Modified: thrift/trunk/compiler/cpp/src/generate/t_delphi_generator.cc
URL: http://svn.apache.org/viewvc/thrift/trunk/compiler/cpp/src/generate/t_delphi_generator.cc?rev=1210728&r1=1210727&r2=1210728&view=diff
==============================================================================
--- thrift/trunk/compiler/cpp/src/generate/t_delphi_generator.cc (original)
+++ thrift/trunk/compiler/cpp/src/generate/t_delphi_generator.cc Tue Dec  6 00:59:30 2011
@@ -91,7 +91,7 @@ class t_delphi_generator : public t_oop_
     void print_const_prop(std::ostream& out, string name, t_type* type, t_const_value* value);
     void print_private_field(std::ostream& out, string name, t_type* type, t_const_value* value);
     void print_const_value ( std::ostream& vars, std::ostream& out, std::string name, t_type* type, t_const_value* value);
-    void initialize_field(std::ostream& vars, std::ostream& out, std::string name, t_type* type, t_const_value* value, std::string cls_nm = "");
+    void initialize_field(std::ostream& vars, std::ostream& out, std::string name, t_type* type, t_const_value* value);
     void finalize_field(std::ostream& out, std::string name, t_type* type, t_const_value* value, std::string cls_nm = "");
     std::string render_const_value( std::ostream& local_vars, std::ostream& out, std::string name, t_type* type, t_const_value* value);
     void print_const_def_value( std::ostream& vars, std::ostream& out, std::string name, t_type* type, t_const_value* value, std::string cls_nm = "");
@@ -609,8 +609,8 @@ void t_delphi_generator::generate_consts
 
   indent_up_impl();
   for (c_iter = consts.begin(); c_iter != consts.end(); ++c_iter) {
-    initialize_field( vars, code, "F" + prop_name( (*c_iter)->get_name()),
-      (*c_iter)->get_type(), (*c_iter)->get_value(), "TConstants" );
+    initialize_field( vars, code, "TConstants.F" + prop_name( (*c_iter)->get_name()),
+      (*c_iter)->get_type(), (*c_iter)->get_value());
   }
   indent_down_impl();
 
@@ -723,8 +723,7 @@ void t_delphi_generator::print_const_val
 
 }
 
-void t_delphi_generator::initialize_field(std::ostream& vars, std::ostream& out, string name, t_type* type, t_const_value* value, string cls_nm) {
-  (void) cls_nm;
+void t_delphi_generator::initialize_field(std::ostream& vars, std::ostream& out, string name, t_type* type, t_const_value* value) {
   print_const_value( vars, out, name, type, value );
 }
 

Modified: thrift/trunk/lib/delphi/test/TestClient.pas
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/delphi/test/TestClient.pas?rev=1210728&r1=1210727&r2=1210728&view=diff
==============================================================================
--- thrift/trunk/lib/delphi/test/TestClient.pas (original)
+++ thrift/trunk/lib/delphi/test/TestClient.pas Tue Dec  6 00:59:30 2011
@@ -85,12 +85,14 @@ function BoolToString( b : Boolean) : st
 begin
   if b
   then result := 'true'
-  else result := 'false';
-end;
-
-
-{ TTestClient }
-
+  else result := 'false';
+end;
+
+// not available in all versions, so make sure we have this one imported
+function IsDebuggerPresent: BOOL; stdcall; external KERNEL32 name 'IsDebuggerPresent';
+
+{ TTestClient }
+
 class procedure TTestClient.Execute(const args: array of string);
 var
   i : Integer;