aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/support
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2017-10-05 10:28:15 -0700
committerGravatar Craig Tiller <ctiller@google.com>2017-10-05 10:28:15 -0700
commit529102373061d599f861528e180bfdc2860f6b5f (patch)
tree2e4fc843fa7a093e3128fccddbbe795136f91acc /src/core/lib/support
parent76eab735f41baf8dd8af6524a8ce673a5803f5d4 (diff)
parentc277fc0818eb2e7408db6758c9690bb4eb2c6ff7 (diff)
Merge github.com:grpc/grpc into flowctl+millis
Diffstat (limited to 'src/core/lib/support')
-rw-r--r--src/core/lib/support/alloc.cc (renamed from src/core/lib/support/alloc.c)0
-rw-r--r--src/core/lib/support/arena.cc (renamed from src/core/lib/support/arena.c)0
-rw-r--r--src/core/lib/support/arena.h8
-rw-r--r--src/core/lib/support/atm.cc (renamed from src/core/lib/support/atm.c)0
-rw-r--r--src/core/lib/support/avl.cc (renamed from src/core/lib/support/avl.c)0
-rw-r--r--src/core/lib/support/cmdline.cc (renamed from src/core/lib/support/cmdline.c)0
-rw-r--r--src/core/lib/support/cpu_iphone.cc (renamed from src/core/lib/support/cpu_iphone.c)2
-rw-r--r--src/core/lib/support/cpu_linux.cc (renamed from src/core/lib/support/cpu_linux.c)0
-rw-r--r--src/core/lib/support/cpu_posix.cc (renamed from src/core/lib/support/cpu_posix.c)1
-rw-r--r--src/core/lib/support/cpu_windows.cc (renamed from src/core/lib/support/cpu_windows.c)1
-rw-r--r--src/core/lib/support/env_linux.cc (renamed from src/core/lib/support/env_linux.c)0
-rw-r--r--src/core/lib/support/env_posix.cc (renamed from src/core/lib/support/env_posix.c)0
-rw-r--r--src/core/lib/support/env_windows.cc (renamed from src/core/lib/support/env_windows.c)2
-rw-r--r--src/core/lib/support/histogram.cc (renamed from src/core/lib/support/histogram.c)0
-rw-r--r--src/core/lib/support/host_port.cc (renamed from src/core/lib/support/host_port.c)0
-rw-r--r--src/core/lib/support/log.cc (renamed from src/core/lib/support/log.c)2
-rw-r--r--src/core/lib/support/log_android.cc (renamed from src/core/lib/support/log_android.c)0
-rw-r--r--src/core/lib/support/log_linux.cc (renamed from src/core/lib/support/log_linux.c)2
-rw-r--r--src/core/lib/support/log_posix.cc (renamed from src/core/lib/support/log_posix.c)4
-rw-r--r--src/core/lib/support/log_windows.cc (renamed from src/core/lib/support/log_windows.c)6
-rw-r--r--src/core/lib/support/mpscq.cc (renamed from src/core/lib/support/mpscq.c)0
-rw-r--r--src/core/lib/support/mpscq.h8
-rw-r--r--src/core/lib/support/murmur_hash.cc (renamed from src/core/lib/support/murmur_hash.c)0
-rw-r--r--src/core/lib/support/murmur_hash.h8
-rw-r--r--src/core/lib/support/spinlock.h5
-rw-r--r--src/core/lib/support/stack_lockfree.cc (renamed from src/core/lib/support/stack_lockfree.c)0
-rw-r--r--src/core/lib/support/stack_lockfree.h8
-rw-r--r--src/core/lib/support/string.cc (renamed from src/core/lib/support/string.c)1
-rw-r--r--src/core/lib/support/string_posix.cc (renamed from src/core/lib/support/string_posix.c)1
-rw-r--r--src/core/lib/support/string_util_windows.cc (renamed from src/core/lib/support/string_util_windows.c)11
-rw-r--r--src/core/lib/support/string_windows.cc (renamed from src/core/lib/support/string_windows.c)3
-rw-r--r--src/core/lib/support/string_windows.h8
-rw-r--r--src/core/lib/support/subprocess_posix.cc (renamed from src/core/lib/support/subprocess_posix.c)0
-rw-r--r--src/core/lib/support/subprocess_windows.cc (renamed from src/core/lib/support/subprocess_windows.c)2
-rw-r--r--src/core/lib/support/sync.cc (renamed from src/core/lib/support/sync.c)0
-rw-r--r--src/core/lib/support/sync_posix.cc (renamed from src/core/lib/support/sync_posix.c)0
-rw-r--r--src/core/lib/support/sync_windows.cc (renamed from src/core/lib/support/sync_windows.c)2
-rw-r--r--src/core/lib/support/thd.cc (renamed from src/core/lib/support/thd.c)0
-rw-r--r--src/core/lib/support/thd_posix.cc (renamed from src/core/lib/support/thd_posix.c)0
-rw-r--r--src/core/lib/support/thd_windows.cc (renamed from src/core/lib/support/thd_windows.c)2
-rw-r--r--src/core/lib/support/time.cc (renamed from src/core/lib/support/time.c)0
-rw-r--r--src/core/lib/support/time_posix.cc (renamed from src/core/lib/support/time_posix.c)2
-rw-r--r--src/core/lib/support/time_precise.cc (renamed from src/core/lib/support/time_precise.c)2
-rw-r--r--src/core/lib/support/time_precise.h8
-rw-r--r--src/core/lib/support/time_windows.cc (renamed from src/core/lib/support/time_windows.c)2
-rw-r--r--src/core/lib/support/tls_pthread.cc (renamed from src/core/lib/support/tls_pthread.c)0
-rw-r--r--src/core/lib/support/tmpfile_msys.cc (renamed from src/core/lib/support/tmpfile_msys.c)0
-rw-r--r--src/core/lib/support/tmpfile_posix.cc (renamed from src/core/lib/support/tmpfile_posix.c)0
-rw-r--r--src/core/lib/support/tmpfile_windows.cc (renamed from src/core/lib/support/tmpfile_windows.c)0
-rw-r--r--src/core/lib/support/wrap_memcpy.cc (renamed from src/core/lib/support/wrap_memcpy.c)2
50 files changed, 87 insertions, 16 deletions
diff --git a/src/core/lib/support/alloc.c b/src/core/lib/support/alloc.cc
index 886d69d64c..886d69d64c 100644
--- a/src/core/lib/support/alloc.c
+++ b/src/core/lib/support/alloc.cc
diff --git a/src/core/lib/support/arena.c b/src/core/lib/support/arena.cc
index 9e0f73ae3d..9e0f73ae3d 100644
--- a/src/core/lib/support/arena.c
+++ b/src/core/lib/support/arena.cc
diff --git a/src/core/lib/support/arena.h b/src/core/lib/support/arena.h
index 47f0e4d16b..8a50786348 100644
--- a/src/core/lib/support/arena.h
+++ b/src/core/lib/support/arena.h
@@ -27,6 +27,10 @@
#include <stddef.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct gpr_arena gpr_arena;
// Create an arena, with \a initial_size bytes in the first allocated buffer
@@ -36,4 +40,8 @@ void *gpr_arena_alloc(gpr_arena *arena, size_t size);
// Destroy an arena, returning the total number of bytes allocated
size_t gpr_arena_destroy(gpr_arena *arena);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* GRPC_CORE_LIB_SUPPORT_ARENA_H */
diff --git a/src/core/lib/support/atm.c b/src/core/lib/support/atm.cc
index 2f37d62f76..2f37d62f76 100644
--- a/src/core/lib/support/atm.c
+++ b/src/core/lib/support/atm.cc
diff --git a/src/core/lib/support/avl.c b/src/core/lib/support/avl.cc
index 0e28b24c98..0e28b24c98 100644
--- a/src/core/lib/support/avl.c
+++ b/src/core/lib/support/avl.cc
diff --git a/src/core/lib/support/cmdline.c b/src/core/lib/support/cmdline.cc
index 9fb80d4460..9fb80d4460 100644
--- a/src/core/lib/support/cmdline.c
+++ b/src/core/lib/support/cmdline.cc
diff --git a/src/core/lib/support/cpu_iphone.c b/src/core/lib/support/cpu_iphone.cc
index dfd69b9fd8..2847e03ba5 100644
--- a/src/core/lib/support/cpu_iphone.c
+++ b/src/core/lib/support/cpu_iphone.cc
@@ -18,6 +18,8 @@
#include <grpc/support/port_platform.h>
+#include <grpc/support/cpu.h>
+
#ifdef GPR_CPU_IPHONE
/* Probably 2 instead of 1, but see comment on gpr_cpu_current_cpu. */
diff --git a/src/core/lib/support/cpu_linux.c b/src/core/lib/support/cpu_linux.cc
index 2280668442..2280668442 100644
--- a/src/core/lib/support/cpu_linux.c
+++ b/src/core/lib/support/cpu_linux.cc
diff --git a/src/core/lib/support/cpu_posix.c b/src/core/lib/support/cpu_posix.cc
index a1ba8202a8..503a96b4c8 100644
--- a/src/core/lib/support/cpu_posix.c
+++ b/src/core/lib/support/cpu_posix.cc
@@ -24,6 +24,7 @@
#include <string.h>
#include <unistd.h>
+#include <grpc/support/cpu.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/useful.h>
diff --git a/src/core/lib/support/cpu_windows.c b/src/core/lib/support/cpu_windows.cc
index af26ff3679..8d89453403 100644
--- a/src/core/lib/support/cpu_windows.c
+++ b/src/core/lib/support/cpu_windows.cc
@@ -19,6 +19,7 @@
#include <grpc/support/port_platform.h>
#ifdef GPR_WINDOWS
+#include <grpc/support/cpu.h>
#include <grpc/support/log.h>
unsigned gpr_cpu_num_cores(void) {
diff --git a/src/core/lib/support/env_linux.c b/src/core/lib/support/env_linux.cc
index 4c45a977ca..4c45a977ca 100644
--- a/src/core/lib/support/env_linux.c
+++ b/src/core/lib/support/env_linux.cc
diff --git a/src/core/lib/support/env_posix.c b/src/core/lib/support/env_posix.cc
index b88822ca02..b88822ca02 100644
--- a/src/core/lib/support/env_posix.c
+++ b/src/core/lib/support/env_posix.cc
diff --git a/src/core/lib/support/env_windows.c b/src/core/lib/support/env_windows.cc
index 652eeb61c6..73c643c560 100644
--- a/src/core/lib/support/env_windows.c
+++ b/src/core/lib/support/env_windows.cc
@@ -45,7 +45,7 @@ char *gpr_getenv(const char *name) {
ret = GetEnvironmentVariable(tname, NULL, 0);
if (ret == 0) return NULL;
size = ret * (DWORD)sizeof(TCHAR);
- tresult = gpr_malloc(size);
+ tresult = (LPTSTR)gpr_malloc(size);
ret = GetEnvironmentVariable(tname, tresult, size);
gpr_free(tname);
if (ret == 0) {
diff --git a/src/core/lib/support/histogram.c b/src/core/lib/support/histogram.cc
index 6d5ead9aa6..6d5ead9aa6 100644
--- a/src/core/lib/support/histogram.c
+++ b/src/core/lib/support/histogram.cc
diff --git a/src/core/lib/support/host_port.c b/src/core/lib/support/host_port.cc
index 3302e574ab..3302e574ab 100644
--- a/src/core/lib/support/host_port.c
+++ b/src/core/lib/support/host_port.cc
diff --git a/src/core/lib/support/log.c b/src/core/lib/support/log.cc
index fadb4d9a2c..69f92e001c 100644
--- a/src/core/lib/support/log.c
+++ b/src/core/lib/support/log.cc
@@ -27,7 +27,7 @@
#include <stdio.h>
#include <string.h>
-extern void gpr_default_log(gpr_log_func_args *args);
+extern "C" void gpr_default_log(gpr_log_func_args *args);
static gpr_atm g_log_func = (gpr_atm)gpr_default_log;
static gpr_atm g_min_severity_to_print = GPR_LOG_VERBOSITY_UNSET;
diff --git a/src/core/lib/support/log_android.c b/src/core/lib/support/log_android.cc
index 6f1cec51f1..6f1cec51f1 100644
--- a/src/core/lib/support/log_android.c
+++ b/src/core/lib/support/log_android.cc
diff --git a/src/core/lib/support/log_linux.c b/src/core/lib/support/log_linux.cc
index 7755018693..0914acedf4 100644
--- a/src/core/lib/support/log_linux.c
+++ b/src/core/lib/support/log_linux.cc
@@ -56,7 +56,7 @@ void gpr_log(const char *file, int line, gpr_log_severity severity,
free(message);
}
-void gpr_default_log(gpr_log_func_args *args) {
+extern "C" void gpr_default_log(gpr_log_func_args *args) {
const char *final_slash;
char *prefix;
const char *display_file;
diff --git a/src/core/lib/support/log_posix.c b/src/core/lib/support/log_posix.cc
index 8b376fce41..38a136e646 100644
--- a/src/core/lib/support/log_posix.c
+++ b/src/core/lib/support/log_posix.cc
@@ -48,7 +48,7 @@ void gpr_log(const char *file, int line, gpr_log_severity severity,
} else if ((size_t)ret <= sizeof(buf) - 1) {
message = buf;
} else {
- message = allocated = gpr_malloc((size_t)ret + 1);
+ message = allocated = (char *)gpr_malloc((size_t)ret + 1);
va_start(args, format);
vsnprintf(message, (size_t)(ret + 1), format, args);
va_end(args);
@@ -57,7 +57,7 @@ void gpr_log(const char *file, int line, gpr_log_severity severity,
gpr_free(allocated);
}
-void gpr_default_log(gpr_log_func_args *args) {
+extern "C" void gpr_default_log(gpr_log_func_args *args) {
char *final_slash;
const char *display_file;
char time_buffer[64];
diff --git a/src/core/lib/support/log_windows.c b/src/core/lib/support/log_windows.cc
index 0fdab79ae6..ee52abea73 100644
--- a/src/core/lib/support/log_windows.c
+++ b/src/core/lib/support/log_windows.cc
@@ -47,7 +47,7 @@ void gpr_log(const char *file, int line, gpr_log_severity severity,
} else {
/* Allocate a new buffer, with space for the NUL terminator. */
size_t strp_buflen = (size_t)ret + 1;
- message = gpr_malloc(strp_buflen);
+ message = (char *)gpr_malloc(strp_buflen);
/* Print to the buffer. */
va_start(args, format);
@@ -65,8 +65,8 @@ void gpr_log(const char *file, int line, gpr_log_severity severity,
}
/* Simple starter implementation */
-void gpr_default_log(gpr_log_func_args *args) {
- char *final_slash;
+extern "C" void gpr_default_log(gpr_log_func_args *args) {
+ const char *final_slash;
const char *display_file;
char time_buffer[64];
time_t timer;
diff --git a/src/core/lib/support/mpscq.c b/src/core/lib/support/mpscq.cc
index e9f893988d..e9f893988d 100644
--- a/src/core/lib/support/mpscq.c
+++ b/src/core/lib/support/mpscq.cc
diff --git a/src/core/lib/support/mpscq.h b/src/core/lib/support/mpscq.h
index daa51768f7..ca63a044bb 100644
--- a/src/core/lib/support/mpscq.h
+++ b/src/core/lib/support/mpscq.h
@@ -23,6 +23,10 @@
#include <stdbool.h>
#include <stddef.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
// Multiple-producer single-consumer lock free queue, based upon the
// implementation from Dmitry Vyukov here:
// http://www.1024cores.net/home/lock-free-algorithms/queues/intrusive-mpsc-node-based-queue
@@ -50,4 +54,8 @@ gpr_mpscq_node *gpr_mpscq_pop(gpr_mpscq *q);
// Pop a node; sets *empty to true if the queue is empty, or false if it is not
gpr_mpscq_node *gpr_mpscq_pop_and_check_end(gpr_mpscq *q, bool *empty);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* GRPC_CORE_LIB_SUPPORT_MPSCQ_H */
diff --git a/src/core/lib/support/murmur_hash.c b/src/core/lib/support/murmur_hash.cc
index f06b970de7..f06b970de7 100644
--- a/src/core/lib/support/murmur_hash.c
+++ b/src/core/lib/support/murmur_hash.cc
diff --git a/src/core/lib/support/murmur_hash.h b/src/core/lib/support/murmur_hash.h
index 7510b4d09c..a4c642e49f 100644
--- a/src/core/lib/support/murmur_hash.h
+++ b/src/core/lib/support/murmur_hash.h
@@ -23,7 +23,15 @@
#include <stddef.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* compute the hash of key (length len) */
uint32_t gpr_murmur_hash3(const void *key, size_t len, uint32_t seed);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* GRPC_CORE_LIB_SUPPORT_MURMUR_HASH_H */
diff --git a/src/core/lib/support/spinlock.h b/src/core/lib/support/spinlock.h
index 37adda11b0..47584f6279 100644
--- a/src/core/lib/support/spinlock.h
+++ b/src/core/lib/support/spinlock.h
@@ -25,9 +25,14 @@
a concurrency code smell. */
typedef struct { gpr_atm atm; } gpr_spinlock;
+#ifdef __cplusplus
+#define GPR_SPINLOCK_INITIALIZER (gpr_spinlock{0})
+#else
#define GPR_SPINLOCK_INITIALIZER ((gpr_spinlock){0})
+#endif
#define GPR_SPINLOCK_STATIC_INITIALIZER \
{ 0 }
+
#define gpr_spinlock_trylock(lock) (gpr_atm_acq_cas(&(lock)->atm, 0, 1))
#define gpr_spinlock_unlock(lock) (gpr_atm_rel_store(&(lock)->atm, 0))
#define gpr_spinlock_lock(lock) \
diff --git a/src/core/lib/support/stack_lockfree.c b/src/core/lib/support/stack_lockfree.cc
index 0fb64ed001..0fb64ed001 100644
--- a/src/core/lib/support/stack_lockfree.c
+++ b/src/core/lib/support/stack_lockfree.cc
diff --git a/src/core/lib/support/stack_lockfree.h b/src/core/lib/support/stack_lockfree.h
index 6324211b72..706f63fbf6 100644
--- a/src/core/lib/support/stack_lockfree.h
+++ b/src/core/lib/support/stack_lockfree.h
@@ -21,6 +21,10 @@
#include <stddef.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct gpr_stack_lockfree gpr_stack_lockfree;
/* This stack must specify the maximum number of entries to track.
@@ -35,4 +39,8 @@ int gpr_stack_lockfree_push(gpr_stack_lockfree *, int entry);
/* Returns -1 on empty or the actual entry number */
int gpr_stack_lockfree_pop(gpr_stack_lockfree *stack);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* GRPC_CORE_LIB_SUPPORT_STACK_LOCKFREE_H */
diff --git a/src/core/lib/support/string.c b/src/core/lib/support/string.cc
index 6b172df82f..d55863892f 100644
--- a/src/core/lib/support/string.c
+++ b/src/core/lib/support/string.cc
@@ -27,6 +27,7 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
+#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
char *gpr_strdup(const char *src) {
diff --git a/src/core/lib/support/string_posix.c b/src/core/lib/support/string_posix.cc
index e768faf739..92de21a6e1 100644
--- a/src/core/lib/support/string_posix.c
+++ b/src/core/lib/support/string_posix.cc
@@ -25,6 +25,7 @@
#include <string.h>
#include <grpc/support/alloc.h>
+#include <grpc/support/string_util.h>
int gpr_asprintf(char **strp, const char *format, ...) {
va_list args;
diff --git a/src/core/lib/support/string_util_windows.c b/src/core/lib/support/string_util_windows.cc
index 2a03404448..b365512ee3 100644
--- a/src/core/lib/support/string_util_windows.c
+++ b/src/core/lib/support/string_util_windows.cc
@@ -26,15 +26,18 @@
anything else, especially strsafe.h. */
#include <wchar.h>
+#include <inttypes.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <strsafe.h>
#include <grpc/support/alloc.h>
+#include <grpc/support/log_windows.h>
#include <grpc/support/string_util.h>
#include "src/core/lib/support/string.h"
+#include "src/core/lib/support/string_windows.h"
#if defined UNICODE || defined _UNICODE
LPTSTR
@@ -42,7 +45,7 @@ gpr_char_to_tchar(LPCSTR input) {
LPTSTR ret;
int needed = MultiByteToWideChar(CP_UTF8, 0, input, -1, NULL, 0);
if (needed <= 0) return NULL;
- ret = gpr_malloc((unsigned)needed * sizeof(TCHAR));
+ ret = (LPTSTR)gpr_malloc((unsigned)needed * sizeof(TCHAR));
MultiByteToWideChar(CP_UTF8, 0, input, -1, ret, needed);
return ret;
}
@@ -52,14 +55,14 @@ gpr_tchar_to_char(LPCTSTR input) {
LPSTR ret;
int needed = WideCharToMultiByte(CP_UTF8, 0, input, -1, NULL, 0, NULL, NULL);
if (needed <= 0) return NULL;
- ret = gpr_malloc((unsigned)needed);
+ ret = (LPSTR)gpr_malloc((unsigned)needed);
WideCharToMultiByte(CP_UTF8, 0, input, -1, ret, needed, NULL, NULL);
return ret;
}
#else
-char *gpr_tchar_to_char(LPTSTR input) { return gpr_strdup(input); }
+LPSTR gpr_tchar_to_char(LPCTSTR input) { return (LPSTR)gpr_strdup(input); }
-char *gpr_char_to_tchar(LPTSTR input) { return gpr_strdup(input); }
+LPTSTR gpr_char_to_tchar(LPCTSTR input) { return (LPTSTR)gpr_strdup(input); }
#endif
char *gpr_format_message(int messageid) {
diff --git a/src/core/lib/support/string_windows.c b/src/core/lib/support/string_windows.cc
index 50278d9559..d37863c066 100644
--- a/src/core/lib/support/string_windows.c
+++ b/src/core/lib/support/string_windows.cc
@@ -27,6 +27,7 @@
#include <string.h>
#include <grpc/support/alloc.h>
+#include <grpc/support/string_util.h>
#include "src/core/lib/support/string.h"
@@ -46,7 +47,7 @@ int gpr_asprintf(char **strp, const char *format, ...) {
/* Allocate a new buffer, with space for the NUL terminator. */
strp_buflen = (size_t)ret + 1;
- if ((*strp = gpr_malloc(strp_buflen)) == NULL) {
+ if ((*strp = (char *)gpr_malloc(strp_buflen)) == NULL) {
/* This shouldn't happen, because gpr_malloc() calls abort(). */
return -1;
}
diff --git a/src/core/lib/support/string_windows.h b/src/core/lib/support/string_windows.h
index 7c7f31e7aa..6771647581 100644
--- a/src/core/lib/support/string_windows.h
+++ b/src/core/lib/support/string_windows.h
@@ -21,6 +21,10 @@
#include <grpc/support/port_platform.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#ifdef GPR_WINDOWS
/* These allocate new strings using gpr_malloc to convert from and to utf-8. */
@@ -29,4 +33,8 @@ LPSTR gpr_tchar_to_char(LPCTSTR input);
#endif /* GPR_WINDOWS */
+#ifdef __cplusplus
+}
+#endif
+
#endif /* GRPC_CORE_LIB_SUPPORT_STRING_WINDOWS_H */
diff --git a/src/core/lib/support/subprocess_posix.c b/src/core/lib/support/subprocess_posix.cc
index af75162ee9..af75162ee9 100644
--- a/src/core/lib/support/subprocess_posix.c
+++ b/src/core/lib/support/subprocess_posix.cc
diff --git a/src/core/lib/support/subprocess_windows.c b/src/core/lib/support/subprocess_windows.cc
index 7412f8d344..6769f1d3a4 100644
--- a/src/core/lib/support/subprocess_windows.c
+++ b/src/core/lib/support/subprocess_windows.cc
@@ -61,7 +61,7 @@ gpr_subprocess *gpr_subprocess_create(int argc, const char **argv) {
}
gpr_free(args_tchar);
- r = gpr_malloc(sizeof(gpr_subprocess));
+ r = (gpr_subprocess *)gpr_malloc(sizeof(gpr_subprocess));
memset(r, 0, sizeof(*r));
r->pi = pi;
return r;
diff --git a/src/core/lib/support/sync.c b/src/core/lib/support/sync.cc
index 994dcb0e14..994dcb0e14 100644
--- a/src/core/lib/support/sync.c
+++ b/src/core/lib/support/sync.cc
diff --git a/src/core/lib/support/sync_posix.c b/src/core/lib/support/sync_posix.cc
index 62d800b18c..62d800b18c 100644
--- a/src/core/lib/support/sync_posix.c
+++ b/src/core/lib/support/sync_posix.cc
diff --git a/src/core/lib/support/sync_windows.c b/src/core/lib/support/sync_windows.cc
index 008c5aecba..62fdd40af7 100644
--- a/src/core/lib/support/sync_windows.c
+++ b/src/core/lib/support/sync_windows.cc
@@ -104,7 +104,7 @@ struct run_once_func_arg {
void (*init_function)(void);
};
static BOOL CALLBACK run_once_func(gpr_once *once, void *v, void **pv) {
- struct run_once_func_arg *arg = v;
+ struct run_once_func_arg *arg = (struct run_once_func_arg *)v;
(*arg->init_function)();
return 1;
}
diff --git a/src/core/lib/support/thd.c b/src/core/lib/support/thd.cc
index ca62615d65..ca62615d65 100644
--- a/src/core/lib/support/thd.c
+++ b/src/core/lib/support/thd.cc
diff --git a/src/core/lib/support/thd_posix.c b/src/core/lib/support/thd_posix.cc
index 98afd10df7..98afd10df7 100644
--- a/src/core/lib/support/thd_posix.c
+++ b/src/core/lib/support/thd_posix.cc
diff --git a/src/core/lib/support/thd_windows.c b/src/core/lib/support/thd_windows.cc
index 54533e9412..1a82805dd9 100644
--- a/src/core/lib/support/thd_windows.c
+++ b/src/core/lib/support/thd_windows.cc
@@ -66,7 +66,7 @@ static DWORD WINAPI thread_body(void *v) {
int gpr_thd_new(gpr_thd_id *t, void (*thd_body)(void *arg), void *arg,
const gpr_thd_options *options) {
HANDLE handle;
- struct thd_info *info = gpr_malloc(sizeof(*info));
+ struct thd_info *info = (struct thd_info *)gpr_malloc(sizeof(*info));
info->body = thd_body;
info->arg = arg;
*t = 0;
diff --git a/src/core/lib/support/time.c b/src/core/lib/support/time.cc
index 6903674d75..6903674d75 100644
--- a/src/core/lib/support/time.c
+++ b/src/core/lib/support/time.cc
diff --git a/src/core/lib/support/time_posix.c b/src/core/lib/support/time_posix.cc
index 753a629e6e..3267ea6b54 100644
--- a/src/core/lib/support/time_posix.c
+++ b/src/core/lib/support/time_posix.cc
@@ -127,7 +127,9 @@ static gpr_timespec now_impl(gpr_clock_type clock) {
}
#endif
+extern "C" {
gpr_timespec (*gpr_now_impl)(gpr_clock_type clock_type) = now_impl;
+}
#ifdef GPR_LOW_LEVEL_COUNTERS
gpr_atm gpr_now_call_count;
diff --git a/src/core/lib/support/time_precise.c b/src/core/lib/support/time_precise.cc
index 6ce19e53cc..05ef7c59bc 100644
--- a/src/core/lib/support/time_precise.c
+++ b/src/core/lib/support/time_precise.cc
@@ -20,6 +20,8 @@
#include <grpc/support/time.h>
#include <stdio.h>
+#include "src/core/lib/support/time_precise.h"
+
#ifdef GRPC_TIMERS_RDTSC
#if defined(__i386__)
static void gpr_get_cycle_counter(int64_t int *clk) {
diff --git a/src/core/lib/support/time_precise.h b/src/core/lib/support/time_precise.h
index aa28d6d7c4..cb15cdf919 100644
--- a/src/core/lib/support/time_precise.h
+++ b/src/core/lib/support/time_precise.h
@@ -21,7 +21,15 @@
#include <grpc/support/time.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void gpr_precise_clock_init(void);
void gpr_precise_clock_now(gpr_timespec *clk);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* GRPC_CORE_LIB_SUPPORT_TIME_PRECISE_H */
diff --git a/src/core/lib/support/time_windows.c b/src/core/lib/support/time_windows.cc
index fb17e5c079..08c1b22964 100644
--- a/src/core/lib/support/time_windows.c
+++ b/src/core/lib/support/time_windows.cc
@@ -68,7 +68,9 @@ static gpr_timespec now_impl(gpr_clock_type clock) {
return now_tv;
}
+extern "C" {
gpr_timespec (*gpr_now_impl)(gpr_clock_type clock_type) = now_impl;
+}
gpr_timespec gpr_now(gpr_clock_type clock_type) {
return gpr_now_impl(clock_type);
diff --git a/src/core/lib/support/tls_pthread.c b/src/core/lib/support/tls_pthread.cc
index 9ebee577fe..9ebee577fe 100644
--- a/src/core/lib/support/tls_pthread.c
+++ b/src/core/lib/support/tls_pthread.cc
diff --git a/src/core/lib/support/tmpfile_msys.c b/src/core/lib/support/tmpfile_msys.cc
index 614c0a4a18..614c0a4a18 100644
--- a/src/core/lib/support/tmpfile_msys.c
+++ b/src/core/lib/support/tmpfile_msys.cc
diff --git a/src/core/lib/support/tmpfile_posix.c b/src/core/lib/support/tmpfile_posix.cc
index 7ad3af0a57..7ad3af0a57 100644
--- a/src/core/lib/support/tmpfile_posix.c
+++ b/src/core/lib/support/tmpfile_posix.cc
diff --git a/src/core/lib/support/tmpfile_windows.c b/src/core/lib/support/tmpfile_windows.cc
index 47b4510a72..47b4510a72 100644
--- a/src/core/lib/support/tmpfile_windows.c
+++ b/src/core/lib/support/tmpfile_windows.cc
diff --git a/src/core/lib/support/wrap_memcpy.c b/src/core/lib/support/wrap_memcpy.cc
index cff056dc3b..c2362bf5b8 100644
--- a/src/core/lib/support/wrap_memcpy.c
+++ b/src/core/lib/support/wrap_memcpy.cc
@@ -26,6 +26,7 @@
* Enable by setting LDFLAGS=-Wl,-wrap,memcpy when linking.
*/
+extern "C" {
#ifdef __linux__
#if defined(__x86_64__) && !defined(GPR_MUSL_LIBC_COMPAT)
__asm__(".symver memcpy,memcpy@GLIBC_2.2.5");
@@ -38,3 +39,4 @@ void *__wrap_memcpy(void *destination, const void *source, size_t num) {
}
#endif
#endif
+}