Fix asan issue, ignore invalid-source-encoding warning when building c-ares with clang

pull/7704/head
Yuchen Zeng 9 years ago
parent 8917aecf56
commit d284493a63
  1. 3
      Makefile
  2. 28
      src/core/ext/resolver/dns/c_ares/grpc_ares_wrapper.c
  3. 3
      templates/Makefile.template

@ -676,6 +676,7 @@ ifeq ($(HAS_EMBEDDED_CARES),true)
CARES_DEP = $(LIBDIR)/$(CONFIG)/c-ares/libcares.a
CPPFLAGS := -Ithird_party/c-ares $(CPPFLAGS)
LDFLAGS := -L$(LIBDIR)/$(CONFIG)/c-ares $(LDFLAGS)
CARES_CFLAGS_EXTRA = -Wno-invalid-source-encoding
else
DEP_MISSING += c-ares
endif
@ -1242,7 +1243,7 @@ $(LIBDIR)/$(CONFIG)/protobuf/libprotobuf.a: third_party/protobuf/configure
third_party/c-ares/configure:
$(E) "[AUTOGEN] Preparing c-ares"
$(Q)(cd third_party/c-ares; ./buildconf; CC="$(CC)" CXX="$(CXX)" LDFLAGS="$(LDFLAGS_$(CONFIG)) -g $(CARES_LDFLAGS_EXTRA)" CPPFLAGS="$(PIC_CPPFLAGS) $(CPPFLAGS_$(CONFIG)) -g $(CARES_CPPFLAGS_EXTRA)" ./configure)
$(Q)(cd third_party/c-ares; ./buildconf; CC="$(CC)" CXX="$(CXX)" LDFLAGS="$(LDFLAGS_$(CONFIG)) -g $(CARES_LDFLAGS_EXTRA)" CFLAGS="-g $(CARES_CFLAGS_EXTRA)" CPPFLAGS="$(PIC_CPPFLAGS) $(CPPFLAGS_$(CONFIG)) -g $(CARES_CPPFLAGS_EXTRA)" ./configure)
$(LIBDIR)/$(CONFIG)/c-ares/libcares.a: third_party/c-ares/configure
$(E) "[MAKE] Building c-ares"

@ -221,6 +221,8 @@ grpc_ares_request *grpc_resolve_address_ares_impl(
char *host;
char *port;
grpc_error *err;
grpc_ares_request *r = NULL;
grpc_ares_ev_driver *ev_driver;
if ((err = grpc_customized_resolve_address(name, default_port, addrs)) !=
GRPC_ERROR_CANCELLED) {
@ -228,25 +230,12 @@ grpc_ares_request *grpc_resolve_address_ares_impl(
return NULL;
}
grpc_ares_request *r = gpr_malloc(sizeof(grpc_ares_request));
r->name = gpr_strdup(name);
r->default_port = gpr_strdup(default_port);
r->on_done = on_done;
r->addrs_out = addrs;
err = grpc_ares_ev_driver_create(&r->ev_driver, pollset_set);
if (err != GRPC_ERROR_NONE) {
grpc_exec_ctx_sched(exec_ctx, on_done, err, NULL);
return NULL;
}
if (name[0] == 'u' && name[1] == 'n' && name[2] == 'i' && name[3] == 'x' &&
name[4] == ':' && name[5] != 0) {
grpc_exec_ctx_sched(exec_ctx, on_done,
grpc_resolve_unix_domain_address(name + 5, addrs),
NULL);
return r;
return NULL;
}
/* parse name, splitting it into host and port parts */
@ -265,6 +254,17 @@ grpc_ares_request *grpc_resolve_address_ares_impl(
} else if (try_fake_resolve(host, port, addrs)) {
grpc_exec_ctx_sched(exec_ctx, on_done, GRPC_ERROR_NONE, NULL);
} else {
err = grpc_ares_ev_driver_create(&ev_driver, pollset_set);
if (err != GRPC_ERROR_NONE) {
grpc_exec_ctx_sched(exec_ctx, on_done, err, NULL);
return NULL;
}
r = gpr_malloc(sizeof(grpc_ares_request));
r->ev_driver = ev_driver;
r->on_done = on_done;
r->addrs_out = addrs;
r->name = gpr_strdup(name);
r->default_port = gpr_strdup(default_port);
r->port = gpr_strdup(port);
r->host = gpr_strdup(host);
grpc_closure_init(&r->request_closure, request_resolving_address, r);

@ -564,6 +564,7 @@
CARES_DEP = $(LIBDIR)/$(CONFIG)/c-ares/libcares.a
CPPFLAGS := -Ithird_party/c-ares $(CPPFLAGS)
LDFLAGS := -L$(LIBDIR)/$(CONFIG)/c-ares $(LDFLAGS)
CARES_CFLAGS_EXTRA = -Wno-invalid-source-encoding
else
DEP_MISSING += c-ares
endif
@ -884,7 +885,7 @@
third_party/c-ares/configure:
$(E) "[AUTOGEN] Preparing c-ares"
$(Q)(cd third_party/c-ares; ./buildconf; CC="$(CC)" CXX="$(CXX)" LDFLAGS="$(LDFLAGS_$(CONFIG)) -g $(CARES_LDFLAGS_EXTRA)" CPPFLAGS="$(PIC_CPPFLAGS) $(CPPFLAGS_$(CONFIG)) -g $(CARES_CPPFLAGS_EXTRA)" ./configure)
$(Q)(cd third_party/c-ares; ./buildconf; CC="$(CC)" CXX="$(CXX)" LDFLAGS="$(LDFLAGS_$(CONFIG)) -g $(CARES_LDFLAGS_EXTRA)" CFLAGS="-g $(CARES_CFLAGS_EXTRA)" CPPFLAGS="$(PIC_CPPFLAGS) $(CPPFLAGS_$(CONFIG)) -g $(CARES_CPPFLAGS_EXTRA)" ./configure)
$(LIBDIR)/$(CONFIG)/c-ares/libcares.a: third_party/c-ares/configure
$(E) "[MAKE] Building c-ares"

Loading…
Cancel
Save