some 'some make style' suggestions applied to C++ files
diff --git a/compiler/cpp/src/audit/t_audit.h b/compiler/cpp/src/audit/t_audit.h
index fd0013a..be79e31 100644
--- a/compiler/cpp/src/audit/t_audit.h
+++ b/compiler/cpp/src/audit/t_audit.h
@@ -2,10 +2,13 @@
#define T_AUDIT_H
void compare_namespace(t_program* newProgram, t_program* oldProgram);
-void compare_enums(const std::vector<t_enum*>& newEnumList, const std::vector<t_enum*>& oldEnumList);
+void compare_enums(const std::vector<t_enum*>& newEnumList,
+ const std::vector<t_enum*>& oldEnumList);
bool compare_defaults(t_const_value* newStructDefault, t_const_value* oldStructDefault);
-void compare_structs(const std::vector<t_struct*>& newStructList, const std::vector<t_struct*>& oldStructList);
-void compare_services(const std::vector<t_service*>& newServices, const std::vector<t_service*>& oldServices);
+void compare_structs(const std::vector<t_struct*>& newStructList,
+ const std::vector<t_struct*>& oldStructList);
+void compare_services(const std::vector<t_service*>& newServices,
+ const std::vector<t_service*>& oldServices);
void compare_consts(const std::vector<t_const*>& newConst, const std::vector<t_const*>& oldConst);
#endif
diff --git a/compiler/cpp/src/generate/t_cpp_generator.cc b/compiler/cpp/src/generate/t_cpp_generator.cc
index 91c5b29..8770ade 100644
--- a/compiler/cpp/src/generate/t_cpp_generator.cc
+++ b/compiler/cpp/src/generate/t_cpp_generator.cc
@@ -1625,11 +1625,10 @@
f_header_ << endl << ns_open_ << endl << endl;
- f_header_ <<
- "#ifdef _WIN32\n"
- " #pragma warning( push )\n"
- " #pragma warning (disable : 4250 ) //inheriting methods via dominance \n"
- "#endif\n\n";
+ f_header_ << "#ifdef _WIN32\n"
+ " #pragma warning( push )\n"
+ " #pragma warning (disable : 4250 ) //inheriting methods via dominance \n"
+ "#endif\n\n";
// Service implementation file includes
string f_service_name = get_out_dir() + svcname + ".cpp";
@@ -1682,10 +1681,9 @@
generate_service_async_skeleton(tservice);
}
- f_header_ <<
- "#ifdef _WIN32\n"
- " #pragma warning( pop )\n"
- "#endif\n\n";
+ f_header_ << "#ifdef _WIN32\n"
+ " #pragma warning( pop )\n"
+ "#endif\n\n";
// Close the namespace
f_service_ << ns_close_ << endl << endl;
@@ -2151,12 +2149,10 @@
}
// Generate the header portion
- if(style == "Concurrent")
- {
- f_header_ <<
- "// The \'concurrent\' client is a thread safe client that correctly handles\n"
- "// out of order responses. It is slower than the regular client, so should\n"
- "// only be used when you need to share a connection among multiple threads\n";
+ if (style == "Concurrent") {
+ f_header_ << "// The \'concurrent\' client is a thread safe client that correctly handles\n"
+ "// out of order responses. It is slower than the regular client, so should\n"
+ "// only be used when you need to share a connection among multiple threads\n";
}
f_header_ << template_header << "class " << service_name_ << style << "Client" << short_suffix
<< " : "
@@ -2270,36 +2266,34 @@
for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
indent(f_header_) << function_signature(*f_iter, ifstyle) << ";" << endl;
// TODO(dreiss): Use private inheritance to avoid generating thise in cob-style.
- if(style == "Concurrent" && !(*f_iter)->is_oneway()) {
+ if (style == "Concurrent" && !(*f_iter)->is_oneway()) {
// concurrent clients need to move the seqid from the send function to the
// recv function. Oneway methods don't have a recv function, so we don't need to
// move the seqid for them. Attempting to do so would result in a seqid leak.
t_function send_function(g_type_i32, /*returning seqid*/
- string("send_") + (*f_iter)->get_name(),
- (*f_iter)->get_arglist());
+ string("send_") + (*f_iter)->get_name(),
+ (*f_iter)->get_arglist());
indent(f_header_) << function_signature(&send_function, "") << ";" << endl;
- }
- else {
+ } else {
t_function send_function(g_type_void,
- string("send_") + (*f_iter)->get_name(),
- (*f_iter)->get_arglist());
+ string("send_") + (*f_iter)->get_name(),
+ (*f_iter)->get_arglist());
indent(f_header_) << function_signature(&send_function, "") << ";" << endl;
}
if (!(*f_iter)->is_oneway()) {
- if(style == "Concurrent") {
+ if (style == "Concurrent") {
t_field seqIdArg(g_type_i32, "seqid");
t_struct seqIdArgStruct(program_);
seqIdArgStruct.append(&seqIdArg);
t_function recv_function((*f_iter)->get_returntype(),
- string("recv_") + (*f_iter)->get_name(),
- &seqIdArgStruct);
+ string("recv_") + (*f_iter)->get_name(),
+ &seqIdArgStruct);
indent(f_header_) << function_signature(&recv_function, "") << ";" << endl;
- }
- else {
+ } else {
t_struct noargs(program_);
t_function recv_function((*f_iter)->get_returntype(),
- string("recv_") + (*f_iter)->get_name(),
- &noargs);
+ string("recv_") + (*f_iter)->get_name(),
+ &noargs);
indent(f_header_) << function_signature(&recv_function, "") << ";" << endl;
}
}
@@ -2410,7 +2404,7 @@
// if (style != "Cob") // TODO(dreiss): Libify the client and don't generate this for cob-style
if (true) {
- t_type *send_func_return_type = g_type_void;
+ t_type* send_func_return_type = g_type_void;
if (style == "Concurrent" && !(*f_iter)->is_oneway()) {
send_func_return_type = g_type_i32;
}
@@ -2431,7 +2425,7 @@
string resultname = tservice->get_name() + "_" + (*f_iter)->get_name() + "_presult";
string cseqidVal = "0";
- if(style == "Concurrent") {
+ if (style == "Concurrent") {
if (!(*f_iter)->is_oneway()) {
cseqidVal = "this->sync_.generateSeqId()";
}
@@ -2461,13 +2455,10 @@
<< "oprot_->getTransport()->flush();" << endl;
if (style == "Concurrent") {
- out <<
- endl <<
- indent() << "sentry.commit();" << endl;
+ out << endl << indent() << "sentry.commit();" << endl;
- if(!(*f_iter)->is_oneway()) {
- out <<
- indent() << "return cseqid;" << endl;
+ if (!(*f_iter)->is_oneway()) {
+ out << indent() << "return cseqid;" << endl;
}
}
scope_down(out);
@@ -2481,8 +2472,8 @@
t_struct seqIdArgStruct(program_);
seqIdArgStruct.append(&seqIdArg);
- t_struct *recv_function_args = &noargs;
- if(style == "Concurrent") {
+ t_struct* recv_function_args = &noargs;
+ if (style == "Concurrent") {
recv_function_args = &seqIdArgStruct;
}
@@ -2653,7 +2644,7 @@
"TApplicationException::MISSING_RESULT, \"" << (*f_iter)->get_name()
<< " failed: unknown result\");" << endl;
}
- if(style == "Concurrent") {
+ if (style == "Concurrent") {
indent_down();
indent_down();
out <<
diff --git a/compiler/cpp/src/main.cc b/compiler/cpp/src/main.cc
index 6e5258b..0674594 100644
--- a/compiler/cpp/src/main.cc
+++ b/compiler/cpp/src/main.cc
@@ -642,20 +642,20 @@
}
}
-
static bool g_byte_warning_emitted = false;
/**
* Emits a one-time warning on byte type, promoting the new i8 type instead
*/
void emit_byte_type_warning() {
- if( ! g_byte_warning_emitted) {
- pwarning(1, "The \"byte\" type is a compatibility alias for \"i8\". Use \"i8\" to emphasize the signedness of this type.\n");
- g_byte_warning_emitted = true;
- }
+ if (!g_byte_warning_emitted) {
+ pwarning(1,
+ "The \"byte\" type is a compatibility alias for \"i8\". Use \"i8\" to emphasize the "
+ "signedness of this type.\n");
+ g_byte_warning_emitted = true;
+ }
}
-
/**
* Prints the version number
*/
@@ -1025,17 +1025,19 @@
}
}
-void audit(t_program* new_program, t_program* old_program, string new_thrift_include_path, string old_thrift_include_path)
-{
+void audit(t_program* new_program,
+ t_program* old_program,
+ string new_thrift_include_path,
+ string old_thrift_include_path) {
vector<string> temp_incl_searchpath = g_incl_searchpath;
- if(!old_thrift_include_path.empty()) {
+ if (!old_thrift_include_path.empty()) {
g_incl_searchpath.push_back(old_thrift_include_path);
}
parse(old_program, NULL);
g_incl_searchpath = temp_incl_searchpath;
- if(!new_thrift_include_path.empty()) {
+ if (!new_thrift_include_path.empty()) {
g_incl_searchpath.push_back(new_thrift_include_path);
}
@@ -1154,7 +1156,7 @@
failure("Could not open input file with realpath: %s", arg);
}
old_input_file = string(old_thrift_file_rp);
- } else if(strcmp(arg, "-audit-nofatal") == 0){
+ } else if (strcmp(arg, "-audit-nofatal") == 0) {
g_audit_fatal = false;
} else if (strcmp(arg, "-Iold") == 0) {
arg = argv[++i];
@@ -1165,9 +1167,9 @@
old_thrift_include_path = string(arg);
} else if (strcmp(arg, "-Inew") == 0) {
arg = argv[++i];
- if(arg == NULL) {
- fprintf(stderr, "Missing Include directory for new thrift file\n");
- usage();
+ if (arg == NULL) {
+ fprintf(stderr, "Missing Include directory for new thrift file\n");
+ usage();
}
new_thrift_include_path = string(arg);
} else {
@@ -1205,8 +1207,7 @@
g_type_i64 = new t_base_type("i64", t_base_type::TYPE_I64);
g_type_double = new t_base_type("double", t_base_type::TYPE_DOUBLE);
- if(g_audit)
- {
+ if (g_audit) {
// Audit operation
if (old_input_file.empty()) {
@@ -1231,7 +1232,7 @@
} else {
// Generate options
-
+
// You gotta generate something!
if (generator_strings.empty()) {
fprintf(stderr, "No output language(s) specified\n");
diff --git a/compiler/cpp/src/main.h b/compiler/cpp/src/main.h
index 4933432..8751dd5 100644
--- a/compiler/cpp/src/main.h
+++ b/compiler/cpp/src/main.h
@@ -100,7 +100,7 @@
* Emits a one-time warning on byte type, promoting the new i8 type instead
*/
void emit_byte_type_warning();
-
+
/**
* Flex utilities
*/