Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

THRIFT-5766: Replace std::endl with "\n" #2943

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
204 changes: 102 additions & 102 deletions compiler/cpp/src/thrift/generate/go_validator_generator.cc

Large diffs are not rendered by default.

1,936 changes: 967 additions & 969 deletions compiler/cpp/src/thrift/generate/t_c_glib_generator.cc

Large diffs are not rendered by default.

56 changes: 28 additions & 28 deletions compiler/cpp/src/thrift/generate/t_cl_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ void t_cl_generator::init_generator() {
string f_vars_name = program_dir + "/" + program_name_ + "-vars.lisp";

f_types_.open(f_types_name);
f_types_ << cl_autogen_comment() << endl;
f_types_ << cl_autogen_comment() << '\n';
f_vars_.open(f_vars_name);
f_vars_ << cl_autogen_comment() << endl;
f_vars_ << cl_autogen_comment() << '\n';

package_def(f_types_);
package_in(f_types_);
Expand All @@ -141,7 +141,7 @@ void t_cl_generator::init_generator() {
if (!no_asd) {
string f_asd_name = program_dir + "/" + system_prefix + program_name_ + ".asd";
f_asd_.open(f_asd_name);
f_asd_ << cl_autogen_comment() << endl;
f_asd_ << cl_autogen_comment() << '\n';
asdf_def(f_asd_);
}
}
Expand Down Expand Up @@ -197,13 +197,13 @@ string t_cl_generator::generated_package() {
}

void t_cl_generator::asdf_def(std::ostream &out) {
out << "(asdf:defsystem #:" << system_prefix << program_name_ << endl;
out << "(asdf:defsystem #:" << system_prefix << program_name_ << '\n';
indent_up();
out << indent() << render_includes()
<< indent() << ":serial t" << endl
<< indent() << ":serial t" << '\n'
<< indent() << ":components ("
<< "(:file \"" << program_name_ << "-types\") "
<< "(:file \"" << program_name_ << "-vars\")))" << endl;
<< "(:file \"" << program_name_ << "-vars\")))" << '\n';
indent_down();
}

Expand All @@ -221,11 +221,11 @@ void t_cl_generator::package_def(std::ostream &out) {
}
out << ")";
}
out << ")" << endl << endl;
out << ")" << '\n' << '\n';
}

void t_cl_generator::package_in(std::ostream &out) {
out << "(cl:in-package :" << package() << ")" << endl << endl;
out << "(cl:in-package :" << package() << ")" << '\n' << '\n';
}

/**
Expand All @@ -238,7 +238,7 @@ void t_cl_generator::generate_typedef(t_typedef* ttypedef) {
}

void t_cl_generator::generate_enum(t_enum* tenum) {
f_types_ << "(thrift:def-enum " << prefix(tenum->get_name()) << endl;
f_types_ << "(thrift:def-enum " << prefix(tenum->get_name()) << '\n';

vector<t_enum_value*> constants = tenum->get_constants();
vector<t_enum_value*>::iterator c_iter;
Expand All @@ -249,12 +249,12 @@ void t_cl_generator::generate_enum(t_enum* tenum) {
for (c_iter = constants.begin(); c_iter != constants.end(); ++c_iter) {
value = (*c_iter)->get_value();

if(c_iter != constants.begin()) f_types_ << endl << indent() << " ";
if(c_iter != constants.begin()) f_types_ << '\n' << indent() << " ";

f_types_ << "(\"" << (*c_iter)->get_name() << "\" . " << value << ")";
}
indent_down();
f_types_ << "))" << endl << endl;
f_types_ << "))" << '\n' << '\n';
}

/**
Expand All @@ -266,7 +266,7 @@ void t_cl_generator::generate_const(t_const* tconst) {
t_const_value* value = tconst->get_value();

f_vars_ << "(thrift:def-constant " << prefix(name) << " " << render_const_value(type, value) << ")"
<< endl << endl;
<< '\n' << '\n';
}

/**
Expand Down Expand Up @@ -306,7 +306,7 @@ string t_cl_generator::render_const_value(t_type* type, t_const_value* value) {
indent(out) << value->get_integer();
} else if (type->is_struct() || type->is_xception()) {
out << (type->is_struct() ? "(make-instance '" : "(make-exception '") <<
lowercase(type->get_name()) << " " << endl;
lowercase(type->get_name()) << " " << '\n';
indent_up();

const vector<t_field*>& fields = ((t_struct*)type)->get_members();
Expand All @@ -326,7 +326,7 @@ string t_cl_generator::render_const_value(t_type* type, t_const_value* value) {
}

out << indent() << ":" << v_iter->first->get_string() << " " <<
render_const_value(field_type, v_iter->second) << endl;
render_const_value(field_type, v_iter->second) << '\n';
}
out << indent() << ")";

Expand All @@ -340,7 +340,7 @@ string t_cl_generator::render_const_value(t_type* type, t_const_value* value) {
const map<t_const_value*, t_const_value*, t_const_value::value_compare>& val = value->get_map();
map<t_const_value*, t_const_value*, t_const_value::value_compare>::const_iterator v_iter;
for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) {
out << endl << indent()
out << '\n' << indent()
<< "(cl:cons " << render_const_value(ktype, v_iter->first) << " "
<< render_const_value(vtype, v_iter->second) << ")";
}
Expand All @@ -354,16 +354,16 @@ string t_cl_generator::render_const_value(t_type* type, t_const_value* value) {
etype = ((t_set*)type)->get_elem_type();
}
if (type->is_set()) {
out << "(thrift:set" << endl;
out << "(thrift:set" << '\n';
} else {
out << "(thrift:list" << endl;
out << "(thrift:list" << '\n';
}
indent_up();
indent_up();
const vector<t_const_value*>& val = value->get_list();
vector<t_const_value*>::const_iterator v_iter;
for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) {
out << indent() << render_const_value(etype, *v_iter) << endl;
out << indent() << render_const_value(etype, *v_iter) << '\n';
}
out << indent() << ")";
indent_down();
Expand Down Expand Up @@ -394,7 +394,7 @@ void t_cl_generator::generate_cl_struct_internal(std::ostream& out, t_struct* ts
t_type* type = (*m_iter)->get_type();

if (m_iter != members.begin()) {
out << endl << indent() << " ";
out << '\n' << indent() << " ";
}
out << "(" << prefix((*m_iter)->get_name()) << " " <<
( (nullptr != value) ? render_const_value(type, value) : "nil" ) <<
Expand All @@ -421,16 +421,16 @@ void t_cl_generator::generate_cl_struct_internal(std::ostream& out, t_struct* ts
void t_cl_generator::generate_cl_struct(std::ostream& out, t_struct* tstruct, bool is_exception = false) {
std::string name = type_name(tstruct);
out << (is_exception ? "(thrift:def-exception " : "(thrift:def-struct ") <<
prefix(name) << endl;
prefix(name) << '\n';
indent_up();
if ( tstruct->has_doc() ) {
out << indent() ;
out << "\"" << cl_docstring(tstruct->get_doc()) << "\"" << endl;
out << "\"" << cl_docstring(tstruct->get_doc()) << "\"" << '\n';
}
out << indent() ;
generate_cl_struct_internal(out, tstruct, is_exception);
indent_down();
out << ")" << endl << endl;
out << ")" << '\n' << '\n';
}

void t_cl_generator::generate_exception_sig(std::ostream& out, t_function* f) {
Expand All @@ -454,7 +454,7 @@ void t_cl_generator::generate_service(t_service* tservice) {
indent_up();

if ( tservice->has_doc()) {
f_types_ << endl << indent()
f_types_ << '\n' << indent()
<< "(:documentation \"" << cl_docstring(tservice->get_doc()) << "\")";
}

Expand All @@ -465,23 +465,23 @@ void t_cl_generator::generate_service(t_service* tservice) {
t_struct* exceptions = function->get_xceptions();
const vector<t_field*>& xmembers = exceptions->get_members();

f_types_ << endl << indent() << "(:method " << prefix(fname);
f_types_ << '\n' << indent() << "(:method " << prefix(fname);
f_types_ << " (" << signature << " " << typespec((*f_iter)->get_returntype()) << ")";
if (xmembers.size() > 0) {
f_types_ << endl << indent() << " :exceptions " ;
f_types_ << '\n' << indent() << " :exceptions " ;
generate_exception_sig(f_types_, function);
}
if ( (*f_iter)->is_oneway() ) {
f_types_ << endl << indent() << " :oneway t";
f_types_ << '\n' << indent() << " :oneway t";
}
if ( (*f_iter)->has_doc() ) {
f_types_ << endl << indent() << " :documentation \""
f_types_ << '\n' << indent() << " :documentation \""
<< cl_docstring((*f_iter)->get_doc()) << "\"";
}
f_types_ << ")";
}

f_types_ << ")" << endl << endl;
f_types_ << ")" << '\n' << '\n';

indent_down();
}
Expand Down