aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/support
diff options
context:
space:
mode:
Diffstat (limited to 'test/core/support')
-rw-r--r--test/core/support/BUILD72
-rw-r--r--test/core/support/alloc_test.cc (renamed from test/core/support/alloc_test.c)5
-rw-r--r--test/core/support/arena_test.cc (renamed from test/core/support/arena_test.c)4
-rw-r--r--test/core/support/avl_test.cc (renamed from test/core/support/avl_test.c)2
-rw-r--r--test/core/support/cmdline_test.cc (renamed from test/core/support/cmdline_test.c)78
-rw-r--r--test/core/support/cpu_test.cc (renamed from test/core/support/cpu_test.c)2
-rw-r--r--test/core/support/env_test.cc (renamed from test/core/support/env_test.c)0
-rw-r--r--test/core/support/histogram_test.cc (renamed from test/core/support/histogram_test.c)0
-rw-r--r--test/core/support/host_port_test.cc (renamed from test/core/support/host_port_test.c)0
-rw-r--r--test/core/support/log_test.cc (renamed from test/core/support/log_test.c)0
-rw-r--r--test/core/support/mpscq_test.cc (renamed from test/core/support/mpscq_test.c)6
-rw-r--r--test/core/support/murmur_hash_test.cc (renamed from test/core/support/murmur_hash_test.c)0
-rw-r--r--test/core/support/spinlock_test.cc (renamed from test/core/support/spinlock_test.c)9
-rw-r--r--test/core/support/stack_lockfree_test.cc (renamed from test/core/support/stack_lockfree_test.c)0
-rw-r--r--test/core/support/string_test.cc (renamed from test/core/support/string_test.c)0
-rw-r--r--test/core/support/sync_test.cc (renamed from test/core/support/sync_test.c)22
-rw-r--r--test/core/support/thd_test.cc (renamed from test/core/support/thd_test.c)2
-rw-r--r--test/core/support/time_test.cc (renamed from test/core/support/time_test.c)0
-rw-r--r--test/core/support/tls_test.cc (renamed from test/core/support/tls_test.c)0
-rw-r--r--test/core/support/useful_test.cc (renamed from test/core/support/useful_test.c)0
20 files changed, 107 insertions, 95 deletions
diff --git a/test/core/support/BUILD b/test/core/support/BUILD
index 3bdc1c4186..9d042fdc9f 100644
--- a/test/core/support/BUILD
+++ b/test/core/support/BUILD
@@ -20,8 +20,8 @@ grpc_package(name = "test/core/support")
grpc_cc_test(
name = "alloc_test",
- srcs = ["alloc_test.c"],
- language = "C",
+ srcs = ["alloc_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -30,8 +30,8 @@ grpc_cc_test(
grpc_cc_test(
name = "avl_test",
- srcs = ["avl_test.c"],
- language = "C",
+ srcs = ["avl_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -40,8 +40,8 @@ grpc_cc_test(
grpc_cc_test(
name = "cmdline_test",
- srcs = ["cmdline_test.c"],
- language = "C",
+ srcs = ["cmdline_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -50,8 +50,8 @@ grpc_cc_test(
grpc_cc_test(
name = "cpu_test",
- srcs = ["cpu_test.c"],
- language = "C",
+ srcs = ["cpu_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -60,8 +60,8 @@ grpc_cc_test(
grpc_cc_test(
name = "env_test",
- srcs = ["env_test.c"],
- language = "C",
+ srcs = ["env_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -70,8 +70,8 @@ grpc_cc_test(
grpc_cc_test(
name = "histogram_test",
- srcs = ["histogram_test.c"],
- language = "C",
+ srcs = ["histogram_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -80,8 +80,8 @@ grpc_cc_test(
grpc_cc_test(
name = "host_port_test",
- srcs = ["host_port_test.c"],
- language = "C",
+ srcs = ["host_port_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -90,8 +90,8 @@ grpc_cc_test(
grpc_cc_test(
name = "log_test",
- srcs = ["log_test.c"],
- language = "C",
+ srcs = ["log_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -100,8 +100,8 @@ grpc_cc_test(
grpc_cc_test(
name = "mpscq_test",
- srcs = ["mpscq_test.c"],
- language = "C",
+ srcs = ["mpscq_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -110,8 +110,8 @@ grpc_cc_test(
grpc_cc_test(
name = "murmur_hash_test",
- srcs = ["murmur_hash_test.c"],
- language = "C",
+ srcs = ["murmur_hash_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -120,8 +120,8 @@ grpc_cc_test(
grpc_cc_test(
name = "stack_lockfree_test",
- srcs = ["stack_lockfree_test.c"],
- language = "C",
+ srcs = ["stack_lockfree_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -130,8 +130,8 @@ grpc_cc_test(
grpc_cc_test(
name = "string_test",
- srcs = ["string_test.c"],
- language = "C",
+ srcs = ["string_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -140,8 +140,8 @@ grpc_cc_test(
grpc_cc_test(
name = "spinlock_test",
- srcs = ["spinlock_test.c"],
- language = "C",
+ srcs = ["spinlock_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -150,8 +150,8 @@ grpc_cc_test(
grpc_cc_test(
name = "sync_test",
- srcs = ["sync_test.c"],
- language = "C",
+ srcs = ["sync_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -160,8 +160,8 @@ grpc_cc_test(
grpc_cc_test(
name = "thd_test",
- srcs = ["thd_test.c"],
- language = "C",
+ srcs = ["thd_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -170,8 +170,8 @@ grpc_cc_test(
grpc_cc_test(
name = "time_test",
- srcs = ["time_test.c"],
- language = "C",
+ srcs = ["time_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -180,8 +180,8 @@ grpc_cc_test(
grpc_cc_test(
name = "tls_test",
- srcs = ["tls_test.c"],
- language = "C",
+ srcs = ["tls_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
@@ -190,8 +190,8 @@ grpc_cc_test(
grpc_cc_test(
name = "useful_test",
- srcs = ["useful_test.c"],
- language = "C",
+ srcs = ["useful_test.cc"],
+ language = "C++",
deps = [
"//:gpr",
"//test/core/util:gpr_test_util",
diff --git a/test/core/support/alloc_test.c b/test/core/support/alloc_test.cc
index 37f2c2ef42..ee590366b9 100644
--- a/test/core/support/alloc_test.c
+++ b/test/core/support/alloc_test.cc
@@ -41,8 +41,9 @@ static void test_custom_allocs() {
/* Restore and check we don't get funky values and that we don't leak */
gpr_set_allocation_functions(default_fns);
- GPR_ASSERT((void*)sizeof(*i) != (i = gpr_malloc(sizeof(*i))));
- GPR_ASSERT((void*)2 != (i = gpr_realloc(i, 2)));
+ GPR_ASSERT((void*)sizeof(*i) !=
+ (i = static_cast<char*>(gpr_malloc(sizeof(*i)))));
+ GPR_ASSERT((void*)2 != (i = static_cast<char*>(gpr_realloc(i, 2))));
gpr_free(i);
}
diff --git a/test/core/support/arena_test.c b/test/core/support/arena_test.cc
index d198c4053d..6c666af096 100644
--- a/test/core/support/arena_test.c
+++ b/test/core/support/arena_test.cc
@@ -50,7 +50,7 @@ static void test(const char* name, size_t init_size, const size_t* allocs,
gpr_free(s);
gpr_arena* a = gpr_arena_create(init_size);
- void** ps = gpr_zalloc(sizeof(*ps) * nallocs);
+ void** ps = static_cast<void**>(gpr_zalloc(sizeof(*ps) * nallocs));
for (size_t i = 0; i < nallocs; i++) {
ps[i] = gpr_arena_alloc(a, allocs[i]);
// ensure no duplicate results
@@ -81,7 +81,7 @@ typedef struct {
} concurrent_test_args;
static void concurrent_test_body(void* arg) {
- concurrent_test_args* a = arg;
+ concurrent_test_args* a = static_cast<concurrent_test_args*>(arg);
gpr_event_wait(&a->ev_start, gpr_inf_future(GPR_CLOCK_REALTIME));
for (size_t i = 0; i < concurrent_test_iterations(); i++) {
*(char*)gpr_arena_alloc(a->arena, 1) = (char)i;
diff --git a/test/core/support/avl_test.c b/test/core/support/avl_test.cc
index bd7487f6da..cd3a852e9d 100644
--- a/test/core/support/avl_test.c
+++ b/test/core/support/avl_test.cc
@@ -28,7 +28,7 @@
#include "test/core/util/test_config.h"
static int* box(int x) {
- int* b = gpr_malloc(sizeof(*b));
+ int* b = static_cast<int*>(gpr_malloc(sizeof(*b)));
*b = x;
return b;
}
diff --git a/test/core/support/cmdline_test.c b/test/core/support/cmdline_test.cc
index 8d6a372c13..5afaa2a60a 100644
--- a/test/core/support/cmdline_test.c
+++ b/test/core/support/cmdline_test.cc
@@ -30,7 +30,8 @@
static void test_simple_int(void) {
int x = 1;
gpr_cmdline* cl;
- char* args[] = {(char*)__FILE__, "-foo", "3"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("-foo"),
+ const_cast<char*>("3")};
LOG_TEST();
@@ -45,7 +46,7 @@ static void test_simple_int(void) {
static void test_eq_int(void) {
int x = 1;
gpr_cmdline* cl;
- char* args[] = {(char*)__FILE__, "-foo=3"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("-foo=3")};
LOG_TEST();
@@ -60,7 +61,8 @@ static void test_eq_int(void) {
static void test_2dash_int(void) {
int x = 1;
gpr_cmdline* cl;
- char* args[] = {(char*)__FILE__, "--foo", "3"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("--foo"),
+ const_cast<char*>("3")};
LOG_TEST();
@@ -75,7 +77,7 @@ static void test_2dash_int(void) {
static void test_2dash_eq_int(void) {
int x = 1;
gpr_cmdline* cl;
- char* args[] = {(char*)__FILE__, "--foo=3"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("--foo=3")};
LOG_TEST();
@@ -88,9 +90,10 @@ static void test_2dash_eq_int(void) {
}
static void test_simple_string(void) {
- char* x = NULL;
+ const char* x = NULL;
gpr_cmdline* cl;
- char* args[] = {(char*)__FILE__, "-foo", "3"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("-foo"),
+ const_cast<char*>("3")};
LOG_TEST();
@@ -103,9 +106,9 @@ static void test_simple_string(void) {
}
static void test_eq_string(void) {
- char* x = NULL;
+ const char* x = NULL;
gpr_cmdline* cl;
- char* args[] = {(char*)__FILE__, "-foo=3"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("-foo=3")};
LOG_TEST();
@@ -118,9 +121,10 @@ static void test_eq_string(void) {
}
static void test_2dash_string(void) {
- char* x = NULL;
+ const char* x = NULL;
gpr_cmdline* cl;
- char* args[] = {(char*)__FILE__, "--foo", "3"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("--foo"),
+ const_cast<char*>("3")};
LOG_TEST();
@@ -133,9 +137,9 @@ static void test_2dash_string(void) {
}
static void test_2dash_eq_string(void) {
- char* x = NULL;
+ const char* x = NULL;
gpr_cmdline* cl;
- char* args[] = {(char*)__FILE__, "--foo=3"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("--foo=3")};
LOG_TEST();
@@ -150,7 +154,7 @@ static void test_2dash_eq_string(void) {
static void test_flag_on(void) {
int x = 2;
gpr_cmdline* cl;
- char* args[] = {(char*)__FILE__, "--foo"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("--foo")};
LOG_TEST();
@@ -165,7 +169,7 @@ static void test_flag_on(void) {
static void test_flag_no(void) {
int x = 2;
gpr_cmdline* cl;
- char* args[] = {(char*)__FILE__, "--no-foo"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("--no-foo")};
LOG_TEST();
@@ -180,7 +184,7 @@ static void test_flag_no(void) {
static void test_flag_val_1(void) {
int x = 2;
gpr_cmdline* cl;
- char* args[] = {(char*)__FILE__, "--foo=1"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("--foo=1")};
LOG_TEST();
@@ -195,7 +199,7 @@ static void test_flag_val_1(void) {
static void test_flag_val_0(void) {
int x = 2;
gpr_cmdline* cl;
- char* args[] = {(char*)__FILE__, "--foo=0"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("--foo=0")};
LOG_TEST();
@@ -210,7 +214,7 @@ static void test_flag_val_0(void) {
static void test_flag_val_true(void) {
int x = 2;
gpr_cmdline* cl;
- char* args[] = {(char*)__FILE__, "--foo=true"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("--foo=true")};
LOG_TEST();
@@ -225,7 +229,7 @@ static void test_flag_val_true(void) {
static void test_flag_val_false(void) {
int x = 2;
gpr_cmdline* cl;
- char* args[] = {(char*)__FILE__, "--foo=false"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("--foo=false")};
LOG_TEST();
@@ -238,12 +242,14 @@ static void test_flag_val_false(void) {
}
static void test_many(void) {
- char* str = NULL;
+ const char* str = NULL;
int x = 0;
int flag = 2;
gpr_cmdline* cl;
- char* args[] = {(char*)__FILE__, "--str", "hello", "-x=4", "-no-flag"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("--str"),
+ const_cast<char*>("hello"), const_cast<char*>("-x=4"),
+ const_cast<char*>("-no-flag")};
LOG_TEST();
@@ -259,7 +265,7 @@ static void test_many(void) {
}
static void extra_arg_cb(void* user_data, const char* arg) {
- int* count = user_data;
+ int* count = static_cast<int*>(user_data);
GPR_ASSERT(arg != NULL);
GPR_ASSERT(strlen(arg) == 1);
GPR_ASSERT(arg[0] == 'a' + *count);
@@ -269,7 +275,8 @@ static void extra_arg_cb(void* user_data, const char* arg) {
static void test_extra(void) {
gpr_cmdline* cl;
int count = 0;
- char* args[] = {(char*)__FILE__, "a", "b", "c"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("a"),
+ const_cast<char*>("b"), const_cast<char*>("c")};
LOG_TEST();
@@ -284,7 +291,9 @@ static void test_extra(void) {
static void test_extra_dashdash(void) {
gpr_cmdline* cl;
int count = 0;
- char* args[] = {(char*)__FILE__, "--", "a", "b", "c"};
+ char* args[] = {(char*)__FILE__, const_cast<char*>("--"),
+ const_cast<char*>("a"), const_cast<char*>("b"),
+ const_cast<char*>("c")};
LOG_TEST();
@@ -300,7 +309,7 @@ static void test_usage(void) {
gpr_cmdline* cl;
char* usage;
- char* str = NULL;
+ const char* str = NULL;
int x = 0;
int flag = 2;
@@ -331,11 +340,11 @@ static void test_usage(void) {
static void test_help(void) {
gpr_cmdline* cl;
- char* str = NULL;
+ const char* str = NULL;
int x = 0;
int flag = 2;
- char* help[] = {(char*)__FILE__, "-h"};
+ char* help[] = {(char*)__FILE__, const_cast<char*>("-h")};
LOG_TEST();
@@ -355,11 +364,11 @@ static void test_help(void) {
static void test_badargs1(void) {
gpr_cmdline* cl;
- char* str = NULL;
+ const char* str = NULL;
int x = 0;
int flag = 2;
- char* bad_arg_name[] = {(char*)__FILE__, "--y"};
+ char* bad_arg_name[] = {(char*)__FILE__, const_cast<char*>("--y")};
LOG_TEST();
@@ -380,11 +389,12 @@ static void test_badargs1(void) {
static void test_badargs2(void) {
gpr_cmdline* cl;
- char* str = NULL;
+ const char* str = NULL;
int x = 0;
int flag = 2;
- char* bad_int_value[] = {(char*)__FILE__, "--x", "henry"};
+ char* bad_int_value[] = {(char*)__FILE__, const_cast<char*>("--x"),
+ const_cast<char*>("henry")};
LOG_TEST();
@@ -405,11 +415,11 @@ static void test_badargs2(void) {
static void test_badargs3(void) {
gpr_cmdline* cl;
- char* str = NULL;
+ const char* str = NULL;
int x = 0;
int flag = 2;
- char* bad_bool_value[] = {(char*)__FILE__, "--flag=henry"};
+ char* bad_bool_value[] = {(char*)__FILE__, const_cast<char*>("--flag=henry")};
LOG_TEST();
@@ -430,11 +440,11 @@ static void test_badargs3(void) {
static void test_badargs4(void) {
gpr_cmdline* cl;
- char* str = NULL;
+ const char* str = NULL;
int x = 0;
int flag = 2;
- char* bad_bool_value[] = {(char*)__FILE__, "--no-str"};
+ char* bad_bool_value[] = {(char*)__FILE__, const_cast<char*>("--no-str")};
LOG_TEST();
diff --git a/test/core/support/cpu_test.c b/test/core/support/cpu_test.cc
index 3c49486651..a76531ead9 100644
--- a/test/core/support/cpu_test.c
+++ b/test/core/support/cpu_test.cc
@@ -104,7 +104,7 @@ static void cpu_test(void) {
ct.ncores = gpr_cpu_num_cores();
GPR_ASSERT(ct.ncores > 0);
ct.nthreads = (int)ct.ncores * 3;
- ct.used = gpr_malloc(ct.ncores * sizeof(int));
+ ct.used = static_cast<int*>(gpr_malloc(ct.ncores * sizeof(int)));
memset(ct.used, 0, ct.ncores * sizeof(int));
gpr_mu_init(&ct.mu);
gpr_cv_init(&ct.done_cv);
diff --git a/test/core/support/env_test.c b/test/core/support/env_test.cc
index 54009536b4..54009536b4 100644
--- a/test/core/support/env_test.c
+++ b/test/core/support/env_test.cc
diff --git a/test/core/support/histogram_test.c b/test/core/support/histogram_test.cc
index 86b7d599e6..86b7d599e6 100644
--- a/test/core/support/histogram_test.c
+++ b/test/core/support/histogram_test.cc
diff --git a/test/core/support/host_port_test.c b/test/core/support/host_port_test.cc
index 42dd56524f..42dd56524f 100644
--- a/test/core/support/host_port_test.c
+++ b/test/core/support/host_port_test.cc
diff --git a/test/core/support/log_test.c b/test/core/support/log_test.cc
index 9602bbb090..9602bbb090 100644
--- a/test/core/support/log_test.c
+++ b/test/core/support/log_test.cc
diff --git a/test/core/support/mpscq_test.c b/test/core/support/mpscq_test.cc
index c71132bde9..d5b7bf21c1 100644
--- a/test/core/support/mpscq_test.c
+++ b/test/core/support/mpscq_test.cc
@@ -34,7 +34,7 @@ typedef struct test_node {
} test_node;
static test_node* new_node(size_t i, size_t* ctr) {
- test_node* n = gpr_malloc(sizeof(test_node));
+ test_node* n = static_cast<test_node*>(gpr_malloc(sizeof(test_node)));
n->i = i;
n->ctr = ctr;
return n;
@@ -64,7 +64,7 @@ typedef struct {
#define THREAD_ITERATIONS 10000
static void test_thread(void* args) {
- thd_args* a = args;
+ thd_args* a = static_cast<thd_args*>(args);
gpr_event_wait(a->start, gpr_inf_future(GPR_CLOCK_REALTIME));
for (size_t i = 1; i <= THREAD_ITERATIONS; i++) {
gpr_mpscq_push(a->q, &new_node(i, &a->ctr)->node);
@@ -119,7 +119,7 @@ typedef struct {
} pull_args;
static void pull_thread(void* arg) {
- pull_args* pa = arg;
+ pull_args* pa = static_cast<pull_args*>(arg);
gpr_event_wait(pa->start, gpr_inf_future(GPR_CLOCK_REALTIME));
for (;;) {
diff --git a/test/core/support/murmur_hash_test.c b/test/core/support/murmur_hash_test.cc
index 461c728951..461c728951 100644
--- a/test/core/support/murmur_hash_test.c
+++ b/test/core/support/murmur_hash_test.cc
diff --git a/test/core/support/spinlock_test.c b/test/core/support/spinlock_test.cc
index 185538ee93..3639802cd7 100644
--- a/test/core/support/spinlock_test.c
+++ b/test/core/support/spinlock_test.cc
@@ -43,9 +43,10 @@ struct test {
/* Return pointer to a new struct test. */
static struct test* test_new(int threads, int64_t iterations, int incr_step) {
- struct test* m = gpr_malloc(sizeof(*m));
+ struct test* m = static_cast<struct test*>(gpr_malloc(sizeof(*m)));
m->thread_count = threads;
- m->threads = gpr_malloc(sizeof(*m->threads) * (size_t)threads);
+ m->threads = static_cast<gpr_thd_id*>(
+ gpr_malloc(sizeof(*m->threads) * (size_t)threads));
m->iterations = iterations;
m->counter = 0;
m->thread_count = 0;
@@ -113,7 +114,7 @@ static void test(const char* name, void (*body)(void* m), int timeout_s,
/* Increment m->counter on each iteration; then mark thread as done. */
static void inc(void* v /*=m*/) {
- struct test* m = v;
+ struct test* m = static_cast<struct test*>(v);
int64_t i;
for (i = 0; i != m->iterations; i++) {
gpr_spinlock_lock(&m->mu);
@@ -125,7 +126,7 @@ static void inc(void* v /*=m*/) {
/* Increment m->counter under lock acquired with trylock, m->iterations times;
then mark thread as done. */
static void inctry(void* v /*=m*/) {
- struct test* m = v;
+ struct test* m = static_cast<struct test*>(v);
int64_t i;
for (i = 0; i != m->iterations;) {
if (gpr_spinlock_trylock(&m->mu)) {
diff --git a/test/core/support/stack_lockfree_test.c b/test/core/support/stack_lockfree_test.cc
index e6d0c9b795..e6d0c9b795 100644
--- a/test/core/support/stack_lockfree_test.c
+++ b/test/core/support/stack_lockfree_test.cc
diff --git a/test/core/support/string_test.c b/test/core/support/string_test.cc
index 4bae158a15..4bae158a15 100644
--- a/test/core/support/string_test.c
+++ b/test/core/support/string_test.cc
diff --git a/test/core/support/sync_test.c b/test/core/support/sync_test.cc
index b4436f7bba..416e94d06d 100644
--- a/test/core/support/sync_test.c
+++ b/test/core/support/sync_test.cc
@@ -157,7 +157,7 @@ struct test {
/* Return pointer to a new struct test. */
static struct test* test_new(int threads, int64_t iterations, int incr_step) {
- struct test* m = gpr_malloc(sizeof(*m));
+ struct test* m = static_cast<struct test*>(gpr_malloc(sizeof(*m)));
m->threads = threads;
m->iterations = iterations;
m->counter = 0;
@@ -263,7 +263,7 @@ static void test(const char* name, void (*body)(void* m),
/* Increment m->counter on each iteration; then mark thread as done. */
static void inc(void* v /*=m*/) {
- struct test* m = v;
+ struct test* m = static_cast<struct test*>(v);
int64_t i;
for (i = 0; i != m->iterations; i++) {
gpr_mu_lock(&m->mu);
@@ -276,7 +276,7 @@ static void inc(void* v /*=m*/) {
/* Increment m->counter under lock acquired with trylock, m->iterations times;
then mark thread as done. */
static void inctry(void* v /*=m*/) {
- struct test* m = v;
+ struct test* m = static_cast<struct test*>(v);
int64_t i;
for (i = 0; i != m->iterations;) {
if (gpr_mu_trylock(&m->mu)) {
@@ -291,7 +291,7 @@ static void inctry(void* v /*=m*/) {
/* Increment counter only when (m->counter%m->threads)==m->thread_id; then mark
thread as done. */
static void inc_by_turns(void* v /*=m*/) {
- struct test* m = v;
+ struct test* m = static_cast<struct test*>(v);
int64_t i;
int id = thread_id(m);
for (i = 0; i != m->iterations; i++) {
@@ -309,7 +309,7 @@ static void inc_by_turns(void* v /*=m*/) {
/* Wait a millisecond and increment counter on each iteration;
then mark thread as done. */
static void inc_with_1ms_delay(void* v /*=m*/) {
- struct test* m = v;
+ struct test* m = static_cast<struct test*>(v);
int64_t i;
for (i = 0; i != m->iterations; i++) {
gpr_timespec deadline;
@@ -327,7 +327,7 @@ static void inc_with_1ms_delay(void* v /*=m*/) {
/* Wait a millisecond and increment counter on each iteration, using an event
for timing; then mark thread as done. */
static void inc_with_1ms_delay_event(void* v /*=m*/) {
- struct test* m = v;
+ struct test* m = static_cast<struct test*>(v);
int64_t i;
for (i = 0; i != m->iterations; i++) {
gpr_timespec deadline;
@@ -345,7 +345,7 @@ static void inc_with_1ms_delay_event(void* v /*=m*/) {
Even threads use queue_append(), and odd threads use queue_try_append()
until it succeeds. */
static void many_producers(void* v /*=m*/) {
- struct test* m = v;
+ struct test* m = static_cast<struct test*>(v);
int64_t i;
int x = thread_id(m);
if ((x & 1) == 0) {
@@ -365,7 +365,7 @@ static void many_producers(void* v /*=m*/) {
wait an extra second to confirm that no more elements are arriving,
then mark thread as done. */
static void consumer(void* v /*=m*/) {
- struct test* m = v;
+ struct test* m = static_cast<struct test*>(v);
int64_t n = m->iterations * m->threads;
int64_t i;
int value;
@@ -385,7 +385,7 @@ static void consumer(void* v /*=m*/) {
/* Increment m->stats_counter m->iterations times, transfer counter value to
m->counter, then mark thread as done. */
static void statsinc(void* v /*=m*/) {
- struct test* m = v;
+ struct test* m = static_cast<struct test*>(v);
int64_t i;
for (i = 0; i != m->iterations; i++) {
gpr_stats_inc(&m->stats_counter, 1);
@@ -400,7 +400,7 @@ static void statsinc(void* v /*=m*/) {
m->thread_refcount once, and if it reaches zero, set m->event to (void*)1;
then mark thread as done. */
static void refinc(void* v /*=m*/) {
- struct test* m = v;
+ struct test* m = static_cast<struct test*>(v);
int64_t i;
for (i = 0; i != m->iterations; i++) {
if (m->incr_step == 1) {
@@ -419,7 +419,7 @@ static void refinc(void* v /*=m*/) {
(m->threads * m->iterations * m->incr_step) times, and ensure that the last
decrement caused the counter to reach zero, then mark thread as done. */
static void refcheck(void* v /*=m*/) {
- struct test* m = v;
+ struct test* m = static_cast<struct test*>(v);
int64_t n = m->iterations * m->threads * m->incr_step;
int64_t i;
GPR_ASSERT(gpr_event_wait(&m->event, gpr_inf_future(GPR_CLOCK_REALTIME)) ==
diff --git a/test/core/support/thd_test.c b/test/core/support/thd_test.cc
index 4fd0051776..f70a3b4fe2 100644
--- a/test/core/support/thd_test.c
+++ b/test/core/support/thd_test.cc
@@ -37,7 +37,7 @@ struct test {
/* A Thread body. Decrement t->n, and if is becomes zero, set t->done. */
static void thd_body(void* v) {
- struct test* t = v;
+ struct test* t = static_cast<struct test*>(v);
gpr_mu_lock(&t->mu);
t->n--;
if (t->n == 0) {
diff --git a/test/core/support/time_test.c b/test/core/support/time_test.cc
index 608169274f..608169274f 100644
--- a/test/core/support/time_test.c
+++ b/test/core/support/time_test.cc
diff --git a/test/core/support/tls_test.c b/test/core/support/tls_test.cc
index b1b4737432..b1b4737432 100644
--- a/test/core/support/tls_test.c
+++ b/test/core/support/tls_test.cc
diff --git a/test/core/support/useful_test.c b/test/core/support/useful_test.cc
index 2f86010d77..2f86010d77 100644
--- a/test/core/support/useful_test.c
+++ b/test/core/support/useful_test.cc