Merge pull request #81 from ctiller/update

Merge master into branch
pull/87/head
Yang Gao 10 years ago
commit 0aa22c3ce1
  1. 3
      .gitignore
  2. 3142
      Makefile
  3. 8
      build.json
  4. 22
      include/grpc/grpc.h
  5. 2
      include/grpc/support/slice.h
  6. 33
      src/compiler/cpp_generator.cc
  7. 10
      src/compiler/cpp_generator.h
  8. 25
      src/compiler/cpp_generator_helpers.h
  9. 12
      src/compiler/cpp_plugin.cc
  10. 31
      src/compiler/ruby_generator.cc
  11. 4
      src/compiler/ruby_generator.h
  12. 4
      src/compiler/ruby_generator_helpers-inl.h
  13. 9
      src/compiler/ruby_generator_map-inl.h
  14. 39
      src/compiler/ruby_generator_string-inl.h
  15. 9
      src/compiler/ruby_plugin.cc
  16. 4
      src/core/iomgr/alarm.c
  17. 6
      src/core/iomgr/alarm_internal.h
  18. 10
      src/core/iomgr/iomgr.c
  19. 4
      src/core/iomgr/iomgr.h
  20. 8
      src/core/iomgr/iomgr_internal.h
  21. 4
      src/core/iomgr/iomgr_posix.c
  22. 4
      src/core/iomgr/iomgr_posix.h
  23. 6
      src/core/iomgr/pollset_posix.c
  24. 2
      src/core/iomgr/pollset_posix.h
  25. 4
      src/core/iomgr/socket_utils_common_posix.c
  26. 2
      src/core/iomgr/socket_utils_posix.h
  27. 2
      src/core/iomgr/tcp_server.h
  28. 6
      src/core/iomgr/tcp_server_posix.c
  29. 4
      src/core/security/credentials.c
  30. 4
      src/core/statistics/census_init.c
  31. 6
      src/core/statistics/census_interface.h
  32. 10
      src/core/statistics/census_log.c
  33. 8
      src/core/statistics/census_log.h
  34. 10
      src/core/statistics/census_rpc_stats.c
  35. 6
      src/core/statistics/census_rpc_stats.h
  36. 16
      src/core/statistics/census_tracing.c
  37. 8
      src/core/statistics/census_tracing.h
  38. 4
      src/core/support/cpu.h
  39. 4
      src/core/support/cpu_linux.c
  40. 4
      src/core/support/cpu_posix.c
  41. 2
      src/core/support/log_linux.c
  42. 2
      src/core/support/log_posix.c
  43. 2
      src/core/support/slice.c
  44. 2
      src/core/support/string.c
  45. 11
      src/core/surface/call.c
  46. 4
      src/core/surface/completion_queue.c
  47. 4
      src/core/surface/init.c
  48. 2
      src/core/transport/chttp2/alpn.c
  49. 2
      src/core/transport/chttp2/alpn.h
  50. 2
      src/core/transport/chttp2/frame_settings.c
  51. 2
      src/core/transport/chttp2/frame_settings.h
  52. 14
      src/core/transport/chttp2/gen_hpack_tables.c
  53. 2
      src/core/transport/metadata.c
  54. 2
      src/core/transport/metadata.h
  55. 2
      src/ruby/grpc.gemspec
  56. 209
      templates/Makefile.template
  57. 2
      test/core/channel/channel_stack_test.c
  58. 2
      test/core/compression/message_compress_test.c
  59. 6
      test/core/echo/server.c
  60. 3
      test/core/end2end/dualstack_socket_test.c
  61. 5
      test/core/end2end/tests/cancel_after_accept.c
  62. 5
      test/core/end2end/tests/cancel_after_accept_and_writes_closed.c
  63. 2
      test/core/end2end/tests/cancel_after_invoke.c
  64. 2
      test/core/end2end/tests/cancel_before_invoke.c
  65. 2
      test/core/end2end/tests/cancel_in_a_vacuum.c
  66. 3
      test/core/end2end/tests/census_simple_request.c
  67. 6
      test/core/end2end/tests/disappearing_server.c
  68. 5
      test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c
  69. 2
      test/core/end2end/tests/early_server_shutdown_finishes_tags.c
  70. 5
      test/core/end2end/tests/invoke_large_request.c
  71. 13
      test/core/end2end/tests/max_concurrent_streams.c
  72. 2
      test/core/end2end/tests/no_op.c
  73. 5
      test/core/end2end/tests/ping_pong_streaming.c
  74. 2
      test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c
  75. 2
      test/core/end2end/tests/request_response_with_metadata_and_payload.c
  76. 5
      test/core/end2end/tests/request_response_with_payload.c
  77. 2
      test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c
  78. 2
      test/core/end2end/tests/request_with_large_metadata.c
  79. 2
      test/core/end2end/tests/request_with_payload.c
  80. 6
      test/core/end2end/tests/simple_delayed_request.c
  81. 8
      test/core/end2end/tests/simple_request.c
  82. 14
      test/core/end2end/tests/thread_stress.c
  83. 5
      test/core/end2end/tests/writes_done_hangs_with_pending_read.c
  84. 10
      test/core/fling/client.c
  85. 5
      test/core/fling/server.c
  86. 8
      test/core/httpcli/format_request_test.c
  87. 6
      test/core/iomgr/alarm_heap_test.c
  88. 6
      test/core/iomgr/alarm_list_test.c
  89. 2
      test/core/iomgr/alarm_test.c
  90. 4
      test/core/iomgr/fd_posix_test.c
  91. 16
      test/core/iomgr/resolve_address_test.c
  92. 8
      test/core/iomgr/sockaddr_utils_test.c
  93. 8
      test/core/iomgr/tcp_client_posix_test.c
  94. 4
      test/core/iomgr/tcp_posix_test.c
  95. 8
      test/core/iomgr/tcp_server_posix_test.c
  96. 16
      test/core/iomgr/time_averaged_stats_test.c
  97. 2
      test/core/network_benchmarks/low_level_ping_pong.c
  98. 2
      test/core/security/secure_endpoint_test.c
  99. 28
      test/core/statistics/census_log_tests.c
  100. 2
      test/core/statistics/census_stub_test.c
  101. Some files were not shown because too many files have changed in this diff Show More

3
.gitignore vendored

@ -6,3 +6,6 @@ gens
libs libs
objs objs
*.pyc *.pyc
# cache for run_tests.py
.run_tests_cache

3142
Makefile

File diff suppressed because one or more lines are too long

@ -422,8 +422,8 @@
"c++": true, "c++": true,
"secure": false, "secure": false,
"src": [ "src": [
"src/compiler/cpp_plugin.cpp", "src/compiler/cpp_plugin.cc",
"src/compiler/cpp_generator.cpp" "src/compiler/cpp_generator.cc"
], ],
"headers": [ "headers": [
"src/compiler/cpp_generator.h", "src/compiler/cpp_generator.h",
@ -437,8 +437,8 @@
"c++": true, "c++": true,
"secure": false, "secure": false,
"src": [ "src": [
"src/compiler/ruby_plugin.cpp", "src/compiler/ruby_plugin.cc",
"src/compiler/ruby_generator.cpp" "src/compiler/ruby_generator.cc"
], ],
"headers": [ "headers": [
"src/compiler/cpp_generator.h", "src/compiler/cpp_generator.h",

@ -233,12 +233,12 @@ typedef struct grpc_event {
} grpc_event; } grpc_event;
/* Initialize the grpc library */ /* Initialize the grpc library */
void grpc_init(); void grpc_init(void);
/* Shutdown the grpc library */ /* Shutdown the grpc library */
void grpc_shutdown(); void grpc_shutdown(void);
grpc_completion_queue *grpc_completion_queue_create(); grpc_completion_queue *grpc_completion_queue_create(void);
/* Blocks until an event is available, the completion queue is being shutdown, /* Blocks until an event is available, the completion queue is being shutdown,
or deadline is reached. Returns NULL on timeout, otherwise the event that or deadline is reached. Returns NULL on timeout, otherwise the event that
@ -322,22 +322,6 @@ grpc_call_error grpc_call_invoke(grpc_call *call, grpc_completion_queue *cq,
void *metadata_read_tag, void *finished_tag, void *metadata_read_tag, void *finished_tag,
gpr_uint32 flags); gpr_uint32 flags);
/* DEPRECATED: users should use grpc_call_server_accept, and
grpc_call_server_end_initial_metadata instead now.
Accept an incoming RPC, binding a completion queue to it.
To be called after adding metadata to the call, but before sending
messages.
flags is a bit-field combination of the write flags defined above.
REQUIRES: Can be called at most once per call.
Can only be called on the server.
Produces a GRPC_FINISHED event with finished_tag when the call has been
completed (there may be other events for the call pending at this
time) */
grpc_call_error grpc_call_accept(grpc_call *call, grpc_completion_queue *cq,
void *finished_tag, gpr_uint32 flags);
/* Accept an incoming RPC, binding a completion queue to it. /* Accept an incoming RPC, binding a completion queue to it.
To be called before sending or receiving messages. To be called before sending or receiving messages.
REQUIRES: Can be called at most once per call. REQUIRES: Can be called at most once per call.

@ -163,7 +163,7 @@ gpr_slice gpr_slice_split_tail(gpr_slice *s, size_t split);
Requires s intialized, split <= s.length */ Requires s intialized, split <= s.length */
gpr_slice gpr_slice_split_head(gpr_slice *s, size_t split); gpr_slice gpr_slice_split_head(gpr_slice *s, size_t split);
gpr_slice gpr_empty_slice(); gpr_slice gpr_empty_slice(void);
/* Returns <0 if a < b, ==0 if a == b, >0 if a > b */ /* Returns <0 if a < b, ==0 if a == b, >0 if a > b */
int gpr_slice_cmp(gpr_slice a, gpr_slice b); int gpr_slice_cmp(gpr_slice a, gpr_slice b);

@ -31,6 +31,9 @@
* *
*/ */
#include <string>
#include <map>
#include "src/compiler/cpp_generator.h" #include "src/compiler/cpp_generator.h"
#include "src/compiler/cpp_generator_helpers.h" #include "src/compiler/cpp_generator_helpers.h"
@ -92,8 +95,8 @@ bool HasBidiStreaming(const google::protobuf::FileDescriptor* file) {
} }
} // namespace } // namespace
string GetHeaderIncludes(const google::protobuf::FileDescriptor* file) { std::string GetHeaderIncludes(const google::protobuf::FileDescriptor* file) {
string temp = std::string temp =
"#include \"grpc++/impl/internal_stub.h\"\n" "#include \"grpc++/impl/internal_stub.h\"\n"
"#include \"grpc++/status.h\"\n" "#include \"grpc++/status.h\"\n"
"\n" "\n"
@ -121,7 +124,7 @@ string GetHeaderIncludes(const google::protobuf::FileDescriptor* file) {
return temp; return temp;
} }
string GetSourceIncludes() { std::string GetSourceIncludes() {
return "#include \"grpc++/channel_interface.h\"\n" return "#include \"grpc++/channel_interface.h\"\n"
"#include \"grpc++/impl/rpc_method.h\"\n" "#include \"grpc++/impl/rpc_method.h\"\n"
"#include \"grpc++/impl/rpc_service_method.h\"\n" "#include \"grpc++/impl/rpc_service_method.h\"\n"
@ -130,7 +133,7 @@ string GetSourceIncludes() {
void PrintHeaderClientMethod(google::protobuf::io::Printer* printer, void PrintHeaderClientMethod(google::protobuf::io::Printer* printer,
const google::protobuf::MethodDescriptor* method, const google::protobuf::MethodDescriptor* method,
map<string, string>* vars) { std::map<std::string, std::string>* vars) {
(*vars)["Method"] = method->name(); (*vars)["Method"] = method->name();
(*vars)["Request"] = (*vars)["Request"] =
grpc_cpp_generator::ClassName(method->input_type(), true); grpc_cpp_generator::ClassName(method->input_type(), true);
@ -159,7 +162,7 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer* printer,
void PrintHeaderServerMethod(google::protobuf::io::Printer* printer, void PrintHeaderServerMethod(google::protobuf::io::Printer* printer,
const google::protobuf::MethodDescriptor* method, const google::protobuf::MethodDescriptor* method,
map<string, string>* vars) { std::map<std::string, std::string>* vars) {
(*vars)["Method"] = method->name(); (*vars)["Method"] = method->name();
(*vars)["Request"] = (*vars)["Request"] =
grpc_cpp_generator::ClassName(method->input_type(), true); grpc_cpp_generator::ClassName(method->input_type(), true);
@ -193,7 +196,7 @@ void PrintHeaderServerMethod(google::protobuf::io::Printer* printer,
void PrintHeaderService(google::protobuf::io::Printer* printer, void PrintHeaderService(google::protobuf::io::Printer* printer,
const google::protobuf::ServiceDescriptor* service, const google::protobuf::ServiceDescriptor* service,
map<string, string>* vars) { std::map<std::string, std::string>* vars) {
(*vars)["Service"] = service->name(); (*vars)["Service"] = service->name();
printer->Print(*vars, printer->Print(*vars,
@ -238,11 +241,11 @@ void PrintHeaderService(google::protobuf::io::Printer* printer,
printer->Print("};\n"); printer->Print("};\n");
} }
string GetHeaderServices(const google::protobuf::FileDescriptor* file) { std::string GetHeaderServices(const google::protobuf::FileDescriptor* file) {
string output; std::string output;
google::protobuf::io::StringOutputStream output_stream(&output); google::protobuf::io::StringOutputStream output_stream(&output);
google::protobuf::io::Printer printer(&output_stream, '$'); google::protobuf::io::Printer printer(&output_stream, '$');
map<string, string> vars; std::map<std::string, std::string> vars;
for (int i = 0; i < file->service_count(); ++i) { for (int i = 0; i < file->service_count(); ++i) {
PrintHeaderService(&printer, file->service(i), &vars); PrintHeaderService(&printer, file->service(i), &vars);
@ -253,7 +256,7 @@ string GetHeaderServices(const google::protobuf::FileDescriptor* file) {
void PrintSourceClientMethod(google::protobuf::io::Printer* printer, void PrintSourceClientMethod(google::protobuf::io::Printer* printer,
const google::protobuf::MethodDescriptor* method, const google::protobuf::MethodDescriptor* method,
map<string, string>* vars) { std::map<std::string, std::string>* vars) {
(*vars)["Method"] = method->name(); (*vars)["Method"] = method->name();
(*vars)["Request"] = (*vars)["Request"] =
grpc_cpp_generator::ClassName(method->input_type(), true); grpc_cpp_generator::ClassName(method->input_type(), true);
@ -311,7 +314,7 @@ void PrintSourceClientMethod(google::protobuf::io::Printer* printer,
void PrintSourceServerMethod(google::protobuf::io::Printer* printer, void PrintSourceServerMethod(google::protobuf::io::Printer* printer,
const google::protobuf::MethodDescriptor* method, const google::protobuf::MethodDescriptor* method,
map<string, string>* vars) { std::map<std::string, std::string>* vars) {
(*vars)["Method"] = method->name(); (*vars)["Method"] = method->name();
(*vars)["Request"] = (*vars)["Request"] =
grpc_cpp_generator::ClassName(method->input_type(), true); grpc_cpp_generator::ClassName(method->input_type(), true);
@ -361,7 +364,7 @@ void PrintSourceServerMethod(google::protobuf::io::Printer* printer,
void PrintSourceService(google::protobuf::io::Printer* printer, void PrintSourceService(google::protobuf::io::Printer* printer,
const google::protobuf::ServiceDescriptor* service, const google::protobuf::ServiceDescriptor* service,
map<string, string>* vars) { std::map<std::string, std::string>* vars) {
(*vars)["Service"] = service->name(); (*vars)["Service"] = service->name();
printer->Print( printer->Print(
*vars, *vars,
@ -455,11 +458,11 @@ void PrintSourceService(google::protobuf::io::Printer* printer,
printer->Print("}\n\n"); printer->Print("}\n\n");
} }
string GetSourceServices(const google::protobuf::FileDescriptor* file) { std::string GetSourceServices(const google::protobuf::FileDescriptor* file) {
string output; std::string output;
google::protobuf::io::StringOutputStream output_stream(&output); google::protobuf::io::StringOutputStream output_stream(&output);
google::protobuf::io::Printer printer(&output_stream, '$'); google::protobuf::io::Printer printer(&output_stream, '$');
map<string, string> vars; std::map<std::string, std::string> vars;
// Package string is empty or ends with a dot. It is used to fully qualify // Package string is empty or ends with a dot. It is used to fully qualify
// method names. // method names.
vars["Package"] = file->package(); vars["Package"] = file->package();

@ -42,21 +42,19 @@ class FileDescriptor;
} // namespace protobuf } // namespace protobuf
} // namespace google } // namespace google
using namespace std;
namespace grpc_cpp_generator { namespace grpc_cpp_generator {
// Return the includes needed for generated header file. // Return the includes needed for generated header file.
string GetHeaderIncludes(const google::protobuf::FileDescriptor* file); std::string GetHeaderIncludes(const google::protobuf::FileDescriptor* file);
// Return the includes needed for generated source file. // Return the includes needed for generated source file.
string GetSourceIncludes(); std::string GetSourceIncludes();
// Return the services for generated header file. // Return the services for generated header file.
string GetHeaderServices(const google::protobuf::FileDescriptor* file); std::string GetHeaderServices(const google::protobuf::FileDescriptor* file);
// Return the services for generated source file. // Return the services for generated source file.
string GetSourceServices(const google::protobuf::FileDescriptor* file); std::string GetSourceServices(const google::protobuf::FileDescriptor* file);
} // namespace grpc_cpp_generator } // namespace grpc_cpp_generator

@ -39,14 +39,12 @@
#include <google/protobuf/descriptor.h> #include <google/protobuf/descriptor.h>
#include <google/protobuf/descriptor.pb.h> #include <google/protobuf/descriptor.pb.h>
using namespace std;
namespace grpc_cpp_generator { namespace grpc_cpp_generator {
inline bool StripSuffix(string* filename, const string& suffix) { inline bool StripSuffix(std::string* filename, const std::string& suffix) {
if (filename->length() >= suffix.length()) { if (filename->length() >= suffix.length()) {
size_t suffix_pos = filename->length() - suffix.length(); size_t suffix_pos = filename->length() - suffix.length();
if (filename->compare(suffix_pos, string::npos, suffix) == 0) { if (filename->compare(suffix_pos, std::string::npos, suffix) == 0) {
filename->resize(filename->size() - suffix.size()); filename->resize(filename->size() - suffix.size());
return true; return true;
} }
@ -55,19 +53,20 @@ inline bool StripSuffix(string* filename, const string& suffix) {
return false; return false;
} }
inline string StripProto(string filename) { inline std::string StripProto(std::string filename) {
if (!StripSuffix(&filename, ".protodevel")) { if (!StripSuffix(&filename, ".protodevel")) {
StripSuffix(&filename, ".proto"); StripSuffix(&filename, ".proto");
} }
return filename; return filename;
} }
inline string StringReplace(string str, const string& from, const string& to) { inline std::string StringReplace(std::string str, const std::string& from,
const std::string& to) {
size_t pos = 0; size_t pos = 0;
for (;;) { for (;;) {
pos = str.find(from, pos); pos = str.find(from, pos);
if (pos == string::npos) { if (pos == std::string::npos) {
break; break;
} }
str.replace(pos, from.length(), to); str.replace(pos, from.length(), to);
@ -77,23 +76,23 @@ inline string StringReplace(string str, const string& from, const string& to) {
return str; return str;
} }
inline string DotsToColons(const string& name) { inline std::string DotsToColons(const std::string& name) {
return StringReplace(name, ".", "::"); return StringReplace(name, ".", "::");
} }
inline string DotsToUnderscores(const string& name) { inline std::string DotsToUnderscores(const std::string& name) {
return StringReplace(name, ".", "_"); return StringReplace(name, ".", "_");
} }
inline string ClassName(const google::protobuf::Descriptor* descriptor, inline std::string ClassName(const google::protobuf::Descriptor* descriptor,
bool qualified) { bool qualified) {
// Find "outer", the descriptor of the top-level message in which // Find "outer", the descriptor of the top-level message in which
// "descriptor" is embedded. // "descriptor" is embedded.
const google::protobuf::Descriptor* outer = descriptor; const google::protobuf::Descriptor* outer = descriptor;
while (outer->containing_type() != NULL) outer = outer->containing_type(); while (outer->containing_type() != NULL) outer = outer->containing_type();
const string& outer_name = outer->full_name(); const std::string& outer_name = outer->full_name();
string inner_name = descriptor->full_name().substr(outer_name.size()); std::string inner_name = descriptor->full_name().substr(outer_name.size());
if (qualified) { if (qualified) {
return "::" + DotsToColons(outer_name) + DotsToUnderscores(inner_name); return "::" + DotsToColons(outer_name) + DotsToUnderscores(inner_name);

@ -35,6 +35,8 @@
// //
#include <memory> #include <memory>
#include <string>
#include "src/compiler/cpp_generator.h" #include "src/compiler/cpp_generator.h"
#include "src/compiler/cpp_generator_helpers.h" #include "src/compiler/cpp_generator_helpers.h"
#include <google/protobuf/descriptor.h> #include <google/protobuf/descriptor.h>
@ -50,9 +52,9 @@ class CppGrpcGenerator : public google::protobuf::compiler::CodeGenerator {
virtual ~CppGrpcGenerator() {} virtual ~CppGrpcGenerator() {}
virtual bool Generate(const google::protobuf::FileDescriptor* file, virtual bool Generate(const google::protobuf::FileDescriptor* file,
const string& parameter, const std::string& parameter,
google::protobuf::compiler::GeneratorContext* context, google::protobuf::compiler::GeneratorContext* context,
string* error) const { std::string* error) const {
if (file->options().cc_generic_services()) { if (file->options().cc_generic_services()) {
*error = *error =
"cpp grpc proto compiler plugin does not work with generic " "cpp grpc proto compiler plugin does not work with generic "
@ -61,7 +63,7 @@ class CppGrpcGenerator : public google::protobuf::compiler::CodeGenerator {
return false; return false;
} }
string file_name = grpc_cpp_generator::StripProto(file->name()); std::string file_name = grpc_cpp_generator::StripProto(file->name());
// Generate .pb.h // Generate .pb.h
Insert(context, file_name + ".pb.h", "includes", Insert(context, file_name + ".pb.h", "includes",
@ -80,8 +82,8 @@ class CppGrpcGenerator : public google::protobuf::compiler::CodeGenerator {
private: private:
// Insert the given code into the given file at the given insertion point. // Insert the given code into the given file at the given insertion point.
void Insert(google::protobuf::compiler::GeneratorContext* context, void Insert(google::protobuf::compiler::GeneratorContext* context,
const string& filename, const string& insertion_point, const std::string& filename, const std::string& insertion_point,
const string& code) const { const std::string& code) const {
std::unique_ptr<google::protobuf::io::ZeroCopyOutputStream> output( std::unique_ptr<google::protobuf::io::ZeroCopyOutputStream> output(
context->OpenForInsert(filename, insertion_point)); context->OpenForInsert(filename, insertion_point));
google::protobuf::io::CodedOutputStream coded_out(output.get()); google::protobuf::io::CodedOutputStream coded_out(output.get());

@ -32,6 +32,7 @@
*/ */
#include <cctype> #include <cctype>
#include <string>
#include <map> #include <map>
#include <vector> #include <vector>
@ -56,17 +57,17 @@ namespace grpc_ruby_generator {
namespace { namespace {
// Prints out the method using the ruby gRPC DSL. // Prints out the method using the ruby gRPC DSL.
void PrintMethod(const MethodDescriptor* method, const string& package, void PrintMethod(const MethodDescriptor* method, const std::string& package,
Printer* out) { Printer* out) {
string input_type = RubyTypeOf(method->input_type()->name(), package); std::string input_type = RubyTypeOf(method->input_type()->name(), package);
if (method->client_streaming()) { if (method->client_streaming()) {
input_type = "stream(" + input_type + ")"; input_type = "stream(" + input_type + ")";
} }
string output_type = RubyTypeOf(method->output_type()->name(), package); std::string output_type = RubyTypeOf(method->output_type()->name(), package);
if (method->server_streaming()) { if (method->server_streaming()) {
output_type = "stream(" + output_type + ")"; output_type = "stream(" + output_type + ")";
} }
map<string, string> method_vars = ListToDict({ std::map<std::string, std::string> method_vars = ListToDict({
"mth.name", method->name(), "input.type", input_type, "output.type", "mth.name", method->name(), "input.type", input_type, "output.type",
output_type, output_type,
}); });
@ -74,22 +75,22 @@ void PrintMethod(const MethodDescriptor* method, const string& package,
} }
// Prints out the service using the ruby gRPC DSL. // Prints out the service using the ruby gRPC DSL.
void PrintService(const ServiceDescriptor* service, const string& package, void PrintService(const ServiceDescriptor* service, const std::string& package,
Printer* out) { Printer* out) {
if (service->method_count() == 0) { if (service->method_count() == 0) {
return; return;
} }
// Begin the service module // Begin the service module
map<string, string> module_vars = ListToDict({ std::map<std::string, std::string> module_vars = ListToDict({
"module.name", CapitalizeFirst(service->name()), "module.name", CapitalizeFirst(service->name()),
}); });
out->Print(module_vars, "module $module.name$\n"); out->Print(module_vars, "module $module.name$\n");
out->Indent(); out->Indent();
// TODO(temiola): add documentation // TODO(temiola): add documentation
string doc = "TODO: add proto service documentation here"; std::string doc = "TODO: add proto service documentation here";
map<string, string> template_vars = ListToDict({ std::map<std::string, std::string> template_vars = ListToDict({
"Documentation", doc, "Documentation", doc,
}); });
out->Print("\n"); out->Print("\n");
@ -103,7 +104,7 @@ void PrintService(const ServiceDescriptor* service, const string& package,
out->Print("\n"); out->Print("\n");
out->Print("self.marshal_class_method = :encode\n"); out->Print("self.marshal_class_method = :encode\n");
out->Print("self.unmarshal_class_method = :decode\n"); out->Print("self.unmarshal_class_method = :decode\n");
map<string, string> pkg_vars = ListToDict({ std::map<std::string, std::string> pkg_vars = ListToDict({
"service.name", service->name(), "pkg.name", package, "service.name", service->name(), "pkg.name", package,
}); });
out->Print(pkg_vars, "self.service_name = '$pkg.name$.$service.name$'\n"); out->Print(pkg_vars, "self.service_name = '$pkg.name$.$service.name$'\n");
@ -124,8 +125,8 @@ void PrintService(const ServiceDescriptor* service, const string& package,
} // namespace } // namespace
string GetServices(const FileDescriptor* file) { std::string GetServices(const FileDescriptor* file) {
string output; std::string output;
StringOutputStream output_stream(&output); StringOutputStream output_stream(&output);
Printer out(&output_stream, '$'); Printer out(&output_stream, '$');
@ -136,7 +137,7 @@ string GetServices(const FileDescriptor* file) {
} }
// Write out a file header. // Write out a file header.
map<string, string> header_comment_vars = ListToDict({ std::map<std::string, std::string> header_comment_vars = ListToDict({
"file.name", file->name(), "file.package", file->package(), "file.name", file->name(), "file.package", file->package(),
}); });
out.Print("# Generated by the protocol buffer compiler. DO NOT EDIT!\n"); out.Print("# Generated by the protocol buffer compiler. DO NOT EDIT!\n");
@ -148,16 +149,16 @@ string GetServices(const FileDescriptor* file) {
// Write out require statemment to import the separately generated file // Write out require statemment to import the separately generated file
// that defines the messages used by the service. This is generated by the // that defines the messages used by the service. This is generated by the
// main ruby plugin. // main ruby plugin.
map<string, string> dep_vars = ListToDict({ std::map<std::string, std::string> dep_vars = ListToDict({
"dep.name", MessagesRequireName(file), "dep.name", MessagesRequireName(file),
}); });
out.Print(dep_vars, "require '$dep.name$'\n"); out.Print(dep_vars, "require '$dep.name$'\n");
// Write out services within the modules // Write out services within the modules
out.Print("\n"); out.Print("\n");
vector<string> modules = Split(file->package(), '.'); std::vector<std::string> modules = Split(file->package(), '.');
for (size_t i = 0; i < modules.size(); ++i) { for (size_t i = 0; i < modules.size(); ++i) {
map<string, string> module_vars = ListToDict({ std::map<std::string, std::string> module_vars = ListToDict({
"module.name", CapitalizeFirst(modules[i]), "module.name", CapitalizeFirst(modules[i]),
}); });
out.Print(module_vars, "module $module.name$\n"); out.Print(module_vars, "module $module.name$\n");

@ -36,8 +36,6 @@
#include <string> #include <string>
using namespace std;
namespace google { namespace google {
namespace protobuf { namespace protobuf {
class FileDescriptor; class FileDescriptor;
@ -46,7 +44,7 @@ class FileDescriptor;
namespace grpc_ruby_generator { namespace grpc_ruby_generator {
string GetServices(const google::protobuf::FileDescriptor* file); std::string GetServices(const google::protobuf::FileDescriptor* file);
} // namespace grpc_ruby_generator } // namespace grpc_ruby_generator

@ -42,7 +42,7 @@
namespace grpc_ruby_generator { namespace grpc_ruby_generator {
inline bool ServicesFilename(const google::protobuf::FileDescriptor* file, inline bool ServicesFilename(const google::protobuf::FileDescriptor* file,
string* file_name_or_error) { std::string* file_name_or_error) {
// Get output file name. // Get output file name.
static const unsigned proto_suffix_length = 6; // length of ".proto" static const unsigned proto_suffix_length = 6; // length of ".proto"
if (file->name().size() > proto_suffix_length && if (file->name().size() > proto_suffix_length &&
@ -57,7 +57,7 @@ inline bool ServicesFilename(const google::protobuf::FileDescriptor* file,
} }
} }
inline string MessagesRequireName( inline std::string MessagesRequireName(
const google::protobuf::FileDescriptor* file) { const google::protobuf::FileDescriptor* file) {
return Replace(file->name(), ".proto", ""); return Replace(file->name(), ".proto", "");
} }

@ -48,17 +48,18 @@ namespace grpc_ruby_generator {
// Converts an initializer list of the form { key0, value0, key1, value1, ... } // Converts an initializer list of the form { key0, value0, key1, value1, ... }
// into a map of key* to value*. Is merely a readability helper for later code. // into a map of key* to value*. Is merely a readability helper for later code.
inline map<string, string> ListToDict(const initializer_list<string>& values) { inline std::map<std::string, std::string> ListToDict(
const initializer_list<std::string>& values) {
if (values.size() % 2 != 0) { if (values.size() % 2 != 0) {
// MOE: insert std::cerr << "Not every 'key' has a value in `values`." // MOE: insert std::cerr << "Not every 'key' has a value in `values`."
// << std::endl; // << std::endl;
} }
map<string, string> value_map; std::map<std::string, std::string> value_map;
auto value_iter = values.begin(); auto value_iter = values.begin();
for (unsigned i = 0; i < values.size() / 2; ++i) { for (unsigned i = 0; i < values.size() / 2; ++i) {
string key = *value_iter; std::string key = *value_iter;
++value_iter; ++value_iter;
string value = *value_iter; std::string value = *value_iter;
value_map[key] = value; value_map[key] = value;
++value_iter; ++value_iter;
} }

@ -45,10 +45,10 @@ using std::transform;
namespace grpc_ruby_generator { namespace grpc_ruby_generator {
// Split splits a string using char into elems. // Split splits a string using char into elems.
inline vector<string>& Split(const string& s, char delim, inline std::vector<std::string>& Split(const std::string& s, char delim,
vector<string>* elems) { std::vector<std::string>* elems) {
stringstream ss(s); std::stringstream ss(s);
string item; std::string item;
while (getline(ss, item, delim)) { while (getline(ss, item, delim)) {
elems->push_back(item); elems->push_back(item);
} }
@ -56,16 +56,17 @@ inline vector<string>& Split(const string& s, char delim,
} }
// Split splits a string using char, returning the result in a vector. // Split splits a string using char, returning the result in a vector.
inline vector<string> Split(const string& s, char delim) { inline std::vector<std::string> Split(const std::string& s, char delim) {
vector<string> elems; std::vector<std::string> elems;
Split(s, delim, &elems); Split(s, delim, &elems);
return elems; return elems;
} }
// Replace replaces from with to in s. // Replace replaces from with to in s.
inline string Replace(string s, const string& from, const string& to) { inline std::string Replace(std::string s, const std::string& from,
const std::string& to) {
size_t start_pos = s.find(from); size_t start_pos = s.find(from);
if (start_pos == string::npos) { if (start_pos == std::string::npos) {
return s; return s;
} }
s.replace(start_pos, from.length(), to); s.replace(start_pos, from.length(), to);
@ -73,10 +74,10 @@ inline string Replace(string s, const string& from, const string& to) {
} }
// ReplaceAll replaces all instances of search with replace in s. // ReplaceAll replaces all instances of search with replace in s.
inline string ReplaceAll(string s, const string& search, inline std::string ReplaceAll(std::string s, const std::string& search,
const string& replace) { const std::string& replace) {
size_t pos = 0; size_t pos = 0;
while ((pos = s.find(search, pos)) != string::npos) { while ((pos = s.find(search, pos)) != std::string::npos) {
s.replace(pos, search.length(), replace); s.replace(pos, search.length(), replace);
pos += replace.length(); pos += replace.length();
} }
@ -84,9 +85,10 @@ inline string ReplaceAll(string s, const string& search,
} }
// ReplacePrefix replaces from with to in s if search is a prefix of s. // ReplacePrefix replaces from with to in s if search is a prefix of s.
inline bool ReplacePrefix(string* s, const string& from, const string& to) { inline bool ReplacePrefix(std::string* s, const std::string& from,
const std::string& to) {
size_t start_pos = s->find(from); size_t start_pos = s->find(from);
if (start_pos == string::npos || start_pos != 0) { if (start_pos == std::string::npos || start_pos != 0) {
return false; return false;
} }
s->replace(start_pos, from.length(), to); s->replace(start_pos, from.length(), to);
@ -94,7 +96,7 @@ inline bool ReplacePrefix(string* s, const string& from, const string& to) {
} }
// CapitalizeFirst capitalizes the first char in a string. // CapitalizeFirst capitalizes the first char in a string.
inline string CapitalizeFirst(string s) { inline std::string CapitalizeFirst(std::string s) {
if (s.empty()) { if (s.empty()) {
return s; return s;
} }
@ -103,14 +105,15 @@ inline string CapitalizeFirst(string s) {
} }
// RubyTypeOf updates a proto type to the required ruby equivalent. // RubyTypeOf updates a proto type to the required ruby equivalent.
inline string RubyTypeOf(const string& a_type, const string& package) { inline std::string RubyTypeOf(const std::string& a_type,
string res(a_type); const std::string& package) {
std::string res(a_type);
ReplacePrefix(&res, package, ""); // remove the leading package if present ReplacePrefix(&res, package, ""); // remove the leading package if present
ReplacePrefix(&res, ".", ""); // remove the leading . (no package) ReplacePrefix(&res, ".", ""); // remove the leading . (no package)
if (res.find('.') == string::npos) { if (res.find('.') == std::string::npos) {
return res; return res;
} else { } else {
vector<string> prefixes_and_type = Split(res, '.'); std::vector<std::string> prefixes_and_type = Split(res, '.');
for (unsigned int i = 0; i < prefixes_and_type.size(); ++i) { for (unsigned int i = 0; i < prefixes_and_type.size(); ++i) {
if (i != 0) { if (i != 0) {
res += "::"; // switch '.' to the ruby module delim res += "::"; // switch '.' to the ruby module delim

@ -37,6 +37,7 @@
// and net/proto2/compiler/public/plugin.h for more information on plugins. // and net/proto2/compiler/public/plugin.h for more information on plugins.
#include <memory> #include <memory>
#include <string>
#include "src/compiler/ruby_generator.h" #include "src/compiler/ruby_generator.h"
#include "src/compiler/ruby_generator_helpers-inl.h" #include "src/compiler/ruby_generator_helpers-inl.h"
@ -52,16 +53,16 @@ class RubyGrpcGenerator : public google::protobuf::compiler::CodeGenerator {
~RubyGrpcGenerator() override {} ~RubyGrpcGenerator() override {}
bool Generate(const google::protobuf::FileDescriptor* file, bool Generate(const google::protobuf::FileDescriptor* file,
const string& parameter, const std::string& parameter,
google::protobuf::compiler::GeneratorContext* context, google::protobuf::compiler::GeneratorContext* context,
string* error) const override { std::string* error) const override {
string code = grpc_ruby_generator::GetServices(file); std::string code = grpc_ruby_generator::GetServices(file);
if (code.size() == 0) { if (code.size() == 0) {
return true; // don't generate a file if there are no services return true; // don't generate a file if there are no services
} }
// Get output file name. // Get output file name.
string file_name; std::string file_name;
if (!grpc_ruby_generator::ServicesFilename(file, &file_name)) { if (!grpc_ruby_generator::ServicesFilename(file, &file_name)) {
return false; return false;
} }

@ -100,7 +100,7 @@ void grpc_alarm_list_init(gpr_timespec now) {
} }
} }
void grpc_alarm_list_shutdown() { void grpc_alarm_list_shutdown(void) {
int i; int i;
while (run_some_expired_alarms(NULL, gpr_inf_future, NULL, 0)) while (run_some_expired_alarms(NULL, gpr_inf_future, NULL, 0))
; ;
@ -360,7 +360,7 @@ int grpc_alarm_check(gpr_mu *drop_mu, gpr_timespec now, gpr_timespec *next) {
return run_some_expired_alarms(drop_mu, now, next, 1); return run_some_expired_alarms(drop_mu, now, next, 1);
} }
gpr_timespec grpc_alarm_list_next_timeout() { gpr_timespec grpc_alarm_list_next_timeout(void) {
gpr_timespec out; gpr_timespec out;
gpr_mu_lock(&g_mu); gpr_mu_lock(&g_mu);
out = g_shard_queue[0]->min_deadline; out = g_shard_queue[0]->min_deadline;

@ -42,12 +42,12 @@
int grpc_alarm_check(gpr_mu *drop_mu, gpr_timespec now, gpr_timespec *next); int grpc_alarm_check(gpr_mu *drop_mu, gpr_timespec now, gpr_timespec *next);
void grpc_alarm_list_init(gpr_timespec now); void grpc_alarm_list_init(gpr_timespec now);
void grpc_alarm_list_shutdown(); void grpc_alarm_list_shutdown(void);
gpr_timespec grpc_alarm_list_next_timeout(); gpr_timespec grpc_alarm_list_next_timeout(void);
/* the following must be implemented by each iomgr implementation */ /* the following must be implemented by each iomgr implementation */
void grpc_kick_poller(); void grpc_kick_poller(void);
#endif /* __GRPC_INTERNAL_IOMGR_ALARM_INTERNAL_H_ */ #endif /* __GRPC_INTERNAL_IOMGR_ALARM_INTERNAL_H_ */

@ -80,9 +80,9 @@ static void background_callback_executor(void *ignored) {
gpr_event_set(&g_background_callback_executor_done, (void *)1); gpr_event_set(&g_background_callback_executor_done, (void *)1);
} }
void grpc_kick_poller() { gpr_cv_broadcast(&g_cv); } void grpc_kick_poller(void) { gpr_cv_broadcast(&g_cv); }
void grpc_iomgr_init() { void grpc_iomgr_init(void) {
gpr_thd_id id; gpr_thd_id id;
gpr_mu_init(&g_mu); gpr_mu_init(&g_mu);
gpr_cv_init(&g_cv); gpr_cv_init(&g_cv);
@ -93,7 +93,7 @@ void grpc_iomgr_init() {
gpr_thd_new(&id, background_callback_executor, NULL, NULL); gpr_thd_new(&id, background_callback_executor, NULL, NULL);
} }
void grpc_iomgr_shutdown() { void grpc_iomgr_shutdown(void) {
delayed_callback *cb; delayed_callback *cb;
gpr_timespec shutdown_deadline = gpr_timespec shutdown_deadline =
gpr_time_add(gpr_now(), gpr_time_from_seconds(10)); gpr_time_add(gpr_now(), gpr_time_from_seconds(10));
@ -134,13 +134,13 @@ void grpc_iomgr_shutdown() {
gpr_cv_destroy(&g_cv); gpr_cv_destroy(&g_cv);
} }
void grpc_iomgr_ref() { void grpc_iomgr_ref(void) {
gpr_mu_lock(&g_mu); gpr_mu_lock(&g_mu);
++g_refs; ++g_refs;
gpr_mu_unlock(&g_mu); gpr_mu_unlock(&g_mu);
} }
void grpc_iomgr_unref() { void grpc_iomgr_unref(void) {
gpr_mu_lock(&g_mu); gpr_mu_lock(&g_mu);
if (0 == --g_refs) { if (0 == --g_refs) {
gpr_cv_signal(&g_cv); gpr_cv_signal(&g_cv);

@ -37,8 +37,8 @@
/* gRPC Callback definition */ /* gRPC Callback definition */
typedef void (*grpc_iomgr_cb_func)(void *arg, int success); typedef void (*grpc_iomgr_cb_func)(void *arg, int success);
void grpc_iomgr_init(); void grpc_iomgr_init(void);
void grpc_iomgr_shutdown(); void grpc_iomgr_shutdown(void);
/* This function is called from within a callback or from anywhere else /* This function is called from within a callback or from anywhere else
and causes the invocation of a callback at some point in the future */ and causes the invocation of a callback at some point in the future */

@ -42,10 +42,10 @@ int grpc_maybe_call_delayed_callbacks(gpr_mu *drop_mu, int success);
void grpc_iomgr_add_delayed_callback(grpc_iomgr_cb_func cb, void *cb_arg, void grpc_iomgr_add_delayed_callback(grpc_iomgr_cb_func cb, void *cb_arg,
int success); int success);
void grpc_iomgr_ref(); void grpc_iomgr_ref(void);
void grpc_iomgr_unref(); void grpc_iomgr_unref(void);
void grpc_iomgr_platform_init(); void grpc_iomgr_platform_init(void);
void grpc_iomgr_platform_shutdown(); void grpc_iomgr_platform_shutdown(void);
#endif /* __GRPC_INTERNAL_IOMGR_IOMGR_INTERNAL_H_ */ #endif /* __GRPC_INTERNAL_IOMGR_IOMGR_INTERNAL_H_ */

@ -33,6 +33,6 @@
#include "src/core/iomgr/iomgr_posix.h" #include "src/core/iomgr/iomgr_posix.h"
void grpc_iomgr_platform_init() { grpc_pollset_global_init(); } void grpc_iomgr_platform_init(void) { grpc_pollset_global_init(); }
void grpc_iomgr_platform_shutdown() { grpc_pollset_global_shutdown(); } void grpc_iomgr_platform_shutdown(void) { grpc_pollset_global_shutdown(); }

@ -36,7 +36,7 @@
#include "src/core/iomgr/iomgr_internal.h" #include "src/core/iomgr/iomgr_internal.h"
void grpc_pollset_global_init(); void grpc_pollset_global_init(void);
void grpc_pollset_global_shutdown(); void grpc_pollset_global_shutdown(void);
#endif /* __GRPC_INTERNAL_IOMGR_IOMGR_POSIX_H_ */ #endif /* __GRPC_INTERNAL_IOMGR_IOMGR_POSIX_H_ */

@ -129,9 +129,9 @@ void grpc_kick_drain(grpc_pollset *p) {
/* global state management */ /* global state management */
grpc_pollset *grpc_backup_pollset() { return &g_backup_pollset; } grpc_pollset *grpc_backup_pollset(void) { return &g_backup_pollset; }
void grpc_pollset_global_init() { void grpc_pollset_global_init(void) {
int i; int i;
gpr_thd_id id; gpr_thd_id id;
@ -151,7 +151,7 @@ void grpc_pollset_global_init() {
gpr_thd_new(&id, backup_poller, NULL, NULL); gpr_thd_new(&id, backup_poller, NULL, NULL);
} }
void grpc_pollset_global_shutdown() { void grpc_pollset_global_shutdown(void) {
int i; int i;
/* terminate the backup poller thread */ /* terminate the backup poller thread */

@ -86,7 +86,7 @@ void grpc_kick_drain(grpc_pollset *p);
regardless of applications listening to events. Relying on this is slow regardless of applications listening to events. Relying on this is slow
however (the backup pollset only listens every 100ms or so) - so it's not however (the backup pollset only listens every 100ms or so) - so it's not
to be relied on. */ to be relied on. */
grpc_pollset *grpc_backup_pollset(); grpc_pollset *grpc_backup_pollset(void);
/* turn a pollset into a multipoller: platform specific */ /* turn a pollset into a multipoller: platform specific */
void grpc_platform_become_multipoller(grpc_pollset *pollset, void grpc_platform_become_multipoller(grpc_pollset *pollset,

@ -115,7 +115,7 @@ int grpc_set_socket_low_latency(int fd, int low_latency) {
static gpr_once g_probe_ipv6_once = GPR_ONCE_INIT; static gpr_once g_probe_ipv6_once = GPR_ONCE_INIT;
static int g_ipv6_loopback_available; static int g_ipv6_loopback_available;
static void probe_ipv6_once() { static void probe_ipv6_once(void) {
int fd = socket(AF_INET6, SOCK_STREAM, 0); int fd = socket(AF_INET6, SOCK_STREAM, 0);
g_ipv6_loopback_available = 0; g_ipv6_loopback_available = 0;
if (fd < 0) { if (fd < 0) {
@ -135,7 +135,7 @@ static void probe_ipv6_once() {
} }
} }
int grpc_ipv6_loopback_available() { int grpc_ipv6_loopback_available(void) {
gpr_once_init(&g_probe_ipv6_once, probe_ipv6_once); gpr_once_init(&g_probe_ipv6_once, probe_ipv6_once);
return g_ipv6_loopback_available; return g_ipv6_loopback_available;
} }

@ -61,7 +61,7 @@ int grpc_set_socket_low_latency(int fd, int low_latency);
and bind IPv6 sockets, but cannot connect to a getsockname() of [::]:port and bind IPv6 sockets, but cannot connect to a getsockname() of [::]:port
without a valid loopback interface. Rather than expose this half-broken without a valid loopback interface. Rather than expose this half-broken
state to library users, we turn off IPv6 sockets. */ state to library users, we turn off IPv6 sockets. */
int grpc_ipv6_loopback_available(); int grpc_ipv6_loopback_available(void);
/* An enum to keep track of IPv4/IPv6 socket modes. /* An enum to keep track of IPv4/IPv6 socket modes.

@ -46,7 +46,7 @@ typedef struct grpc_tcp_server grpc_tcp_server;
typedef void (*grpc_tcp_server_cb)(void *arg, grpc_endpoint *ep); typedef void (*grpc_tcp_server_cb)(void *arg, grpc_endpoint *ep);
/* Create a server, initially not bound to any ports */ /* Create a server, initially not bound to any ports */
grpc_tcp_server *grpc_tcp_server_create(); grpc_tcp_server *grpc_tcp_server_create(void);
/* Start listening to bound ports */ /* Start listening to bound ports */
void grpc_tcp_server_start(grpc_tcp_server *server, grpc_pollset *pollset, void grpc_tcp_server_start(grpc_tcp_server *server, grpc_pollset *pollset,

@ -84,7 +84,7 @@ struct grpc_tcp_server {
size_t port_capacity; size_t port_capacity;
}; };
grpc_tcp_server *grpc_tcp_server_create() { grpc_tcp_server *grpc_tcp_server_create(void) {
grpc_tcp_server *s = gpr_malloc(sizeof(grpc_tcp_server)); grpc_tcp_server *s = gpr_malloc(sizeof(grpc_tcp_server));
gpr_mu_init(&s->mu); gpr_mu_init(&s->mu);
gpr_cv_init(&s->cv); gpr_cv_init(&s->cv);
@ -120,7 +120,7 @@ void grpc_tcp_server_destroy(grpc_tcp_server *s) {
} }
/* get max listen queue size on linux */ /* get max listen queue size on linux */
static void init_max_accept_queue_size() { static void init_max_accept_queue_size(void) {
int n = SOMAXCONN; int n = SOMAXCONN;
char buf[64]; char buf[64];
FILE *fp = fopen("/proc/sys/net/core/somaxconn", "r"); FILE *fp = fopen("/proc/sys/net/core/somaxconn", "r");
@ -147,7 +147,7 @@ static void init_max_accept_queue_size() {
} }
} }
static int get_max_accept_queue_size() { static int get_max_accept_queue_size(void) {
gpr_once_init(&s_init_max_accept_queue_size, init_max_accept_queue_size); gpr_once_init(&s_init_max_accept_queue_size, init_max_accept_queue_size);
return s_max_accept_queue_size; return s_max_accept_queue_size;
} }

@ -637,8 +637,8 @@ grpc_credentials *grpc_fake_transport_security_credentials_create(void) {
return c; return c;
} }
grpc_server_credentials * grpc_server_credentials *grpc_fake_transport_security_server_credentials_create(
grpc_fake_transport_security_server_credentials_create() { void) {
grpc_server_credentials *c = gpr_malloc(sizeof(grpc_server_credentials)); grpc_server_credentials *c = gpr_malloc(sizeof(grpc_server_credentials));
memset(c, 0, sizeof(grpc_server_credentials)); memset(c, 0, sizeof(grpc_server_credentials));
c->type = GRPC_CREDENTIALS_TYPE_FAKE_TRANSPORT_SECURITY; c->type = GRPC_CREDENTIALS_TYPE_FAKE_TRANSPORT_SECURITY;

@ -37,13 +37,13 @@
#include "src/core/statistics/census_rpc_stats.h" #include "src/core/statistics/census_rpc_stats.h"
#include "src/core/statistics/census_tracing.h" #include "src/core/statistics/census_tracing.h"
void census_init() { void census_init(void) {
gpr_log(GPR_INFO, "Initialize census library."); gpr_log(GPR_INFO, "Initialize census library.");
census_tracing_init(); census_tracing_init();
census_stats_store_init(); census_stats_store_init();
} }
void census_shutdown() { void census_shutdown(void) {
gpr_log(GPR_INFO, "Shutdown census library."); gpr_log(GPR_INFO, "Shutdown census library.");
census_stats_store_shutdown(); census_stats_store_shutdown();
census_tracing_shutdown(); census_tracing_shutdown();

@ -49,10 +49,10 @@ typedef struct census_op_id {
typedef struct census_rpc_stats census_rpc_stats; typedef struct census_rpc_stats census_rpc_stats;
/* Initializes Census library. No-op if Census is already initialized. */ /* Initializes Census library. No-op if Census is already initialized. */
void census_init(); void census_init(void);
/* Shutdown Census Library. */ /* Shutdown Census Library. */
void census_shutdown(); void census_shutdown(void);
/* Annotates grpc method name on a census_op_id. The method name has the format /* Annotates grpc method name on a census_op_id. The method name has the format
of <full quantified rpc service name>/<rpc function name>. Returns 0 iff of <full quantified rpc service name>/<rpc function name>. Returns 0 iff
@ -68,7 +68,7 @@ int census_add_method_tag(census_op_id op_id, const char* method_name);
void census_tracing_print(census_op_id op_id, const char* annotation); void census_tracing_print(census_op_id op_id, const char* annotation);
/* Starts tracing for an RPC. Returns a locally unique census_op_id */ /* Starts tracing for an RPC. Returns a locally unique census_op_id */
census_op_id census_tracing_start_op(); census_op_id census_tracing_start_op(void);
/* Ends tracing. Calling this function will invalidate the input op_id. */ /* Ends tracing. Calling this function will invalidate the input op_id. */
void census_tracing_end_op(census_op_id op_id); void census_tracing_end_op(census_op_id op_id);

@ -368,7 +368,7 @@ static void cl_block_end_read(cl_block* block) {
/* Allocates a new free block (or recycles an available dirty block if log is /* Allocates a new free block (or recycles an available dirty block if log is
configured to discard old records). Returns NULL if out-of-space. */ configured to discard old records). Returns NULL if out-of-space. */
static cl_block* cl_allocate_block() { static cl_block* cl_allocate_block(void) {
cl_block* block = cl_block_list_head(&g_log.free_block_list); cl_block* block = cl_block_list_head(&g_log.free_block_list);
if (block != NULL) { if (block != NULL) {
cl_block_list_remove(&g_log.free_block_list, block); cl_block_list_remove(&g_log.free_block_list, block);
@ -496,7 +496,7 @@ void census_log_initialize(size_t size_in_mb, int discard_old_records) {
g_log.initialized = 1; g_log.initialized = 1;
} }
void census_log_shutdown() { void census_log_shutdown(void) {
GPR_ASSERT(g_log.initialized); GPR_ASSERT(g_log.initialized);
gpr_mu_destroy(&g_log.lock); gpr_mu_destroy(&g_log.lock);
gpr_free_aligned(g_log.core_local_blocks); gpr_free_aligned(g_log.core_local_blocks);
@ -551,7 +551,7 @@ void census_log_end_write(void* record, size_t bytes_written) {
cl_block_end_write(cl_get_block(record), bytes_written); cl_block_end_write(cl_get_block(record), bytes_written);
} }
void census_log_init_reader() { void census_log_init_reader(void) {
GPR_ASSERT(g_log.initialized); GPR_ASSERT(g_log.initialized);
gpr_mu_lock(&g_log.lock); gpr_mu_lock(&g_log.lock);
/* If a block is locked for reading unlock it. */ /* If a block is locked for reading unlock it. */
@ -584,7 +584,7 @@ const void* census_log_read_next(size_t* bytes_available) {
return NULL; return NULL;
} }
size_t census_log_remaining_space() { size_t census_log_remaining_space(void) {
size_t space; size_t space;
GPR_ASSERT(g_log.initialized); GPR_ASSERT(g_log.initialized);
gpr_mu_lock(&g_log.lock); gpr_mu_lock(&g_log.lock);
@ -598,7 +598,7 @@ size_t census_log_remaining_space() {
return space; return space;
} }
int census_log_out_of_space_count() { int census_log_out_of_space_count(void) {
GPR_ASSERT(g_log.initialized); GPR_ASSERT(g_log.initialized);
return gpr_atm_acq_load(&g_log.out_of_space_count); return gpr_atm_acq_load(&g_log.out_of_space_count);
} }

@ -53,7 +53,7 @@ void census_log_initialize(size_t size_in_mb, int discard_old_records);
- no in progress or future call to any census_log functions - no in progress or future call to any census_log functions
- no incomplete records - no incomplete records
*/ */
void census_log_shutdown(); void census_log_shutdown(void);
/* Allocates and returns a 'size' bytes record and marks it in use. A /* Allocates and returns a 'size' bytes record and marks it in use. A
subsequent census_log_end_write() marks the record complete. The subsequent census_log_end_write() marks the record complete. The
@ -74,7 +74,7 @@ void census_log_end_write(void* record, size_t bytes_written);
is read. census_log_init_reader() starts the iteration or aborts the is read. census_log_init_reader() starts the iteration or aborts the
current iteration. current iteration.
*/ */
void census_log_init_reader(); void census_log_init_reader(void);
const void* census_log_read_next(size_t* bytes_available); const void* census_log_read_next(size_t* bytes_available);
/* Returns estimated remaining space across all blocks, in bytes. If log is /* Returns estimated remaining space across all blocks, in bytes. If log is
@ -82,10 +82,10 @@ const void* census_log_read_next(size_t* bytes_available);
returns space available in empty blocks (partially filled blocks are returns space available in empty blocks (partially filled blocks are
treated as full). treated as full).
*/ */
size_t census_log_remaining_space(); size_t census_log_remaining_space(void);
/* Returns the number of times gprc_stats_log_start_write() failed due to /* Returns the number of times gprc_stats_log_start_write() failed due to
out-of-space. */ out-of-space. */
int census_log_out_of_space_count(); int census_log_out_of_space_count(void);
#endif /* __GRPC_INTERNAL_STATISTICS_LOG_H__ */ #endif /* __GRPC_INTERNAL_STATISTICS_LOG_H__ */

@ -59,9 +59,9 @@ static gpr_mu g_mu;
static census_ht* g_client_stats_store = NULL; static census_ht* g_client_stats_store = NULL;
static census_ht* g_server_stats_store = NULL; static census_ht* g_server_stats_store = NULL;
static void init_mutex() { gpr_mu_init(&g_mu); } static void init_mutex(void) { gpr_mu_init(&g_mu); }
static void init_mutex_once() { static void init_mutex_once(void) {
gpr_once_init(&g_stats_store_mu_init, init_mutex); gpr_once_init(&g_stats_store_mu_init, init_mutex);
} }
@ -115,7 +115,7 @@ static gpr_timespec min_hour_total_intervals[3] = {
static const census_window_stats_stat_info window_stats_settings = { static const census_window_stats_stat_info window_stats_settings = {
sizeof(census_rpc_stats), init_rpc_stats, stat_add, stat_add_proportion}; sizeof(census_rpc_stats), init_rpc_stats, stat_add, stat_add_proportion};
census_rpc_stats* census_rpc_stats_create_empty() { census_rpc_stats* census_rpc_stats_create_empty(void) {
census_rpc_stats* ret = census_rpc_stats* ret =
(census_rpc_stats*)gpr_malloc(sizeof(census_rpc_stats)); (census_rpc_stats*)gpr_malloc(sizeof(census_rpc_stats));
memset(ret, 0, sizeof(census_rpc_stats)); memset(ret, 0, sizeof(census_rpc_stats));
@ -220,7 +220,7 @@ void census_get_server_stats(census_aggregated_rpc_stats* data) {
get_stats(g_server_stats_store, data); get_stats(g_server_stats_store, data);
} }
void census_stats_store_init() { void census_stats_store_init(void) {
gpr_log(GPR_INFO, "Initialize census stats store."); gpr_log(GPR_INFO, "Initialize census stats store.");
init_mutex_once(); init_mutex_once();
gpr_mu_lock(&g_mu); gpr_mu_lock(&g_mu);
@ -233,7 +233,7 @@ void census_stats_store_init() {
gpr_mu_unlock(&g_mu); gpr_mu_unlock(&g_mu);
} }
void census_stats_store_shutdown() { void census_stats_store_shutdown(void) {
gpr_log(GPR_INFO, "Shutdown census stats store."); gpr_log(GPR_INFO, "Shutdown census stats store.");
init_mutex_once(); init_mutex_once();
gpr_mu_lock(&g_mu); gpr_mu_lock(&g_mu);

@ -53,7 +53,7 @@ struct census_rpc_stats {
}; };
/* Creates an empty rpc stats object on heap. */ /* Creates an empty rpc stats object on heap. */
census_rpc_stats* census_rpc_stats_create_empty(); census_rpc_stats* census_rpc_stats_create_empty(void);
typedef struct census_per_method_rpc_stats { typedef struct census_per_method_rpc_stats {
const char* method; const char* method;
@ -91,8 +91,8 @@ void census_get_server_stats(census_aggregated_rpc_stats* data_map);
DO NOT CALL from outside of grpc code. */ DO NOT CALL from outside of grpc code. */
void census_get_client_stats(census_aggregated_rpc_stats* data_map); void census_get_client_stats(census_aggregated_rpc_stats* data_map);
void census_stats_store_init(); void census_stats_store_init(void);
void census_stats_store_shutdown(); void census_stats_store_shutdown(void);
#ifdef __cplusplus #ifdef __cplusplus
} }

@ -93,11 +93,13 @@ static gpr_uint64 op_id_2_uint64(census_op_id* id) {
return ret; return ret;
} }
static void init_mutex() { gpr_mu_init(&g_mu); } static void init_mutex(void) { gpr_mu_init(&g_mu); }
static void init_mutex_once() { gpr_once_init(&g_init_mutex_once, init_mutex); } static void init_mutex_once(void) {
gpr_once_init(&g_init_mutex_once, init_mutex);
}
census_op_id census_tracing_start_op() { census_op_id census_tracing_start_op(void) {
gpr_mu_lock(&g_mu); gpr_mu_lock(&g_mu);
{ {
trace_obj* ret = (trace_obj*)gpr_malloc(sizeof(trace_obj)); trace_obj* ret = (trace_obj*)gpr_malloc(sizeof(trace_obj));
@ -164,7 +166,7 @@ void census_tracing_end_op(census_op_id op_id) {
gpr_mu_unlock(&g_mu); gpr_mu_unlock(&g_mu);
} }
void census_tracing_init() { void census_tracing_init(void) {
gpr_log(GPR_INFO, "Initialize census trace store."); gpr_log(GPR_INFO, "Initialize census trace store.");
init_mutex_once(); init_mutex_once();
gpr_mu_lock(&g_mu); gpr_mu_lock(&g_mu);
@ -177,7 +179,7 @@ void census_tracing_init() {
gpr_mu_unlock(&g_mu); gpr_mu_unlock(&g_mu);
} }
void census_tracing_shutdown() { void census_tracing_shutdown(void) {
gpr_log(GPR_INFO, "Shutdown census trace store."); gpr_log(GPR_INFO, "Shutdown census trace store.");
gpr_mu_lock(&g_mu); gpr_mu_lock(&g_mu);
if (g_trace_store != NULL) { if (g_trace_store != NULL) {
@ -189,9 +191,9 @@ void census_tracing_shutdown() {
gpr_mu_unlock(&g_mu); gpr_mu_unlock(&g_mu);
} }
void census_internal_lock_trace_store() { gpr_mu_lock(&g_mu); } void census_internal_lock_trace_store(void) { gpr_mu_lock(&g_mu); }
void census_internal_unlock_trace_store() { gpr_mu_unlock(&g_mu); } void census_internal_unlock_trace_store(void) { gpr_mu_unlock(&g_mu); }
trace_obj* census_get_trace_obj_locked(census_op_id op_id) { trace_obj* census_get_trace_obj_locked(census_op_id op_id) {
if (g_trace_store == NULL) { if (g_trace_store == NULL) {

@ -38,10 +38,10 @@
typedef struct trace_obj trace_obj; typedef struct trace_obj trace_obj;
/* Initializes trace store. This function is thread safe. */ /* Initializes trace store. This function is thread safe. */
void census_tracing_init(); void census_tracing_init(void);
/* Shutsdown trace store. This function is thread safe. */ /* Shutsdown trace store. This function is thread safe. */
void census_tracing_shutdown(); void census_tracing_shutdown(void);
/* Gets trace obj corresponding to the input op_id. Returns NULL if trace store /* Gets trace obj corresponding to the input op_id. Returns NULL if trace store
is not initialized or trace obj is not found. Requires trace store being is not initialized or trace obj is not found. Requires trace store being
@ -50,8 +50,8 @@ trace_obj* census_get_trace_obj_locked(census_op_id op_id);
/* The following two functions acquire and release the trace store global lock. /* The following two functions acquire and release the trace store global lock.
They are for census internal use only. */ They are for census internal use only. */
void census_internal_lock_trace_store(); void census_internal_lock_trace_store(void);
void census_internal_unlock_trace_store(); void census_internal_unlock_trace_store(void);
/* Gets method tag name associated with the input trace object. */ /* Gets method tag name associated with the input trace object. */
const char* census_get_trace_method_name(const trace_obj* trace); const char* census_get_trace_method_name(const trace_obj* trace);

@ -38,12 +38,12 @@
/* Return the number of CPU cores on the current system. Will return 0 if /* Return the number of CPU cores on the current system. Will return 0 if
if information is not available. */ if information is not available. */
int gpr_cpu_num_cores(); int gpr_cpu_num_cores(void);
/* Return the CPU on which the current thread is executing; N.B. This should /* Return the CPU on which the current thread is executing; N.B. This should
be considered advisory only - it is possible that the thread is switched be considered advisory only - it is possible that the thread is switched
to a different CPU at any time. Returns a value in range to a different CPU at any time. Returns a value in range
[0, gpr_cpu_num_cores() - 1] */ [0, gpr_cpu_num_cores() - 1] */
int gpr_cpu_current_cpu(); int gpr_cpu_current_cpu(void);
#endif /* __GRPC_INTERNAL_SUPPORT_CPU_H__ */ #endif /* __GRPC_INTERNAL_SUPPORT_CPU_H__ */

@ -75,7 +75,7 @@
#include <grpc/support/log.h> #include <grpc/support/log.h>
int gpr_cpu_num_cores() { int gpr_cpu_num_cores(void) {
static int ncpus = 0; static int ncpus = 0;
if (ncpus == 0) { if (ncpus == 0) {
ncpus = sysconf(_SC_NPROCESSORS_ONLN); ncpus = sysconf(_SC_NPROCESSORS_ONLN);
@ -87,7 +87,7 @@ int gpr_cpu_num_cores() {
return ncpus; return ncpus;
} }
int gpr_cpu_current_cpu() { int gpr_cpu_current_cpu(void) {
int cpu = sched_getcpu(); int cpu = sched_getcpu();
if (cpu < 0) { if (cpu < 0) {
gpr_log(GPR_ERROR, "Error determining current CPU: %s\n", strerror(errno)); gpr_log(GPR_ERROR, "Error determining current CPU: %s\n", strerror(errno));

@ -45,7 +45,7 @@
static __thread char magic_thread_local; static __thread char magic_thread_local;
int gpr_cpu_num_cores() { int gpr_cpu_num_cores(void) {
static int ncpus = 0; static int ncpus = 0;
if (ncpus == 0) { if (ncpus == 0) {
ncpus = sysconf(_SC_NPROCESSORS_ONLN); ncpus = sysconf(_SC_NPROCESSORS_ONLN);
@ -63,7 +63,7 @@ static size_t shard_ptr(const void *info) {
return ((x >> 4) ^ (x >> 9) ^ (x >> 14)) % gpr_cpu_num_cores(); return ((x >> 4) ^ (x >> 9) ^ (x >> 14)) % gpr_cpu_num_cores();
} }
int gpr_cpu_current_cpu() { int gpr_cpu_current_cpu(void) {
/* NOTE: there's no way I know to return the actual cpu index portably... /* NOTE: there's no way I know to return the actual cpu index portably...
most code that's using this is using it to shard across work queues though, most code that's using this is using it to shard across work queues though,
so here we use thread identity instead to achieve a similar though not so here we use thread identity instead to achieve a similar though not

@ -47,7 +47,7 @@
#include <sys/syscall.h> #include <sys/syscall.h>
#include <unistd.h> #include <unistd.h>
static long gettid() { return syscall(__NR_gettid); } static long gettid(void) { return syscall(__NR_gettid); }
void gpr_log(const char *file, int line, gpr_log_severity severity, void gpr_log(const char *file, int line, gpr_log_severity severity,
const char *format, ...) { const char *format, ...) {

@ -50,7 +50,7 @@
#include <time.h> #include <time.h>
#include <pthread.h> #include <pthread.h>
static gpr_intptr gettid() { return (gpr_intptr)pthread_self(); } static gpr_intptr gettid(void) { return (gpr_intptr)pthread_self(); }
void gpr_log(const char *file, int line, gpr_log_severity severity, void gpr_log(const char *file, int line, gpr_log_severity severity,
const char *format, ...) { const char *format, ...) {

@ -37,7 +37,7 @@
#include <string.h> #include <string.h>
gpr_slice gpr_empty_slice() { gpr_slice gpr_empty_slice(void) {
gpr_slice out; gpr_slice out;
out.refcount = 0; out.refcount = 0;
out.data.inlined.length = 0; out.data.inlined.length = 0;

@ -63,7 +63,7 @@ typedef struct {
char *data; char *data;
} hexout; } hexout;
static hexout hexout_create() { static hexout hexout_create(void) {
hexout r = {0, 0, NULL}; hexout r = {0, 0, NULL};
return r; return r;
} }

@ -600,17 +600,6 @@ grpc_call_error grpc_call_server_end_initial_metadata(grpc_call *call,
return GRPC_CALL_OK; return GRPC_CALL_OK;
} }
grpc_call_error grpc_call_accept(grpc_call *call, grpc_completion_queue *cq,
void *finished_tag, gpr_uint32 flags) {
grpc_call_error err;
err = grpc_call_server_accept(call, cq, finished_tag);
if (err != GRPC_CALL_OK) return err;
err = grpc_call_server_end_initial_metadata(call, flags);
if (err != GRPC_CALL_OK) return err;
return GRPC_CALL_OK;
}
void grpc_call_client_initial_metadata_complete( void grpc_call_client_initial_metadata_complete(
grpc_call_element *surface_element) { grpc_call_element *surface_element) {
grpc_call *call = grpc_call_from_top_element(surface_element); grpc_call *call = grpc_call_from_top_element(surface_element);

@ -85,7 +85,7 @@ struct grpc_completion_queue {
/* Default do-nothing on_finish function */ /* Default do-nothing on_finish function */
static void null_on_finish(void *user_data, grpc_op_error error) {} static void null_on_finish(void *user_data, grpc_op_error error) {}
grpc_completion_queue *grpc_completion_queue_create() { grpc_completion_queue *grpc_completion_queue_create(void) {
grpc_completion_queue *cc = gpr_malloc(sizeof(grpc_completion_queue)); grpc_completion_queue *cc = gpr_malloc(sizeof(grpc_completion_queue));
memset(cc, 0, sizeof(*cc)); memset(cc, 0, sizeof(*cc));
/* Initial ref is dropped by grpc_completion_queue_shutdown */ /* Initial ref is dropped by grpc_completion_queue_shutdown */
@ -251,7 +251,7 @@ void grpc_cq_end_new_rpc(grpc_completion_queue *cc, void *tag, grpc_call *call,
} }
/* Create a GRPC_QUEUE_SHUTDOWN event without queuing it anywhere */ /* Create a GRPC_QUEUE_SHUTDOWN event without queuing it anywhere */
static event *create_shutdown_event() { static event *create_shutdown_event(void) {
event *ev = gpr_malloc(sizeof(event)); event *ev = gpr_malloc(sizeof(event));
ev->base.type = GRPC_QUEUE_SHUTDOWN; ev->base.type = GRPC_QUEUE_SHUTDOWN;
ev->base.call = NULL; ev->base.call = NULL;

@ -35,12 +35,12 @@
#include "src/core/statistics/census_interface.h" #include "src/core/statistics/census_interface.h"
#include "src/core/iomgr/iomgr.h" #include "src/core/iomgr/iomgr.h"
void grpc_init() { void grpc_init(void) {
grpc_iomgr_init(); grpc_iomgr_init();
census_init(); census_init();
} }
void grpc_shutdown() { void grpc_shutdown(void) {
grpc_iomgr_shutdown(); grpc_iomgr_shutdown();
census_shutdown(); census_shutdown();
} }

@ -46,7 +46,7 @@ int grpc_chttp2_is_alpn_version_supported(const char *version, size_t size) {
return 0; return 0;
} }
size_t grpc_chttp2_num_alpn_versions() { size_t grpc_chttp2_num_alpn_versions(void) {
return GPR_ARRAY_SIZE(supported_versions); return GPR_ARRAY_SIZE(supported_versions);
} }

@ -40,7 +40,7 @@
int grpc_chttp2_is_alpn_version_supported(const char *version, size_t size); int grpc_chttp2_is_alpn_version_supported(const char *version, size_t size);
/* Returns the number of protocol versions to advertise */ /* Returns the number of protocol versions to advertise */
size_t grpc_chttp2_num_alpn_versions(); size_t grpc_chttp2_num_alpn_versions(void);
/* Returns the protocol version at index i (0 <= i < /* Returns the protocol version at index i (0 <= i <
* grpc_chttp2_num_alpn_versions()) */ * grpc_chttp2_num_alpn_versions()) */

@ -102,7 +102,7 @@ gpr_slice grpc_chttp2_settings_create(gpr_uint32 *old, const gpr_uint32 *new,
return output; return output;
} }
gpr_slice grpc_chttp2_settings_ack_create() { gpr_slice grpc_chttp2_settings_ack_create(void) {
gpr_slice output = gpr_slice_malloc(9); gpr_slice output = gpr_slice_malloc(9);
fill_header(GPR_SLICE_START_PTR(output), 0, GRPC_CHTTP2_FLAG_ACK); fill_header(GPR_SLICE_START_PTR(output), 0, GRPC_CHTTP2_FLAG_ACK);
return output; return output;

@ -88,7 +88,7 @@ extern const grpc_chttp2_setting_parameters
gpr_slice grpc_chttp2_settings_create(gpr_uint32 *old, const gpr_uint32 *new, gpr_slice grpc_chttp2_settings_create(gpr_uint32 *old, const gpr_uint32 *new,
gpr_uint32 force_mask, size_t count); gpr_uint32 force_mask, size_t count);
/* Create an ack settings frame */ /* Create an ack settings frame */
gpr_slice grpc_chttp2_settings_ack_create(); gpr_slice grpc_chttp2_settings_ack_create(void);
grpc_chttp2_parse_error grpc_chttp2_settings_parser_begin_frame( grpc_chttp2_parse_error grpc_chttp2_settings_parser_begin_frame(
grpc_chttp2_settings_parser *parser, gpr_uint32 length, gpr_uint8 flags, grpc_chttp2_settings_parser *parser, gpr_uint32 length, gpr_uint8 flags,

@ -86,7 +86,7 @@ static unsigned char suffix_mask(unsigned char prefix_len) {
return ~prefix_mask(prefix_len); return ~prefix_mask(prefix_len);
} }
static void generate_first_byte_lut() { static void generate_first_byte_lut(void) {
int i, j, n; int i, j, n;
const spec *chrspec; const spec *chrspec;
unsigned char suffix; unsigned char suffix;
@ -136,21 +136,21 @@ typedef struct { char included[GRPC_CHTTP2_NUM_HUFFSYMS]; } symset;
typedef struct { int values[16]; } nibblelut; typedef struct { int values[16]; } nibblelut;
/* returns a symset that includes all possible symbols */ /* returns a symset that includes all possible symbols */
static symset symset_all() { static symset symset_all(void) {
symset x; symset x;
memset(x.included, 1, sizeof(x.included)); memset(x.included, 1, sizeof(x.included));
return x; return x;
} }
/* returns a symset that includes no symbols */ /* returns a symset that includes no symbols */
static symset symset_none() { static symset symset_none(void) {
symset x; symset x;
memset(x.included, 0, sizeof(x.included)); memset(x.included, 0, sizeof(x.included));
return x; return x;
} }
/* returns an empty nibblelut */ /* returns an empty nibblelut */
static nibblelut nibblelut_empty() { static nibblelut nibblelut_empty(void) {
nibblelut x; nibblelut x;
int i; int i;
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
@ -296,7 +296,7 @@ static void dump_ctbl(const char *name) {
printf("};\n"); printf("};\n");
} }
static void generate_huff_tables() { static void generate_huff_tables(void) {
int i; int i;
build_dec_tbl(state_index(0, symset_all(), &i), 0, 0, 0, -1, symset_all()); build_dec_tbl(state_index(0, symset_all(), &i), 0, 0, 0, -1, symset_all());
@ -317,7 +317,7 @@ static void generate_huff_tables() {
dump_ctbl("emit_sub_tbl"); dump_ctbl("emit_sub_tbl");
} }
static void generate_base64_huff_encoder_table() { static void generate_base64_huff_encoder_table(void) {
static const char alphabet[] = static const char alphabet[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
int i; int i;
@ -332,7 +332,7 @@ static void generate_base64_huff_encoder_table() {
printf("};\n"); printf("};\n");
} }
static void generate_base64_inverse_table() { static void generate_base64_inverse_table(void) {
static const char alphabet[] = static const char alphabet[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
unsigned char inverse[256]; unsigned char inverse[256];

@ -154,7 +154,7 @@ grpc_mdctx *grpc_mdctx_create_with_seed(gpr_uint32 seed) {
return ctx; return ctx;
} }
grpc_mdctx *grpc_mdctx_create() { grpc_mdctx *grpc_mdctx_create(void) {
/* This seed is used to prevent remote connections from controlling hash table /* This seed is used to prevent remote connections from controlling hash table
* collisions. It needs to be somewhat unpredictable to a remote connection. * collisions. It needs to be somewhat unpredictable to a remote connection.
*/ */

@ -82,7 +82,7 @@ struct grpc_mdelem {
}; };
/* Create/orphan a metadata context */ /* Create/orphan a metadata context */
grpc_mdctx *grpc_mdctx_create(); grpc_mdctx *grpc_mdctx_create(void);
grpc_mdctx *grpc_mdctx_create_with_seed(gpr_uint32 seed); grpc_mdctx *grpc_mdctx_create_with_seed(gpr_uint32 seed);
void grpc_mdctx_orphan(grpc_mdctx *mdctx); void grpc_mdctx_orphan(grpc_mdctx *mdctx);

@ -19,7 +19,7 @@ Gem::Specification.new do |s|
s.add_dependency 'xray' s.add_dependency 'xray'
s.add_dependency 'logging', '~> 1.8' s.add_dependency 'logging', '~> 1.8'
s.add_dependency 'google-protobuf', '~> 3.0.0alpha' s.add_dependency 'google-protobuf', '~> 3.0.0alpha.1.1'
s.add_dependency 'minitest', '~> 5.4' # not a dev dependency, used by the interop tests s.add_dependency 'minitest', '~> 5.4' # not a dev dependency, used by the interop tests
s.add_development_dependency "bundler", "~> 1.7" s.add_development_dependency "bundler", "~> 1.7"

@ -39,30 +39,48 @@ CPPFLAGS_dbg = -O0
LDFLAGS_dbg = LDFLAGS_dbg =
DEFINES_dbg = _DEBUG DEBUG DEFINES_dbg = _DEBUG DEBUG
VALID_CONFIG_valgrind = 1
REQUIRE_CUSTOM_LIBRARIES_valgrind = 1
CC_valgrind = gcc
CXX_valgrind = g++
LD_valgrind = gcc
LDXX_valgrind = g++
CPPFLAGS_valgrind = -O0
OPENSSL_CFLAGS_valgrind = -DPURIFY
LDFLAGS_valgrind =
DEFINES_valgrind = _DEBUG DEBUG
VALID_CONFIG_tsan = 1 VALID_CONFIG_tsan = 1
REQUIRE_CUSTOM_LIBRARIES_tsan = 1
CC_tsan = clang CC_tsan = clang
CXX_tsan = clang++ CXX_tsan = clang++
LD_tsan = clang LD_tsan = clang
LDXX_tsan = clang++ LDXX_tsan = clang++
CPPFLAGS_tsan = -O1 -fsanitize=thread -fno-omit-frame-pointer CPPFLAGS_tsan = -O1 -fsanitize=thread -fno-omit-frame-pointer
OPENSSL_CONFIG_tsan = no-asm
LDFLAGS_tsan = -fsanitize=thread LDFLAGS_tsan = -fsanitize=thread
DEFINES_tsan = NDEBUG DEFINES_tsan = NDEBUG
VALID_CONFIG_asan = 1 VALID_CONFIG_asan = 1
REQUIRE_CUSTOM_LIBRARIES_asan = 1
CC_asan = clang CC_asan = clang
CXX_asan = clang++ CXX_asan = clang++
LD_asan = clang LD_asan = clang
LDXX_asan = clang++ LDXX_asan = clang++
CPPFLAGS_asan = -O1 -fsanitize=address -fno-omit-frame-pointer CPPFLAGS_asan = -O1 -fsanitize=address -fno-omit-frame-pointer
OPENSSL_CONFIG_asan = no-asm
LDFLAGS_asan = -fsanitize=address LDFLAGS_asan = -fsanitize=address
DEFINES_asan = NDEBUG DEFINES_asan = NDEBUG
VALID_CONFIG_msan = 1 VALID_CONFIG_msan = 1
REQUIRE_CUSTOM_LIBRARIES_msan = 1
CC_msan = clang CC_msan = clang
CXX_msan = clang++ CXX_msan = clang++
LD_msan = clang LD_msan = clang
LDXX_msan = clang++ LDXX_msan = clang++
CPPFLAGS_msan = -O1 -fsanitize=memory -fno-omit-frame-pointer CPPFLAGS_msan = -O1 -fsanitize=memory -fno-omit-frame-pointer
OPENSSL_CFLAGS_msan = -DPURIFY
OPENSSL_CONFIG_msan = no-asm
LDFLAGS_msan = -fsanitize=memory LDFLAGS_msan = -fsanitize=memory
DEFINES_msan = NDEBUG DEFINES_msan = NDEBUG
@ -172,8 +190,14 @@ endif
OPENSSL_ALPN_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o /dev/null test/build/openssl-alpn.c -lssl -lcrypto -ldl $(LDFLAGS) OPENSSL_ALPN_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o /dev/null test/build/openssl-alpn.c -lssl -lcrypto -ldl $(LDFLAGS)
ZLIB_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o /dev/null test/build/zlib.c -lz $(LDFLAGS) ZLIB_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o /dev/null test/build/zlib.c -lz $(LDFLAGS)
ifndef REQUIRE_CUSTOM_LIBRARIES_$(CONFIG)
HAS_SYSTEM_OPENSSL_ALPN = $(shell $(OPENSSL_ALPN_CHECK_CMD) 2> /dev/null && echo true || echo false) HAS_SYSTEM_OPENSSL_ALPN = $(shell $(OPENSSL_ALPN_CHECK_CMD) 2> /dev/null && echo true || echo false)
HAS_SYSTEM_ZLIB = $(shell $(ZLIB_CHECK_CMD) 2> /dev/null && echo true || echo false) HAS_SYSTEM_ZLIB = $(shell $(ZLIB_CHECK_CMD) 2> /dev/null && echo true || echo false)
else
# override system libraries if the config requires a custom compiled library
HAS_SYSTEM_OPENSSL_ALPN = false
HAS_SYSTEM_ZLIB = false
endif
ifeq ($(wildcard third_party/openssl/ssl/ssl.h),) ifeq ($(wildcard third_party/openssl/ssl/ssl.h),)
HAS_EMBEDDED_OPENSSL_ALPN = false HAS_EMBEDDED_OPENSSL_ALPN = false
@ -189,7 +213,7 @@ endif
ifeq ($(HAS_SYSTEM_ZLIB),false) ifeq ($(HAS_SYSTEM_ZLIB),false)
ifeq ($(HAS_EMBEDDED_ZLIB),true) ifeq ($(HAS_EMBEDDED_ZLIB),true)
ZLIB_DEP = third_party/zlib/libz.a ZLIB_DEP = libs/$(CONFIG)/zlib/libz.a
CPPFLAGS += -Ithird_party/zlib CPPFLAGS += -Ithird_party/zlib
LDFLAGS += -Lthird_party/zlib LDFLAGS += -Lthird_party/zlib
else else
@ -199,10 +223,10 @@ endif
ifeq ($(HAS_SYSTEM_OPENSSL_ALPN),false) ifeq ($(HAS_SYSTEM_OPENSSL_ALPN),false)
ifeq ($(HAS_EMBEDDED_OPENSSL_ALPN),true) ifeq ($(HAS_EMBEDDED_OPENSSL_ALPN),true)
OPENSSL_DEP = third_party/openssl/libssl.a OPENSSL_DEP = libs/$(CONFIG)/openssl/libssl.a
OPENSSL_MERGE_LIBS += third_party/openssl/libssl.a third_party/openssl/libcrypto.a OPENSSL_MERGE_LIBS += libs/$(CONFIG)/openssl/libssl.a libs/$(CONFIG)/openssl/libcrypto.a
CPPFLAGS += -Ithird_party/openssl/include CPPFLAGS += -Ithird_party/openssl/include
LDFLAGS += -Lthird_party/openssl LDFLAGS += -Llibs/$(CONFIG)/openssl
LIBS_SECURE = dl LIBS_SECURE = dl
else else
NO_SECURE = true NO_SECURE = true
@ -213,16 +237,19 @@ endif
LDLIBS_SECURE += $(addprefix -l, $(LIBS_SECURE)) LDLIBS_SECURE += $(addprefix -l, $(LIBS_SECURE))
ifneq ($(DEP_MISSING),) ifeq ($(MAKECMDGOALS),clean)
NO_DEPS = true
endif
ifneq ($(MAKECMDGOALS),clean)
NO_DEPS = true NO_DEPS = true
endif endif
.SECONDARY = %.pb.h %.pb.cc .SECONDARY = %.pb.h %.pb.cc
PROTOC_PLUGINS=\
% for tgt in targets:
% if tgt.build == 'protoc':
bins/$(CONFIG)/${tgt.name}\
% endif
% endfor
ifeq ($(DEP_MISSING),) ifeq ($(DEP_MISSING),)
all: static shared\ all: static shared\
% for tgt in targets: % for tgt in targets:
@ -290,17 +317,25 @@ run_dep_checks:
$(OPENSSL_ALPN_CHECK_CMD) || true $(OPENSSL_ALPN_CHECK_CMD) || true
$(ZLIB_CHECK_CMD) || true $(ZLIB_CHECK_CMD) || true
third_party/zlib/libz.a: libs/$(CONFIG)/zlib/libz.a:
(cd third_party/zlib ; CFLAGS="-fPIC -fvisibility=hidden" ./configure --static) $(E) "[MAKE] Building zlib"
$(MAKE) -C third_party/zlib $(Q)(cd third_party/zlib ; CC="$(CC)" CFLAGS="-fPIC -fvisibility=hidden $(CPPFLAGS_$(CONFIG))" ./configure --static)
$(Q)$(MAKE) -C third_party/zlib clean
third_party/openssl/libssl.a: $(Q)$(MAKE) -C third_party/zlib
(cd third_party/openssl ; CC="$(CC) -fPIC -fvisibility=hidden" ./config) $(Q)mkdir -p libs/$(CONFIG)/zlib
$(MAKE) -C third_party/openssl build_crypto build_ssl $(Q)cp third_party/zlib/libz.a libs/$(CONFIG)/zlib
libs/$(CONFIG)/openssl/libssl.a:
$(E) "[MAKE] Building openssl"
$(Q)(cd third_party/openssl ; CC="$(CC) -fPIC -fvisibility=hidden $(CPPFLAGS_$(CONFIG)) $(OPENSSL_CFLAGS_$(CONFIG))" ./config $(OPENSSL_CONFIG_$(CONFIG)))
$(Q)$(MAKE) -C third_party/openssl clean
$(Q)$(MAKE) -C third_party/openssl build_crypto build_ssl
$(Q)mkdir -p libs/$(CONFIG)/openssl
$(Q)cp third_party/openssl/libssl.a third_party/openssl/libcrypto.a libs/$(CONFIG)/openssl
static: static_c static_cxx static: static_c static_cxx
static_c: dep_c\ static_c: \
% for lib in libs: % for lib in libs:
% if lib.build == 'all' and not lib.get('c++', False): % if lib.build == 'all' and not lib.get('c++', False):
libs/$(CONFIG)/lib${lib.name}.a\ libs/$(CONFIG)/lib${lib.name}.a\
@ -308,7 +343,7 @@ static_c: dep_c\
% endfor % endfor
static_cxx: dep_cxx\ static_cxx: \
% for lib in libs: % for lib in libs:
% if lib.build == 'all' and lib.get('c++', False): % if lib.build == 'all' and lib.get('c++', False):
libs/$(CONFIG)/lib${lib.name}.a\ libs/$(CONFIG)/lib${lib.name}.a\
@ -318,7 +353,7 @@ static_cxx: dep_cxx\
shared: shared_c shared_cxx shared: shared_c shared_cxx
shared_c: dep_c\ shared_c: \
% for lib in libs: % for lib in libs:
% if lib.build == 'all' and not lib.get('c++', False): % if lib.build == 'all' and not lib.get('c++', False):
libs/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)\ libs/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)\
@ -326,7 +361,7 @@ shared_c: dep_c\
% endfor % endfor
shared_cxx: dep_cxx\ shared_cxx: \
% for lib in libs: % for lib in libs:
% if lib.build == 'all' and lib.get('c++', False): % if lib.build == 'all' and lib.get('c++', False):
libs/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)\ libs/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)\
@ -336,7 +371,7 @@ shared_cxx: dep_cxx\
privatelibs: privatelibs_c privatelibs_cxx privatelibs: privatelibs_c privatelibs_cxx
privatelibs_c: dep_c\ privatelibs_c: \
% for lib in libs: % for lib in libs:
% if lib.build == 'private' and not lib.get('c++', False): % if lib.build == 'private' and not lib.get('c++', False):
libs/$(CONFIG)/lib${lib.name}.a\ libs/$(CONFIG)/lib${lib.name}.a\
@ -344,7 +379,7 @@ privatelibs_c: dep_c\
% endfor % endfor
privatelibs_cxx: dep_cxx\ privatelibs_cxx: \
% for lib in libs: % for lib in libs:
% if lib.build == 'private' and lib.get('c++', False): % if lib.build == 'private' and lib.get('c++', False):
libs/$(CONFIG)/lib${lib.name}.a\ libs/$(CONFIG)/lib${lib.name}.a\
@ -354,7 +389,7 @@ privatelibs_cxx: dep_cxx\
buildtests: buildtests_c buildtests_cxx buildtests: buildtests_c buildtests_cxx
buildtests_c: bins_dep_c privatelibs_c\ buildtests_c: privatelibs_c\
% for tgt in targets: % for tgt in targets:
% if tgt.build == 'test' and not tgt.get('c++', False): % if tgt.build == 'test' and not tgt.get('c++', False):
bins/$(CONFIG)/${tgt.name}\ bins/$(CONFIG)/${tgt.name}\
@ -362,7 +397,7 @@ buildtests_c: bins_dep_c privatelibs_c\
% endfor % endfor
buildtests_cxx: bins_dep_cxx privatelibs_cxx\ buildtests_cxx: privatelibs_cxx\
% for tgt in targets: % for tgt in targets:
% if tgt.build == 'test' and tgt.get('c++', False): % if tgt.build == 'test' and tgt.get('c++', False):
bins/$(CONFIG)/${tgt.name}\ bins/$(CONFIG)/${tgt.name}\
@ -398,14 +433,6 @@ tools: privatelibs\
% endfor % endfor
protoc_plugins:\
% for tgt in targets:
% if tgt.build == 'protoc':
bins/$(CONFIG)/${tgt.name}\
% endif
% endfor
buildbenchmarks: privatelibs\ buildbenchmarks: privatelibs\
% for tgt in targets: % for tgt in targets:
% if tgt.build == 'benchmark': % if tgt.build == 'benchmark':
@ -463,79 +490,32 @@ strip-shared_cxx: shared_cxx
% endfor % endfor
% for p in protos: % for p in protos:
deps/$(CONFIG)/gens/${p}.pb.dep: gens/${p}.pb.cc: ${p}.proto $(PROTOC_PLUGINS)
$(Q) mkdir -p `dirname $@`
$(Q) touch $@
gens/${p}.pb.cc: ${p}.proto protoc_plugins
$(E) "[PROTOC] Generating protobuf CC file from $<" $(E) "[PROTOC] Generating protobuf CC file from $<"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(PROTOC) --cpp_out=gens --grpc_out=gens --plugin=protoc-gen-grpc=bins/$(CONFIG)/cpp_plugin $< $(Q) $(PROTOC) --cpp_out=gens --grpc_out=gens --plugin=protoc-gen-grpc=bins/$(CONFIG)/cpp_plugin $<
% endfor % endfor
deps/$(CONFIG)/%.dep : %.c
$(E) "[DEP] Generating dependencies for $<"
$(Q) mkdir -p `dirname $@`
$(Q) $(CC) $(CFLAGS) $(CPPFLAGS_NO_ARCH) -MG -M $< > $@
deps/$(CONFIG)/%.dep : %.cc
$(E) "[DEP] Generating dependencies for $<"
$(Q) mkdir -p `dirname $@`
$(Q) $(CXX) $(CXXFLAGS) $(CPPFLAGS_NO_ARCH) -MG -M $< > $@
objs/$(CONFIG)/%.o : %.c objs/$(CONFIG)/%.o : %.c
$(E) "[C] Compiling $<" $(E) "[C] Compiling $<"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< $(Q) $(CC) $(CFLAGS) $(CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $<
objs/$(CONFIG)/%.o : gens/%.pb.cc objs/$(CONFIG)/%.o : gens/%.pb.cc
$(E) "[CXX] Compiling $<" $(E) "[CXX] Compiling $<"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< $(Q) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $<
objs/$(CONFIG)/src/compiler/%.o : src/compiler/%.cc objs/$(CONFIG)/src/compiler/%.o : src/compiler/%.cc
$(E) "[HOSTCXX] Compiling $<" $(E) "[HOSTCXX] Compiling $<"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(HOST_CXX) $(HOST_CXXFLAGS) $(HOST_CPPFLAGS) -c -o $@ $< $(Q) $(HOST_CXX) $(HOST_CXXFLAGS) $(HOST_CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $<
objs/$(CONFIG)/%.o : %.cc objs/$(CONFIG)/%.o : %.cc
$(E) "[CXX] Compiling $<" $(E) "[CXX] Compiling $<"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< $(Q) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $<
dep: dep_c dep_cxx
dep_c:\
% for lib in libs:
% if not lib.get('c++', False):
deps_lib${lib.name}\
% endif
% endfor
bins_dep_c:\
% for tgt in targets:
% if not tgt.get('c++', False):
deps_${tgt.name}\
% endif
% endfor
dep_cxx:\
% for lib in libs:
% if lib.get('c++', False):
deps_lib${lib.name}\
% endif
% endfor
bins_dep_cxx:\
% for tgt in targets:
% if tgt.get('c++', False):
deps_${tgt.name}\
% endif
% endfor
install: install_c install_cxx install: install_c install_cxx
@ -624,15 +604,8 @@ ifneq ($(SYSTEM),Darwin)
endif endif
endif endif
clean:\ clean:
% for lib in libs: $(Q) $(RM) -rf objs libs bins gens
clean_lib${lib.name}\
% endfor
% for tgt in targets:
clean_${tgt.name}\
% endfor
$(Q) $(RM) -r deps objs libs bins gens
# The various libraries # The various libraries
@ -671,7 +644,6 @@ PUBLIC_HEADERS_C += \\
% endif % endif
LIB${lib.name.upper()}_OBJS = $(addprefix objs/$(CONFIG)/, $(addsuffix .o, $(basename $(LIB${lib.name.upper()}_SRC)))) LIB${lib.name.upper()}_OBJS = $(addprefix objs/$(CONFIG)/, $(addsuffix .o, $(basename $(LIB${lib.name.upper()}_SRC))))
LIB${lib.name.upper()}_DEPS = $(addprefix deps/$(CONFIG)/, $(addsuffix .dep, $(basename $(LIB${lib.name.upper()}_SRC))))
% if lib.get('secure', True): % if lib.get('secure', True):
ifeq ($(NO_SECURE),true) ifeq ($(NO_SECURE),true)
@ -688,9 +660,15 @@ endif
else else
libs/$(CONFIG)/lib${lib.name}.a: $(OPENSSL_DEP) $(LIB${lib.name.upper()}_OBJS) ifneq ($(OPENSSL_DEP),)
% for src in lib.src:
${src}: $(OPENSSL_DEP)
% endfor
endif
libs/$(CONFIG)/lib${lib.name}.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(LIB${lib.name.upper()}_OBJS)
% else: % else:
libs/$(CONFIG)/lib${lib.name}.a: $(LIB${lib.name.upper()}_OBJS) libs/$(CONFIG)/lib${lib.name}.a: $(ZLIB_DEP) $(LIB${lib.name.upper()}_OBJS)
% endif % endif
$(E) "[AR] Creating $@" $(E) "[AR] Creating $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
@ -719,12 +697,12 @@ libs/$(CONFIG)/lib${lib.name}.a: $(LIB${lib.name.upper()}_OBJS)
common = '$(LIB' + lib.name.upper() + '_OBJS) $(LDLIBS)' common = '$(LIB' + lib.name.upper() + '_OBJS) $(LDLIBS)'
libs = '' libs = ''
lib_deps = '' lib_deps = ' $(ZLIB_DEP)'
mingw_libs = '' mingw_libs = ''
mingw_lib_deps = '' mingw_lib_deps = ' $(ZLIB_DEP)'
for dep in lib.get('deps', []): for dep in lib.get('deps', []):
libs = libs + ' -l' + dep libs = libs + ' -l' + dep
lib_deps = lib_deps + 'libs/$(CONFIG)/lib' + dep + '.$(SHARED_EXT)' lib_deps = lib_deps + ' libs/$(CONFIG)/lib' + dep + '.$(SHARED_EXT)'
mingw_libs = mingw_libs + ' -l' + dep + '-imp' mingw_libs = mingw_libs + ' -l' + dep + '-imp'
mingw_lib_deps = mingw_lib_deps + 'libs/$(CONFIG)/' + dep + '.$(SHARED_EXT)' mingw_lib_deps = mingw_lib_deps + 'libs/$(CONFIG)/' + dep + '.$(SHARED_EXT)'
@ -732,7 +710,6 @@ libs/$(CONFIG)/lib${lib.name}.a: $(LIB${lib.name.upper()}_OBJS)
common = common + ' $(LDLIBS_SECURE) $(OPENSSL_MERGE_LIBS)' common = common + ' $(LDLIBS_SECURE) $(OPENSSL_MERGE_LIBS)'
lib_deps = lib_deps + ' $(OPENSSL_DEP)' lib_deps = lib_deps + ' $(OPENSSL_DEP)'
mingw_lib_deps = mingw_lib_deps + ' $(OPENSSL_DEP)' mingw_lib_deps = mingw_lib_deps + ' $(OPENSSL_DEP)'
%> %>
% if lib.build == "all": % if lib.build == "all":
@ -759,13 +736,11 @@ endif
endif endif
% endif % endif
deps_lib${lib.name}: $(LIB${lib.name.upper()}_DEPS)
% if lib.get('secure', True): % if lib.get('secure', True):
ifneq ($(NO_SECURE),true) ifneq ($(NO_SECURE),true)
% endif % endif
ifneq ($(NO_DEPS),true) ifneq ($(NO_DEPS),true)
-include $(LIB${lib.name.upper()}_DEPS) -include $(LIB${lib.name.upper()}_OBJS:.o=.dep)
endif endif
% if lib.get('secure', True): % if lib.get('secure', True):
endif endif
@ -782,13 +757,6 @@ objs/$(CONFIG)/${os.path.splitext(src)[0]}.o: \
% endif % endif
% endfor % endfor
clean_lib${lib.name}:
$(E) "[CLEAN] Cleaning lib${lib.name} files"
$(Q) $(RM) $(LIB${lib.name.upper()}_OBJS)
$(Q) $(RM) $(LIB${lib.name.upper()}_DEPS)
$(Q) $(RM) libs/$(CONFIG)/lib${lib.name}.a
$(Q) $(RM) libs/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)
</%def> </%def>
<%def name="maketarget(tgt)"> <%def name="maketarget(tgt)">
@ -800,7 +768,6 @@ ${tgt.name.upper()}_SRC = \\
% endfor % endfor
${tgt.name.upper()}_OBJS = $(addprefix objs/$(CONFIG)/, $(addsuffix .o, $(basename $(${tgt.name.upper()}_SRC)))) ${tgt.name.upper()}_OBJS = $(addprefix objs/$(CONFIG)/, $(addsuffix .o, $(basename $(${tgt.name.upper()}_SRC))))
${tgt.name.upper()}_DEPS = $(addprefix deps/$(CONFIG)/, $(addsuffix .dep, $(basename $(${tgt.name.upper()}_SRC))))
% if tgt.get('secure', True): % if tgt.get('secure', True):
ifeq ($(NO_SECURE),true) ifeq ($(NO_SECURE),true)
@ -867,23 +834,17 @@ objs/$(CONFIG)/${os.path.splitext(src)[0]}.o: \
% endfor % endfor
deps_${tgt.name}: $(${tgt.name.upper()}_DEPS) deps_${tgt.name}: $(${tgt.name.upper()}_OBJS:.o=.dep)
% if tgt.get('secure', True): % if tgt.get('secure', True):
ifneq ($(NO_SECURE),true) ifneq ($(NO_SECURE),true)
% endif % endif
ifneq ($(NO_DEPS),true) ifneq ($(NO_DEPS),true)
-include $(${tgt.name.upper()}_DEPS) -include $(${tgt.name.upper()}_OBJS:.o=.dep)
endif endif
% if tgt.get('secure', True): % if tgt.get('secure', True):
endif endif
% endif % endif
clean_${tgt.name}:
$(E) "[CLEAN] Cleaning ${tgt.name} files"
$(Q) $(RM) $(${tgt.name.upper()}_OBJS)
$(Q) $(RM) $(${tgt.name.upper()}_DEPS)
$(Q) $(RM) bins/$(CONFIG)/${tgt.name}
</%def> </%def>
.PHONY: all strip tools \ .PHONY: all strip tools \
@ -897,12 +858,6 @@ install-static install-static_c install-static_cxx \
strip strip-shared strip-static \ strip strip-shared strip-static \
strip_c strip-shared_c strip-static_c \ strip_c strip-shared_c strip-static_c \
strip_cxx strip-shared_cxx strip-static_cxx \ strip_cxx strip-shared_cxx strip-static_cxx \
clean \ dep_c dep_cxx bins_dep_c bins_dep_cxx \
dep_c dep_cxx bins_dep_c bins_dep_cxx\ clean
% for lib in libs:
deps_lib${lib.name} clean_lib${lib.name}\
% endfor
% for tgt in targets:
deps_${tgt.name} clean_${tgt.name}\
% endfor

@ -76,7 +76,7 @@ static void channel_func(grpc_channel_element *elem,
++*(int *)(elem->channel_data); ++*(int *)(elem->channel_data);
} }
static void test_create_channel_stack() { static void test_create_channel_stack(void) {
const grpc_channel_filter filter = { const grpc_channel_filter filter = {
call_func, channel_func, call_func, channel_func,

@ -145,7 +145,7 @@ static gpr_slice create_test_value(test_value id) {
return gpr_slice_from_copied_string("bad value"); return gpr_slice_from_copied_string("bad value");
} }
static void test_bad_data() { static void test_bad_data(void) {
gpr_slice_buffer input; gpr_slice_buffer input;
gpr_slice_buffer output; gpr_slice_buffer output;
int i; int i;

@ -56,7 +56,7 @@ typedef struct {
gpr_intmax bytes_read; gpr_intmax bytes_read;
} call_state; } call_state;
static void request_call() { static void request_call(void) {
call_state *tag = gpr_malloc(sizeof(*tag)); call_state *tag = gpr_malloc(sizeof(*tag));
gpr_ref_init(&tag->pending_ops, 2); gpr_ref_init(&tag->pending_ops, 2);
tag->bytes_read = 0; tag->bytes_read = 0;
@ -124,7 +124,9 @@ int main(int argc, char **argv) {
case GRPC_SERVER_RPC_NEW: case GRPC_SERVER_RPC_NEW:
if (ev->call != NULL) { if (ev->call != NULL) {
/* initial ops are already started in request_call */ /* initial ops are already started in request_call */
grpc_call_accept(ev->call, cq, s, GRPC_WRITE_BUFFER_HINT); grpc_call_server_accept(ev->call, cq, s);
grpc_call_server_end_initial_metadata(ev->call,
GRPC_WRITE_BUFFER_HINT);
GPR_ASSERT(grpc_call_start_read(ev->call, s) == GRPC_CALL_OK); GPR_ASSERT(grpc_call_start_read(ev->call, s) == GRPC_CALL_OK);
request_call(); request_call();
} else { } else {

@ -127,7 +127,8 @@ void test_connect(const char *server_host, const char *client_host, int port,
deadline, NULL); deadline, NULL);
cq_verify(v_server); cq_verify(v_server);
GPR_ASSERT(GRPC_CALL_OK == grpc_call_accept(s, server_cq, tag(102), 0)); GPR_ASSERT(GRPC_CALL_OK == grpc_call_server_accept(s, server_cq, tag(102)));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_server_end_initial_metadata(s, 0));
cq_expect_client_metadata_read(v_client, tag(2), NULL); cq_expect_client_metadata_read(v_client, tag(2), NULL);
cq_verify(v_client); cq_verify(v_client);

@ -72,7 +72,7 @@ static gpr_timespec n_seconds_time(int n) {
return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n)); return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n));
} }
static gpr_timespec five_seconds_time() { return n_seconds_time(5); } static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event *ev; grpc_event *ev;
@ -131,7 +131,8 @@ static void test_cancel_after_accept(grpc_end2end_test_config config,
deadline, NULL); deadline, NULL);
cq_verify(v_server); cq_verify(v_server);
GPR_ASSERT(GRPC_CALL_OK == grpc_call_accept(s, f.server_cq, tag(102), 0)); GPR_ASSERT(GRPC_CALL_OK == grpc_call_server_accept(s, f.server_cq, tag(102)));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_server_end_initial_metadata(s, 0));
cq_expect_client_metadata_read(v_client, tag(2), NULL); cq_expect_client_metadata_read(v_client, tag(2), NULL);
cq_verify(v_client); cq_verify(v_client);

@ -72,7 +72,7 @@ static gpr_timespec n_seconds_time(int n) {
return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n)); return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n));
} }
static gpr_timespec five_seconds_time() { return n_seconds_time(5); } static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event *ev; grpc_event *ev;
@ -131,7 +131,8 @@ static void test_cancel_after_accept_and_writes_closed(
deadline, NULL); deadline, NULL);
cq_verify(v_server); cq_verify(v_server);
GPR_ASSERT(GRPC_CALL_OK == grpc_call_accept(s, f.server_cq, tag(102), 0)); GPR_ASSERT(GRPC_CALL_OK == grpc_call_server_accept(s, f.server_cq, tag(102)));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_server_end_initial_metadata(s, 0));
cq_expect_client_metadata_read(v_client, tag(2), NULL); cq_expect_client_metadata_read(v_client, tag(2), NULL);
cq_verify(v_client); cq_verify(v_client);

@ -72,7 +72,7 @@ static gpr_timespec n_seconds_time(int n) {
return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n)); return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n));
} }
static gpr_timespec five_seconds_time() { return n_seconds_time(5); } static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event *ev; grpc_event *ev;

@ -68,7 +68,7 @@ static gpr_timespec n_seconds_time(int n) {
return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n)); return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n));
} }
static gpr_timespec five_seconds_time() { return n_seconds_time(5); } static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event *ev; grpc_event *ev;

@ -70,7 +70,7 @@ static gpr_timespec n_seconds_time(int n) {
return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n)); return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n));
} }
static gpr_timespec five_seconds_time() { return n_seconds_time(5); } static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event *ev; grpc_event *ev;

@ -120,7 +120,8 @@ static void test_body(grpc_end2end_test_fixture f) {
deadline, NULL); deadline, NULL);
cq_verify(v_server); cq_verify(v_server);
GPR_ASSERT(GRPC_CALL_OK == grpc_call_accept(s, f.server_cq, tag(102), 0)); GPR_ASSERT(GRPC_CALL_OK == grpc_call_server_accept(s, f.server_cq, tag(102)));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_server_end_initial_metadata(s, 0));
cq_expect_client_metadata_read(v_client, tag(2), NULL); cq_expect_client_metadata_read(v_client, tag(2), NULL);
cq_verify(v_client); cq_verify(v_client);

@ -52,7 +52,7 @@ static gpr_timespec n_seconds_time(int n) {
return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n)); return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n));
} }
static gpr_timespec five_seconds_time() { return n_seconds_time(5); } static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event *ev; grpc_event *ev;
@ -112,7 +112,9 @@ static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f,
deadline, NULL); deadline, NULL);
cq_verify(v_server); cq_verify(v_server);
GPR_ASSERT(GRPC_CALL_OK == grpc_call_accept(s, f->server_cq, tag(102), 0)); GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_server_accept(s, f->server_cq, tag(102)));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_server_end_initial_metadata(s, 0));
cq_expect_client_metadata_read(v_client, tag(2), NULL); cq_expect_client_metadata_read(v_client, tag(2), NULL);
cq_verify(v_client); cq_verify(v_client);

@ -64,7 +64,7 @@ static gpr_timespec n_seconds_time(int n) {
return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n)); return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n));
} }
static gpr_timespec five_seconds_time() { return n_seconds_time(5); } static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event *ev; grpc_event *ev;
@ -126,7 +126,8 @@ static void test_early_server_shutdown_finishes_inflight_calls(
deadline, NULL); deadline, NULL);
cq_verify(v_server); cq_verify(v_server);
GPR_ASSERT(GRPC_CALL_OK == grpc_call_accept(s, f.server_cq, tag(102), 0)); GPR_ASSERT(GRPC_CALL_OK == grpc_call_server_accept(s, f.server_cq, tag(102)));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_server_end_initial_metadata(s, 0));
cq_expect_client_metadata_read(v_client, tag(2), NULL); cq_expect_client_metadata_read(v_client, tag(2), NULL);
cq_verify(v_client); cq_verify(v_client);

@ -64,7 +64,7 @@ static gpr_timespec n_seconds_time(int n) {
return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n)); return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n));
} }
static gpr_timespec five_seconds_time() { return n_seconds_time(5); } static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event *ev; grpc_event *ev;

@ -100,7 +100,7 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_destroy(f->client_cq); grpc_completion_queue_destroy(f->client_cq);
} }
static gpr_slice large_slice() { static gpr_slice large_slice(void) {
gpr_slice slice = gpr_slice_malloc(1000000); gpr_slice slice = gpr_slice_malloc(1000000);
memset(GPR_SLICE_START_PTR(slice), 0xab, GPR_SLICE_LENGTH(slice)); memset(GPR_SLICE_START_PTR(slice), 0xab, GPR_SLICE_LENGTH(slice));
return slice; return slice;
@ -141,7 +141,8 @@ static void test_invoke_large_request(grpc_end2end_test_config config) {
deadline, NULL); deadline, NULL);
cq_verify(v_server); cq_verify(v_server);
grpc_call_accept(s, f.server_cq, tag(102), 0); GPR_ASSERT(GRPC_CALL_OK == grpc_call_server_accept(s, f.server_cq, tag(102)));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_server_end_initial_metadata(s, 0));
cq_expect_client_metadata_read(v_client, tag(2), NULL); cq_expect_client_metadata_read(v_client, tag(2), NULL);
cq_verify(v_client); cq_verify(v_client);

@ -64,7 +64,7 @@ static gpr_timespec n_seconds_time(int n) {
return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n)); return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n));
} }
static gpr_timespec five_seconds_time() { return n_seconds_time(5); } static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event *ev; grpc_event *ev;
@ -124,7 +124,8 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
deadline, NULL); deadline, NULL);
cq_verify(v_server); cq_verify(v_server);
GPR_ASSERT(GRPC_CALL_OK == grpc_call_accept(s, f.server_cq, tag(102), 0)); GPR_ASSERT(GRPC_CALL_OK == grpc_call_server_accept(s, f.server_cq, tag(102)));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_server_end_initial_metadata(s, 0));
cq_expect_client_metadata_read(v_client, tag(2), NULL); cq_expect_client_metadata_read(v_client, tag(2), NULL);
cq_verify(v_client); cq_verify(v_client);
@ -211,7 +212,9 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
"test.google.com", deadline, NULL); "test.google.com", deadline, NULL);
cq_verify(v_server); cq_verify(v_server);
GPR_ASSERT(GRPC_CALL_OK == grpc_call_accept(s1, f.server_cq, tag(102), 0)); GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_server_accept(s1, f.server_cq, tag(102)));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_server_end_initial_metadata(s1, 0));
cq_expect_client_metadata_read(v_client, tag(live_call + 1), NULL); cq_expect_client_metadata_read(v_client, tag(live_call + 1), NULL);
cq_verify(v_client); cq_verify(v_client);
@ -235,7 +238,9 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
"test.google.com", deadline, NULL); "test.google.com", deadline, NULL);
cq_verify(v_server); cq_verify(v_server);
GPR_ASSERT(GRPC_CALL_OK == grpc_call_accept(s2, f.server_cq, tag(202), 0)); GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_server_accept(s2, f.server_cq, tag(202)));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_server_end_initial_metadata(s2, 0));
cq_expect_client_metadata_read(v_client, tag(live_call + 1), NULL); cq_expect_client_metadata_read(v_client, tag(live_call + 1), NULL);
cq_verify(v_client); cq_verify(v_client);

@ -62,7 +62,7 @@ static gpr_timespec n_seconds_time(int n) {
return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n)); return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n));
} }
static gpr_timespec five_seconds_time() { return n_seconds_time(5); } static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event *ev; grpc_event *ev;

@ -64,7 +64,7 @@ static gpr_timespec n_seconds_time(int n) {
return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n)); return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n));
} }
static gpr_timespec five_seconds_time() { return n_seconds_time(5); } static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event *ev; grpc_event *ev;
@ -129,7 +129,8 @@ static void test_pingpong_streaming(grpc_end2end_test_config config,
cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com", cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com",
deadline, NULL); deadline, NULL);
cq_verify(v_server); cq_verify(v_server);
grpc_call_accept(s, f.server_cq, tag(102), 0); GPR_ASSERT(GRPC_CALL_OK == grpc_call_server_accept(s, f.server_cq, tag(102)));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_server_end_initial_metadata(s, 0));
cq_expect_client_metadata_read(v_client, tag(2), NULL); cq_expect_client_metadata_read(v_client, tag(2), NULL);
cq_verify(v_client); cq_verify(v_client);

@ -64,7 +64,7 @@ static gpr_timespec n_seconds_time(int n) {
return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n)); return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n));
} }
static gpr_timespec five_seconds_time() { return n_seconds_time(5); } static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event *ev; grpc_event *ev;

@ -64,7 +64,7 @@ static gpr_timespec n_seconds_time(int n) {
return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n)); return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n));
} }
static gpr_timespec five_seconds_time() { return n_seconds_time(5); } static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event *ev; grpc_event *ev;

@ -64,7 +64,7 @@ static gpr_timespec n_seconds_time(int n) {
return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n)); return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n));
} }
static gpr_timespec five_seconds_time() { return n_seconds_time(5); } static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event *ev; grpc_event *ev;
@ -139,7 +139,8 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) {
deadline, NULL); deadline, NULL);
cq_verify(v_server); cq_verify(v_server);
grpc_call_accept(s, f.server_cq, tag(102), 0); GPR_ASSERT(GRPC_CALL_OK == grpc_call_server_accept(s, f.server_cq, tag(102)));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_server_end_initial_metadata(s, 0));
cq_expect_client_metadata_read(v_client, tag(2), NULL); cq_expect_client_metadata_read(v_client, tag(2), NULL);
cq_verify(v_client); cq_verify(v_client);

@ -64,7 +64,7 @@ static gpr_timespec n_seconds_time(int n) {
return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n)); return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n));
} }
static gpr_timespec five_seconds_time() { return n_seconds_time(5); } static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event *ev; grpc_event *ev;

@ -64,7 +64,7 @@ static gpr_timespec n_seconds_time(int n) {
return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n)); return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n));
} }
static gpr_timespec five_seconds_time() { return n_seconds_time(5); } static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event *ev; grpc_event *ev;

@ -64,7 +64,7 @@ static gpr_timespec n_seconds_time(int n) {
return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n)); return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n));
} }
static gpr_timespec five_seconds_time() { return n_seconds_time(5); } static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event *ev; grpc_event *ev;

@ -52,7 +52,7 @@ static gpr_timespec n_seconds_time(int n) {
return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n)); return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n));
} }
static gpr_timespec five_seconds_time() { return n_seconds_time(5); } static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event *ev; grpc_event *ev;
@ -122,7 +122,9 @@ static void simple_delayed_request_body(grpc_end2end_test_config config,
deadline, NULL); deadline, NULL);
cq_verify(v_server); cq_verify(v_server);
GPR_ASSERT(GRPC_CALL_OK == grpc_call_accept(s, f->server_cq, tag(102), 0)); GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_server_accept(s, f->server_cq, tag(102)));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_server_end_initial_metadata(s, 0));
cq_expect_client_metadata_read(v_client, tag(2), NULL); cq_expect_client_metadata_read(v_client, tag(2), NULL);
cq_verify(v_client); cq_verify(v_client);

@ -64,7 +64,7 @@ static gpr_timespec n_seconds_time(int n) {
return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n)); return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n));
} }
static gpr_timespec five_seconds_time() { return n_seconds_time(5); } static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event *ev; grpc_event *ev;
@ -124,7 +124,8 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
deadline, NULL); deadline, NULL);
cq_verify(v_server); cq_verify(v_server);
GPR_ASSERT(GRPC_CALL_OK == grpc_call_accept(s, f.server_cq, tag(102), 0)); GPR_ASSERT(GRPC_CALL_OK == grpc_call_server_accept(s, f.server_cq, tag(102)));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_server_end_initial_metadata(s, 0));
cq_expect_client_metadata_read(v_client, tag(2), NULL); cq_expect_client_metadata_read(v_client, tag(2), NULL);
cq_verify(v_client); cq_verify(v_client);
@ -169,7 +170,8 @@ static void simple_request_body2(grpc_end2end_test_fixture f) {
deadline, NULL); deadline, NULL);
cq_verify(v_server); cq_verify(v_server);
GPR_ASSERT(GRPC_CALL_OK == grpc_call_accept(s, f.server_cq, tag(102), 0)); GPR_ASSERT(GRPC_CALL_OK == grpc_call_server_accept(s, f.server_cq, tag(102)));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_server_end_initial_metadata(s, 0));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_write_status( GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_write_status(
s, GRPC_STATUS_UNIMPLEMENTED, "xyz", tag(5))); s, GRPC_STATUS_UNIMPLEMENTED, "xyz", tag(5)));

@ -56,7 +56,7 @@ static gpr_timespec n_seconds_time(int n) {
return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n)); return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n));
} }
static gpr_timespec five_seconds_time() { return n_seconds_time(5); } static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
/* Drain pending events on a completion queue until it's ready to destroy. /* Drain pending events on a completion queue until it's ready to destroy.
Does some post-processing to safely release memory on some of the events. */ Does some post-processing to safely release memory on some of the events. */
@ -105,7 +105,7 @@ static void drain_cq(int client, grpc_completion_queue *cq) {
} }
/* Kick off a new request - assumes g_mu taken */ /* Kick off a new request - assumes g_mu taken */
static void start_request() { static void start_request(void) {
gpr_slice slice = gpr_slice_malloc(100); gpr_slice slice = gpr_slice_malloc(100);
grpc_byte_buffer *buf; grpc_byte_buffer *buf;
grpc_call *call = grpc_channel_create_call( grpc_call *call = grpc_channel_create_call(
@ -176,7 +176,7 @@ static void client_thread(void *p) {
/* Request a new server call. We tag them with a ref-count that starts at two, /* Request a new server call. We tag them with a ref-count that starts at two,
and decrements after each of: a read completes and a write completes. and decrements after each of: a read completes and a write completes.
When it drops to zero, we write status */ When it drops to zero, we write status */
static void request_server_call() { static void request_server_call(void) {
gpr_refcount *rc = gpr_malloc(sizeof(gpr_refcount)); gpr_refcount *rc = gpr_malloc(sizeof(gpr_refcount));
gpr_ref_init(rc, 2); gpr_ref_init(rc, 2);
grpc_server_request_call(g_fixture.server, rc); grpc_server_request_call(g_fixture.server, rc);
@ -214,9 +214,11 @@ static void server_thread(void *p) {
break; break;
case GRPC_SERVER_RPC_NEW: case GRPC_SERVER_RPC_NEW:
if (ev->call) { if (ev->call) {
GPR_ASSERT(GRPC_CALL_OK == grpc_call_accept(ev->call, GPR_ASSERT(GRPC_CALL_OK ==
g_fixture.server_cq, grpc_call_server_accept(ev->call, g_fixture.server_cq,
ev->tag, 0)); ev->tag));
GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_server_end_initial_metadata(ev->call, 0));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_read(ev->call, ev->tag)); GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_read(ev->call, ev->tag));
GPR_ASSERT(GRPC_CALL_OK == GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_start_write(ev->call, buf, ev->tag, 0)); grpc_call_start_write(ev->call, buf, ev->tag, 0));

@ -64,7 +64,7 @@ static gpr_timespec n_seconds_time(int n) {
return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n)); return gpr_time_add(gpr_now(), gpr_time_from_micros(GPR_US_PER_SEC * n));
} }
static gpr_timespec five_seconds_time() { return n_seconds_time(5); } static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) { static void drain_cq(grpc_completion_queue *cq) {
grpc_event *ev; grpc_event *ev;
@ -143,7 +143,8 @@ static void test_writes_done_hangs_with_pending_read(
deadline, NULL); deadline, NULL);
cq_verify(v_server); cq_verify(v_server);
grpc_call_accept(s, f.server_cq, tag(102), 0); GPR_ASSERT(GRPC_CALL_OK == grpc_call_server_accept(s, f.server_cq, tag(102)));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_server_end_initial_metadata(s, 0));
cq_expect_client_metadata_read(v_client, tag(2), NULL); cq_expect_client_metadata_read(v_client, tag(2), NULL);
cq_verify(v_client); cq_verify(v_client);

@ -50,9 +50,9 @@ static grpc_channel *channel;
static grpc_completion_queue *cq; static grpc_completion_queue *cq;
static grpc_call *call; static grpc_call *call;
static void init_ping_pong_request() {} static void init_ping_pong_request(void) {}
static void step_ping_pong_request() { static void step_ping_pong_request(void) {
call = grpc_channel_create_call(channel, "/Reflector/reflectUnary", call = grpc_channel_create_call(channel, "/Reflector/reflectUnary",
"localhost", gpr_inf_future); "localhost", gpr_inf_future);
GPR_ASSERT(grpc_call_invoke(call, cq, (void *)1, (void *)1, GPR_ASSERT(grpc_call_invoke(call, cq, (void *)1, (void *)1,
@ -69,7 +69,7 @@ static void step_ping_pong_request() {
call = NULL; call = NULL;
} }
static void init_ping_pong_stream() { static void init_ping_pong_stream(void) {
call = grpc_channel_create_call(channel, "/Reflector/reflectStream", call = grpc_channel_create_call(channel, "/Reflector/reflectStream",
"localhost", gpr_inf_future); "localhost", gpr_inf_future);
GPR_ASSERT(grpc_call_invoke(call, cq, (void *)1, (void *)1, 0) == GPR_ASSERT(grpc_call_invoke(call, cq, (void *)1, (void *)1, 0) ==
@ -77,7 +77,7 @@ static void init_ping_pong_stream() {
grpc_event_finish(grpc_completion_queue_next(cq, gpr_inf_future)); grpc_event_finish(grpc_completion_queue_next(cq, gpr_inf_future));
} }
static void step_ping_pong_stream() { static void step_ping_pong_stream(void) {
GPR_ASSERT(grpc_call_start_write(call, the_buffer, (void *)1, 0) == GPR_ASSERT(grpc_call_start_write(call, the_buffer, (void *)1, 0) ==
GRPC_CALL_OK); GRPC_CALL_OK);
GPR_ASSERT(grpc_call_start_read(call, (void *)1) == GRPC_CALL_OK); GPR_ASSERT(grpc_call_start_read(call, (void *)1) == GRPC_CALL_OK);
@ -85,7 +85,7 @@ static void step_ping_pong_stream() {
grpc_event_finish(grpc_completion_queue_next(cq, gpr_inf_future)); grpc_event_finish(grpc_completion_queue_next(cq, gpr_inf_future));
} }
static double now() { static double now(void) {
gpr_timespec tv = gpr_now(); gpr_timespec tv = gpr_now();
return 1e9 * tv.tv_sec + tv.tv_nsec; return 1e9 * tv.tv_sec + tv.tv_nsec;
} }

@ -57,7 +57,7 @@ typedef struct {
gpr_uint32 flags; gpr_uint32 flags;
} call_state; } call_state;
static void request_call() { static void request_call(void) {
call_state *s = gpr_malloc(sizeof(call_state)); call_state *s = gpr_malloc(sizeof(call_state));
gpr_ref_init(&s->pending_ops, 2); gpr_ref_init(&s->pending_ops, 2);
grpc_server_request_call(server, s); grpc_server_request_call(server, s);
@ -130,7 +130,8 @@ int main(int argc, char **argv) {
} else { } else {
s->flags = GRPC_WRITE_BUFFER_HINT; s->flags = GRPC_WRITE_BUFFER_HINT;
} }
grpc_call_accept(ev->call, cq, s, s->flags); grpc_call_server_accept(ev->call, cq, s);
grpc_call_server_end_initial_metadata(ev->call, s->flags);
GPR_ASSERT(grpc_call_start_read(ev->call, s) == GRPC_CALL_OK); GPR_ASSERT(grpc_call_start_read(ev->call, s) == GRPC_CALL_OK);
request_call(); request_call();
} else { } else {

@ -38,7 +38,7 @@
#include <grpc/support/log.h> #include <grpc/support/log.h>
#include "test/core/util/test_config.h" #include "test/core/util/test_config.h"
static void test_format_get_request() { static void test_format_get_request(void) {
grpc_httpcli_header hdr = {"x-yz", "abc"}; grpc_httpcli_header hdr = {"x-yz", "abc"};
grpc_httpcli_request req; grpc_httpcli_request req;
gpr_slice slice; gpr_slice slice;
@ -63,7 +63,7 @@ static void test_format_get_request() {
gpr_slice_unref(slice); gpr_slice_unref(slice);
} }
static void test_format_post_request() { static void test_format_post_request(void) {
grpc_httpcli_header hdr = {"x-yz", "abc"}; grpc_httpcli_header hdr = {"x-yz", "abc"};
grpc_httpcli_request req; grpc_httpcli_request req;
gpr_slice slice; gpr_slice slice;
@ -93,7 +93,7 @@ static void test_format_post_request() {
gpr_slice_unref(slice); gpr_slice_unref(slice);
} }
static void test_format_post_request_no_body() { static void test_format_post_request_no_body(void) {
grpc_httpcli_header hdr = {"x-yz", "abc"}; grpc_httpcli_header hdr = {"x-yz", "abc"};
grpc_httpcli_request req; grpc_httpcli_request req;
gpr_slice slice; gpr_slice slice;
@ -118,7 +118,7 @@ static void test_format_post_request_no_body() {
gpr_slice_unref(slice); gpr_slice_unref(slice);
} }
static void test_format_post_request_content_type_override() { static void test_format_post_request_content_type_override(void) {
grpc_httpcli_header hdrs[2]; grpc_httpcli_header hdrs[2];
grpc_httpcli_request req; grpc_httpcli_request req;
gpr_slice slice; gpr_slice slice;

@ -40,7 +40,7 @@
#include <grpc/support/log.h> #include <grpc/support/log.h>
#include "test/core/util/test_config.h" #include "test/core/util/test_config.h"
static gpr_timespec random_deadline() { static gpr_timespec random_deadline(void) {
gpr_timespec ts; gpr_timespec ts;
ts.tv_sec = rand(); ts.tv_sec = rand();
ts.tv_nsec = rand(); ts.tv_nsec = rand();
@ -150,7 +150,7 @@ static void check_valid(grpc_alarm_heap *pq) {
} }
} }
static void test1() { static void test1(void) {
grpc_alarm_heap pq; grpc_alarm_heap pq;
const int num_test_elements = 200; const int num_test_elements = 200;
const int num_test_operations = 10000; const int num_test_operations = 10000;
@ -206,7 +206,7 @@ static void test1() {
gpr_free(inpq); gpr_free(inpq);
} }
static void shrink_test() { static void shrink_test(void) {
grpc_alarm_heap pq; grpc_alarm_heap pq;
int i; int i;
int expected_size; int expected_size;

@ -44,13 +44,13 @@
static int cb_called[MAX_CB][2]; static int cb_called[MAX_CB][2];
static int kicks; static int kicks;
void grpc_kick_poller() { ++kicks; } void grpc_kick_poller(void) { ++kicks; }
static void cb(void *arg, int success) { static void cb(void *arg, int success) {
cb_called[(gpr_intptr)arg][success]++; cb_called[(gpr_intptr)arg][success]++;
} }
static void add_test() { static void add_test(void) {
gpr_timespec start = gpr_now(); gpr_timespec start = gpr_now();
int i; int i;
grpc_alarm alarms[20]; grpc_alarm alarms[20];
@ -108,7 +108,7 @@ static void add_test() {
} }
/* Cleaning up a list with pending alarms. */ /* Cleaning up a list with pending alarms. */
void destruction_test() { void destruction_test(void) {
grpc_alarm alarms[5]; grpc_alarm alarms[5];
grpc_alarm_list_init(gpr_time_0); grpc_alarm_list_init(gpr_time_0);

@ -89,7 +89,7 @@ static void alarm_cb(void *arg /* alarm_arg */, int success) {
} }
/* Test grpc_alarm add and cancel. */ /* Test grpc_alarm add and cancel. */
static void test_grpc_alarm() { static void test_grpc_alarm(void) {
grpc_alarm alarm; grpc_alarm alarm;
grpc_alarm alarm_to_cancel; grpc_alarm alarm_to_cancel;
/* Timeout on the alarm cond. var, so make big enough to absorb time /* Timeout on the alarm cond. var, so make big enough to absorb time

@ -349,7 +349,7 @@ static void client_wait_and_shutdown(client *cl) {
/* Test grpc_fd. Start an upload server and client, upload a stream of /* Test grpc_fd. Start an upload server and client, upload a stream of
bytes from the client to the server, and verify that the total number of bytes from the client to the server, and verify that the total number of
sent bytes is equal to the total number of received bytes. */ sent bytes is equal to the total number of received bytes. */
static void test_grpc_fd() { static void test_grpc_fd(void) {
server sv; server sv;
client cl; client cl;
int port; int port;
@ -403,7 +403,7 @@ static void second_read_callback(void *arg /* fd_change_data */, int success) {
Note that we have two different but almost identical callbacks above -- the Note that we have two different but almost identical callbacks above -- the
point is to have two different function pointers and two different data point is to have two different function pointers and two different data
pointers and make sure that changing both really works. */ pointers and make sure that changing both really works. */
static void test_grpc_fd_change() { static void test_grpc_fd_change(void) {
grpc_fd *em_fd; grpc_fd *em_fd;
fd_change_data a, b; fd_change_data a, b;
int flags; int flags;

@ -37,7 +37,7 @@
#include <grpc/support/time.h> #include <grpc/support/time.h>
#include "test/core/util/test_config.h" #include "test/core/util/test_config.h"
static gpr_timespec test_deadline() { static gpr_timespec test_deadline(void) {
return gpr_time_add(gpr_now(), gpr_time_from_micros(100000000)); return gpr_time_add(gpr_now(), gpr_time_from_micros(100000000));
} }
@ -53,35 +53,35 @@ static void must_fail(void* evp, grpc_resolved_addresses* p) {
gpr_event_set(evp, (void*)1); gpr_event_set(evp, (void*)1);
} }
static void test_localhost() { static void test_localhost(void) {
gpr_event ev; gpr_event ev;
gpr_event_init(&ev); gpr_event_init(&ev);
grpc_resolve_address("localhost:1", NULL, must_succeed, &ev); grpc_resolve_address("localhost:1", NULL, must_succeed, &ev);
GPR_ASSERT(gpr_event_wait(&ev, test_deadline())); GPR_ASSERT(gpr_event_wait(&ev, test_deadline()));
} }
static void test_default_port() { static void test_default_port(void) {
gpr_event ev; gpr_event ev;
gpr_event_init(&ev); gpr_event_init(&ev);
grpc_resolve_address("localhost", "1", must_succeed, &ev); grpc_resolve_address("localhost", "1", must_succeed, &ev);
GPR_ASSERT(gpr_event_wait(&ev, test_deadline())); GPR_ASSERT(gpr_event_wait(&ev, test_deadline()));
} }
static void test_missing_default_port() { static void test_missing_default_port(void) {
gpr_event ev; gpr_event ev;
gpr_event_init(&ev); gpr_event_init(&ev);
grpc_resolve_address("localhost", NULL, must_fail, &ev); grpc_resolve_address("localhost", NULL, must_fail, &ev);
GPR_ASSERT(gpr_event_wait(&ev, test_deadline())); GPR_ASSERT(gpr_event_wait(&ev, test_deadline()));
} }
static void test_ipv6_with_port() { static void test_ipv6_with_port(void) {
gpr_event ev; gpr_event ev;
gpr_event_init(&ev); gpr_event_init(&ev);
grpc_resolve_address("[2001:db8::1]:1", NULL, must_succeed, &ev); grpc_resolve_address("[2001:db8::1]:1", NULL, must_succeed, &ev);
GPR_ASSERT(gpr_event_wait(&ev, test_deadline())); GPR_ASSERT(gpr_event_wait(&ev, test_deadline()));
} }
static void test_ipv6_without_port() { static void test_ipv6_without_port(void) {
const char* const kCases[] = { const char* const kCases[] = {
"2001:db8::1", "2001:db8::1.2.3.4", "[2001:db8::1]", "2001:db8::1", "2001:db8::1.2.3.4", "[2001:db8::1]",
}; };
@ -94,7 +94,7 @@ static void test_ipv6_without_port() {
} }
} }
static void test_invalid_ip_addresses() { static void test_invalid_ip_addresses(void) {
const char* const kCases[] = { const char* const kCases[] = {
"293.283.1238.3:1", "[2001:db8::11111]:1", "293.283.1238.3:1", "[2001:db8::11111]:1",
}; };
@ -107,7 +107,7 @@ static void test_invalid_ip_addresses() {
} }
} }
static void test_unparseable_hostports() { static void test_unparseable_hostports(void) {
const char* const kCases[] = { const char* const kCases[] = {
"[", "[::1", "[::1]bad", "[1.2.3.4]", "[localhost]", "[localhost]:1", "[", "[::1", "[::1]bad", "[1.2.3.4]", "[localhost]", "[localhost]:1",
}; };

@ -70,7 +70,7 @@ static const gpr_uint8 kIPv4[] = {192, 0, 2, 1};
static const gpr_uint8 kIPv6[] = {0x20, 0x01, 0x0d, 0xb8, 0, 0, 0, 0, static const gpr_uint8 kIPv6[] = {0x20, 0x01, 0x0d, 0xb8, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1}; 0, 0, 0, 0, 0, 0, 0, 1};
static void test_sockaddr_is_v4mapped() { static void test_sockaddr_is_v4mapped(void) {
struct sockaddr_in input4; struct sockaddr_in input4;
struct sockaddr_in6 input6; struct sockaddr_in6 input6;
struct sockaddr_in output4; struct sockaddr_in output4;
@ -101,7 +101,7 @@ static void test_sockaddr_is_v4mapped() {
!grpc_sockaddr_is_v4mapped((const struct sockaddr *)&input4, NULL)); !grpc_sockaddr_is_v4mapped((const struct sockaddr *)&input4, NULL));
} }
static void test_sockaddr_to_v4mapped() { static void test_sockaddr_to_v4mapped(void) {
struct sockaddr_in input4; struct sockaddr_in input4;
struct sockaddr_in6 input6; struct sockaddr_in6 input6;
struct sockaddr_in6 output6; struct sockaddr_in6 output6;
@ -129,7 +129,7 @@ static void test_sockaddr_to_v4mapped() {
!grpc_sockaddr_to_v4mapped((const struct sockaddr *)&input6, &output6)); !grpc_sockaddr_to_v4mapped((const struct sockaddr *)&input6, &output6));
} }
static void test_sockaddr_is_wildcard() { static void test_sockaddr_is_wildcard(void) {
struct sockaddr_in wild4; struct sockaddr_in wild4;
struct sockaddr_in6 wild6; struct sockaddr_in6 wild6;
struct sockaddr_in6 wild_mapped; struct sockaddr_in6 wild_mapped;
@ -187,7 +187,7 @@ static void expect_sockaddr_str(const char *expected, void *addr,
gpr_free(str); gpr_free(str);
} }
static void test_sockaddr_to_string() { static void test_sockaddr_to_string(void) {
struct sockaddr_in input4; struct sockaddr_in input4;
struct sockaddr_in6 input6; struct sockaddr_in6 input6;
struct sockaddr dummy; struct sockaddr dummy;

@ -43,7 +43,7 @@
#include <grpc/support/log.h> #include <grpc/support/log.h>
#include <grpc/support/time.h> #include <grpc/support/time.h>
static gpr_timespec test_deadline() { static gpr_timespec test_deadline(void) {
return gpr_time_add(gpr_now(), gpr_time_from_seconds(10)); return gpr_time_add(gpr_now(), gpr_time_from_seconds(10));
} }
@ -59,7 +59,7 @@ static void must_fail(void *arg, grpc_endpoint *tcp) {
gpr_event_set(arg, (void *)1); gpr_event_set(arg, (void *)1);
} }
void test_succeeds() { void test_succeeds(void) {
struct sockaddr_in addr; struct sockaddr_in addr;
socklen_t addr_len = sizeof(addr); socklen_t addr_len = sizeof(addr);
int svr_fd; int svr_fd;
@ -94,7 +94,7 @@ void test_succeeds() {
GPR_ASSERT(gpr_event_wait(&ev, test_deadline())); GPR_ASSERT(gpr_event_wait(&ev, test_deadline()));
} }
void test_fails() { void test_fails(void) {
struct sockaddr_in addr; struct sockaddr_in addr;
socklen_t addr_len = sizeof(addr); socklen_t addr_len = sizeof(addr);
gpr_event ev; gpr_event ev;
@ -112,7 +112,7 @@ void test_fails() {
GPR_ASSERT(gpr_event_wait(&ev, test_deadline())); GPR_ASSERT(gpr_event_wait(&ev, test_deadline()));
} }
void test_times_out() { void test_times_out(void) {
struct sockaddr_in addr; struct sockaddr_in addr;
socklen_t addr_len = sizeof(addr); socklen_t addr_len = sizeof(addr);
int svr_fd; int svr_fd;

@ -444,7 +444,7 @@ static void write_error_test(ssize_t num_bytes, ssize_t slice_size) {
free(slices); free(slices);
} }
void run_tests() { void run_tests(void) {
int i = 0; int i = 0;
read_test(100, 8192); read_test(100, 8192);
@ -469,7 +469,7 @@ void run_tests() {
} }
} }
static void clean_up() {} static void clean_up(void) {}
static grpc_endpoint_test_fixture create_fixture_tcp_socketpair( static grpc_endpoint_test_fixture create_fixture_tcp_socketpair(
size_t slice_size) { size_t slice_size) {

@ -58,19 +58,19 @@ static void on_connect(void *arg, grpc_endpoint *tcp) {
gpr_mu_unlock(&mu); gpr_mu_unlock(&mu);
} }
static void test_no_op() { static void test_no_op(void) {
grpc_tcp_server *s = grpc_tcp_server_create(); grpc_tcp_server *s = grpc_tcp_server_create();
grpc_tcp_server_destroy(s); grpc_tcp_server_destroy(s);
} }
static void test_no_op_with_start() { static void test_no_op_with_start(void) {
grpc_tcp_server *s = grpc_tcp_server_create(); grpc_tcp_server *s = grpc_tcp_server_create();
LOG_TEST(); LOG_TEST();
grpc_tcp_server_start(s, NULL, on_connect, NULL); grpc_tcp_server_start(s, NULL, on_connect, NULL);
grpc_tcp_server_destroy(s); grpc_tcp_server_destroy(s);
} }
static void test_no_op_with_port() { static void test_no_op_with_port(void) {
struct sockaddr_in addr; struct sockaddr_in addr;
grpc_tcp_server *s = grpc_tcp_server_create(); grpc_tcp_server *s = grpc_tcp_server_create();
LOG_TEST(); LOG_TEST();
@ -83,7 +83,7 @@ static void test_no_op_with_port() {
grpc_tcp_server_destroy(s); grpc_tcp_server_destroy(s);
} }
static void test_no_op_with_port_and_start() { static void test_no_op_with_port_and_start(void) {
struct sockaddr_in addr; struct sockaddr_in addr;
grpc_tcp_server *s = grpc_tcp_server_create(); grpc_tcp_server *s = grpc_tcp_server_create();
LOG_TEST(); LOG_TEST();

@ -41,7 +41,7 @@
#define EXPECT_EQ(a, b) GPR_ASSERT((a) == (b)) #define EXPECT_EQ(a, b) GPR_ASSERT((a) == (b))
#define EXPECT_DOUBLE_EQ(a, b) GPR_ASSERT(fabs((a) - (b)) < 1e-9) #define EXPECT_DOUBLE_EQ(a, b) GPR_ASSERT(fabs((a) - (b)) < 1e-9)
static void no_regress_no_persist_test_1() { static void no_regress_no_persist_test_1(void) {
grpc_time_averaged_stats tas; grpc_time_averaged_stats tas;
grpc_time_averaged_stats_init(&tas, 1000, 0, 0.0); grpc_time_averaged_stats_init(&tas, 1000, 0, 0.0);
EXPECT_DOUBLE_EQ(1000, tas.aggregate_weighted_avg); EXPECT_DOUBLE_EQ(1000, tas.aggregate_weighted_avg);
@ -59,7 +59,7 @@ static void no_regress_no_persist_test_1() {
EXPECT_DOUBLE_EQ(1, tas.aggregate_total_weight); EXPECT_DOUBLE_EQ(1, tas.aggregate_total_weight);
} }
static void no_regress_no_persist_test_2() { static void no_regress_no_persist_test_2(void) {
grpc_time_averaged_stats tas; grpc_time_averaged_stats tas;
grpc_time_averaged_stats_init(&tas, 1000, 0, 0.0); grpc_time_averaged_stats_init(&tas, 1000, 0, 0.0);
EXPECT_DOUBLE_EQ(1000, tas.aggregate_weighted_avg); EXPECT_DOUBLE_EQ(1000, tas.aggregate_weighted_avg);
@ -75,7 +75,7 @@ static void no_regress_no_persist_test_2() {
EXPECT_DOUBLE_EQ(1, tas.aggregate_total_weight); EXPECT_DOUBLE_EQ(1, tas.aggregate_total_weight);
} }
static void no_regress_no_persist_test_3() { static void no_regress_no_persist_test_3(void) {
grpc_time_averaged_stats tas; grpc_time_averaged_stats tas;
grpc_time_averaged_stats_init(&tas, 1000, 0, 0.0); grpc_time_averaged_stats_init(&tas, 1000, 0, 0.0);
EXPECT_DOUBLE_EQ(1000, tas.aggregate_weighted_avg); EXPECT_DOUBLE_EQ(1000, tas.aggregate_weighted_avg);
@ -92,7 +92,7 @@ static void no_regress_no_persist_test_3() {
EXPECT_DOUBLE_EQ(2, tas.aggregate_total_weight); EXPECT_DOUBLE_EQ(2, tas.aggregate_total_weight);
} }
static void some_regress_no_persist_test() { static void some_regress_no_persist_test(void) {
grpc_time_averaged_stats tas; grpc_time_averaged_stats tas;
grpc_time_averaged_stats_init(&tas, 1000, 0.5, 0.0); grpc_time_averaged_stats_init(&tas, 1000, 0.5, 0.0);
EXPECT_DOUBLE_EQ(1000, tas.aggregate_weighted_avg); EXPECT_DOUBLE_EQ(1000, tas.aggregate_weighted_avg);
@ -105,7 +105,7 @@ static void some_regress_no_persist_test() {
EXPECT_DOUBLE_EQ(2.5, tas.aggregate_total_weight); EXPECT_DOUBLE_EQ(2.5, tas.aggregate_total_weight);
} }
static void some_decay_test() { static void some_decay_test(void) {
grpc_time_averaged_stats tas; grpc_time_averaged_stats tas;
grpc_time_averaged_stats_init(&tas, 1000, 1, 0.0); grpc_time_averaged_stats_init(&tas, 1000, 1, 0.0);
EXPECT_EQ(1000, tas.aggregate_weighted_avg); EXPECT_EQ(1000, tas.aggregate_weighted_avg);
@ -126,7 +126,7 @@ static void some_decay_test() {
EXPECT_DOUBLE_EQ(2, tas.aggregate_total_weight); EXPECT_DOUBLE_EQ(2, tas.aggregate_total_weight);
} }
static void no_regress_full_persist_test() { static void no_regress_full_persist_test(void) {
grpc_time_averaged_stats tas; grpc_time_averaged_stats tas;
grpc_time_averaged_stats_init(&tas, 1000, 0, 1.0); grpc_time_averaged_stats_init(&tas, 1000, 0, 1.0);
EXPECT_DOUBLE_EQ(1000, tas.aggregate_weighted_avg); EXPECT_DOUBLE_EQ(1000, tas.aggregate_weighted_avg);
@ -146,7 +146,7 @@ static void no_regress_full_persist_test() {
EXPECT_DOUBLE_EQ(3, tas.aggregate_total_weight); EXPECT_DOUBLE_EQ(3, tas.aggregate_total_weight);
} }
static void no_regress_some_persist_test() { static void no_regress_some_persist_test(void) {
grpc_time_averaged_stats tas; grpc_time_averaged_stats tas;
grpc_time_averaged_stats_init(&tas, 1000, 0, 0.5); grpc_time_averaged_stats_init(&tas, 1000, 0, 0.5);
/* Should replace init value */ /* Should replace init value */
@ -162,7 +162,7 @@ static void no_regress_some_persist_test() {
EXPECT_DOUBLE_EQ(2.5, tas.aggregate_total_weight); EXPECT_DOUBLE_EQ(2.5, tas.aggregate_total_weight);
} }
static void some_regress_some_persist_test() { static void some_regress_some_persist_test(void) {
grpc_time_averaged_stats tas; grpc_time_averaged_stats tas;
grpc_time_averaged_stats_init(&tas, 1000, 0.4, 0.6); grpc_time_averaged_stats_init(&tas, 1000, 0.4, 0.6);
/* Sample weight = 0 */ /* Sample weight = 0 */

@ -293,7 +293,7 @@ static void print_histogram(gpr_histogram *histogram) {
gpr_histogram_percentile(histogram, 99.9)); gpr_histogram_percentile(histogram, 99.9));
} }
static double now() { static double now(void) {
gpr_timespec tv = gpr_now(); gpr_timespec tv = gpr_now();
return 1e9 * tv.tv_sec + tv.tv_nsec; return 1e9 * tv.tv_sec + tv.tv_nsec;
} }

@ -125,7 +125,7 @@ secure_endpoint_create_fixture_tcp_socketpair_leftover(size_t slice_size) {
return f; return f;
} }
static void clean_up() {} static void clean_up(void) {}
static grpc_endpoint_test_config configs[] = { static grpc_endpoint_test_config configs[] = {
{"secure_ep/tcp_socketpair", {"secure_ep/tcp_socketpair",

@ -114,7 +114,7 @@ static size_t perform_read_iteration(size_t record_size) {
} }
/* Asserts that the log is empty. */ /* Asserts that the log is empty. */
static void assert_log_empty() { static void assert_log_empty(void) {
size_t bytes_available; size_t bytes_available;
census_log_init_reader(); census_log_init_reader();
GPR_ASSERT(census_log_read_next(&bytes_available) == NULL); GPR_ASSERT(census_log_read_next(&bytes_available) == NULL);
@ -345,7 +345,7 @@ static void setup_test(int circular_log) {
/* Attempts to create a record of invalid size (size > /* Attempts to create a record of invalid size (size >
CENSUS_LOG_MAX_RECORD_SIZE). */ CENSUS_LOG_MAX_RECORD_SIZE). */
void test_invalid_record_size() { void test_invalid_record_size(void) {
static const size_t INVALID_SIZE = CENSUS_LOG_MAX_RECORD_SIZE + 1; static const size_t INVALID_SIZE = CENSUS_LOG_MAX_RECORD_SIZE + 1;
static const size_t VALID_SIZE = 1; static const size_t VALID_SIZE = 1;
void* record; void* record;
@ -368,7 +368,7 @@ void test_invalid_record_size() {
/* Tests end_write() with a different size than what was specified in /* Tests end_write() with a different size than what was specified in
start_write(). */ start_write(). */
void test_end_write_with_different_size() { void test_end_write_with_different_size(void) {
static const size_t START_WRITE_SIZE = 10; static const size_t START_WRITE_SIZE = 10;
static const size_t END_WRITE_SIZE = 7; static const size_t END_WRITE_SIZE = 7;
void* record_written; void* record_written;
@ -388,7 +388,7 @@ void test_end_write_with_different_size() {
} }
/* Verifies that pending records are not available via read_next(). */ /* Verifies that pending records are not available via read_next(). */
void test_read_pending_record() { void test_read_pending_record(void) {
static const size_t PR_RECORD_SIZE = 1024; static const size_t PR_RECORD_SIZE = 1024;
size_t bytes_available; size_t bytes_available;
const void* record_read; const void* record_read;
@ -413,7 +413,7 @@ void test_read_pending_record() {
} }
/* Tries reading beyond pending write. */ /* Tries reading beyond pending write. */
void test_read_beyond_pending_record() { void test_read_beyond_pending_record(void) {
/* Start a write. */ /* Start a write. */
gpr_int32 incomplete_record_size = 10; gpr_int32 incomplete_record_size = 10;
gpr_int32 complete_record_size = 20; gpr_int32 complete_record_size = 20;
@ -452,7 +452,7 @@ void test_read_beyond_pending_record() {
/* Tests scenario where block being read is detached from a core and put on the /* Tests scenario where block being read is detached from a core and put on the
dirty list. */ dirty list. */
void test_detached_while_reading() { void test_detached_while_reading(void) {
static const size_t DWR_RECORD_SIZE = 10; static const size_t DWR_RECORD_SIZE = 10;
size_t bytes_available; size_t bytes_available;
const void* record_read; const void* record_read;
@ -488,7 +488,7 @@ void test_detached_while_reading() {
/* Fills non-circular log with records sized such that size is a multiple of /* Fills non-circular log with records sized such that size is a multiple of
CENSUS_LOG_MAX_RECORD_SIZE (no per-block fragmentation). */ CENSUS_LOG_MAX_RECORD_SIZE (no per-block fragmentation). */
void test_fill_log_no_fragmentation() { void test_fill_log_no_fragmentation(void) {
const int circular = 0; const int circular = 0;
printf("Starting test: fill log no fragmentation\n"); printf("Starting test: fill log no fragmentation\n");
setup_test(circular); setup_test(circular);
@ -498,7 +498,7 @@ void test_fill_log_no_fragmentation() {
/* Fills circular log with records sized such that size is a multiple of /* Fills circular log with records sized such that size is a multiple of
CENSUS_LOG_MAX_RECORD_SIZE (no per-block fragmentation). */ CENSUS_LOG_MAX_RECORD_SIZE (no per-block fragmentation). */
void test_fill_circular_log_no_fragmentation() { void test_fill_circular_log_no_fragmentation(void) {
const int circular = 1; const int circular = 1;
printf("Starting test: fill circular log no fragmentation\n"); printf("Starting test: fill circular log no fragmentation\n");
setup_test(circular); setup_test(circular);
@ -507,7 +507,7 @@ void test_fill_circular_log_no_fragmentation() {
} }
/* Fills non-circular log with records that may straddle end of a block. */ /* Fills non-circular log with records that may straddle end of a block. */
void test_fill_log_with_straddling_records() { void test_fill_log_with_straddling_records(void) {
const int circular = 0; const int circular = 0;
printf("Starting test: fill log with straddling records\n"); printf("Starting test: fill log with straddling records\n");
setup_test(circular); setup_test(circular);
@ -516,7 +516,7 @@ void test_fill_log_with_straddling_records() {
} }
/* Fills circular log with records that may straddle end of a block. */ /* Fills circular log with records that may straddle end of a block. */
void test_fill_circular_log_with_straddling_records() { void test_fill_circular_log_with_straddling_records(void) {
const int circular = 1; const int circular = 1;
printf("Starting test: fill circular log with straddling records\n"); printf("Starting test: fill circular log with straddling records\n");
setup_test(circular); setup_test(circular);
@ -526,7 +526,7 @@ void test_fill_circular_log_with_straddling_records() {
/* Tests scenario where multiple writers and a single reader are using a log /* Tests scenario where multiple writers and a single reader are using a log
that is configured to discard old records. */ that is configured to discard old records. */
void test_multiple_writers_circular_log() { void test_multiple_writers_circular_log(void) {
const int circular = 1; const int circular = 1;
printf("Starting test: multiple writers circular log\n"); printf("Starting test: multiple writers circular log\n");
setup_test(circular); setup_test(circular);
@ -536,7 +536,7 @@ void test_multiple_writers_circular_log() {
/* Tests scenario where multiple writers and a single reader are using a log /* Tests scenario where multiple writers and a single reader are using a log
that is configured to discard old records. */ that is configured to discard old records. */
void test_multiple_writers() { void test_multiple_writers(void) {
const int circular = 0; const int circular = 0;
printf("Starting test: multiple writers\n"); printf("Starting test: multiple writers\n");
setup_test(circular); setup_test(circular);
@ -545,7 +545,7 @@ void test_multiple_writers() {
} }
/* Repeat the straddling records and multiple writers tests with a small log. */ /* Repeat the straddling records and multiple writers tests with a small log. */
void test_small_log() { void test_small_log(void) {
size_t log_size; size_t log_size;
const int circular = 0; const int circular = 0;
printf("Starting test: small log\n"); printf("Starting test: small log\n");
@ -559,7 +559,7 @@ void test_small_log() {
census_log_shutdown(); census_log_shutdown();
} }
void test_performance() { void test_performance(void) {
int write_size = 1; int write_size = 1;
for (; write_size < CENSUS_LOG_MAX_RECORD_SIZE; write_size *= 2) { for (; write_size < CENSUS_LOG_MAX_RECORD_SIZE; write_size *= 2) {
gpr_timespec write_time; gpr_timespec write_time;

@ -41,7 +41,7 @@
#include "test/core/util/test_config.h" #include "test/core/util/test_config.h"
/* Tests census noop stubs in a simulated rpc flow */ /* Tests census noop stubs in a simulated rpc flow */
void test_census_stubs() { void test_census_stubs(void) {
census_op_id op_id; census_op_id op_id;
census_rpc_stats* stats = census_rpc_stats_create_empty(); census_rpc_stats* stats = census_rpc_stats_create_empty();
census_aggregated_rpc_stats data_map = {0, NULL}; census_aggregated_rpc_stats data_map = {0, NULL};

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save