From ff4ac27f9a3b4b5df4666c222d79266af0712828 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@41a61cd8-c433-0410-bb1c-e256eeef9e11> Date: Tue, 20 Nov 2007 02:08:14 +0000 Subject: [PATCH] r1329@opsdev009 (orig r70778): mcslee | 2007-11-19 18:05:29 -0800 Do not generate constants php files from Thrift when they will be empty Summary: That's just silly Reviewed By: peter, dreiss Test Plan: Generate PHP from a .thrift with no constants. Notice there is no _constants.php generated. git-svn-id: http://svn.facebook.com/svnroot/thrift/trunk@683 41a61cd8-c433-0410-bb1c-e256eeef9e11 --- compiler/cpp/src/generate/t_php_generator.cc | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/compiler/cpp/src/generate/t_php_generator.cc b/compiler/cpp/src/generate/t_php_generator.cc index 8a3bdb7..9cf98ae 100644 --- a/compiler/cpp/src/generate/t_php_generator.cc +++ b/compiler/cpp/src/generate/t_php_generator.cc @@ -23,8 +23,6 @@ void t_php_generator::init_generator() { // Make output file string f_types_name = get_out_dir()+program_name_+"_types.php"; f_types_.open(f_types_name.c_str()); - string f_consts_name = get_out_dir()+program_name_+"_constants.php"; - f_consts_.open(f_consts_name.c_str()); // Print header f_types_ << @@ -42,13 +40,17 @@ void t_php_generator::init_generator() { f_types_ << endl; // Print header - f_consts_ << - "get_consts().empty()) { + string f_consts_name = get_out_dir()+program_name_+"_constants.php"; + f_consts_.open(f_consts_name.c_str()); + f_consts_ << + "" << endl; f_types_.close(); - f_consts_ << "?>" << endl; - f_consts_.close(); + if (!program_->get_consts().empty()) { + f_consts_ << "?>" << endl; + f_consts_.close(); + } } /** -- 2.11.4.GIT