Apply do {...} while(0) to the remaining macros.

pull/18986/head
Soheil Hassas Yeganeh 6 years ago
parent 70d5e5af17
commit 3bcae1e368
  1. 10
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h
  2. 10
      src/core/ext/transport/chttp2/transport/internal.h
  3. 22
      src/core/lib/iomgr/executor.cc
  4. 7
      src/core/lib/surface/call.h
  5. 18
      src/core/lib/surface/completion_queue.cc

@ -32,10 +32,12 @@ extern grpc_core::TraceFlag grpc_trace_cares_address_sorting;
extern grpc_core::TraceFlag grpc_trace_cares_resolver;
#define GRPC_CARES_TRACE_LOG(format, ...) \
if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_cares_resolver)) { \
gpr_log(GPR_DEBUG, "(c-ares resolver) " format, __VA_ARGS__); \
}
#define GRPC_CARES_TRACE_LOG(format, ...) \
do { \
if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_cares_resolver)) { \
gpr_log(GPR_DEBUG, "(c-ares resolver) " format, __VA_ARGS__); \
} \
} while (0)
typedef struct grpc_ares_request grpc_ares_request;

@ -771,10 +771,12 @@ void grpc_chttp2_complete_closure_step(grpc_chttp2_transport* t,
// extern grpc_core::TraceFlag grpc_http_trace;
// extern grpc_core::TraceFlag grpc_flowctl_trace;
#define GRPC_CHTTP2_IF_TRACING(stmt) \
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) { \
(stmt); \
}
#define GRPC_CHTTP2_IF_TRACING(stmt) \
do { \
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) { \
(stmt); \
} \
} while (0)
void grpc_chttp2_fake_status(grpc_chttp2_transport* t,
grpc_chttp2_stream* stream, grpc_error* error);

@ -36,15 +36,19 @@
#define MAX_DEPTH 2
#define EXECUTOR_TRACE(format, ...) \
if (GRPC_TRACE_FLAG_ENABLED(executor_trace)) { \
gpr_log(GPR_INFO, "EXECUTOR " format, __VA_ARGS__); \
}
#define EXECUTOR_TRACE0(str) \
if (GRPC_TRACE_FLAG_ENABLED(executor_trace)) { \
gpr_log(GPR_INFO, "EXECUTOR " str); \
}
#define EXECUTOR_TRACE(format, ...) \
do { \
if (GRPC_TRACE_FLAG_ENABLED(executor_trace)) { \
gpr_log(GPR_INFO, "EXECUTOR " format, __VA_ARGS__); \
} \
} while (0)
#define EXECUTOR_TRACE0(str) \
do { \
if (GRPC_TRACE_FLAG_ENABLED(executor_trace)) { \
gpr_log(GPR_INFO, "EXECUTOR " str); \
} \
} while (0)
namespace grpc_core {
namespace {

@ -102,8 +102,11 @@ void grpc_call_context_set(grpc_call* call, grpc_context_index elem,
void* grpc_call_context_get(grpc_call* call, grpc_context_index elem);
#define GRPC_CALL_LOG_BATCH(sev, call, ops, nops, tag) \
if (GRPC_TRACE_FLAG_ENABLED(grpc_api_trace)) \
grpc_call_log_batch(sev, call, ops, nops, tag)
do { \
if (GRPC_TRACE_FLAG_ENABLED(grpc_api_trace)) { \
grpc_call_log_batch(sev, call, ops, nops, tag); \
} \
} while (0)
uint8_t grpc_call_is_client(grpc_call* call);

@ -411,14 +411,16 @@ static const cq_vtable g_cq_vtable[] = {
grpc_core::TraceFlag grpc_cq_pluck_trace(false, "queue_pluck");
#define GRPC_SURFACE_TRACE_RETURNED_EVENT(cq, event) \
if (GRPC_TRACE_FLAG_ENABLED(grpc_api_trace) && \
(GRPC_TRACE_FLAG_ENABLED(grpc_cq_pluck_trace) || \
(event)->type != GRPC_QUEUE_TIMEOUT)) { \
char* _ev = grpc_event_string(event); \
gpr_log(GPR_INFO, "RETURN_EVENT[%p]: %s", cq, _ev); \
gpr_free(_ev); \
}
#define GRPC_SURFACE_TRACE_RETURNED_EVENT(cq, event) \
do { \
if (GRPC_TRACE_FLAG_ENABLED(grpc_api_trace) && \
(GRPC_TRACE_FLAG_ENABLED(grpc_cq_pluck_trace) || \
(event)->type != GRPC_QUEUE_TIMEOUT)) { \
char* _ev = grpc_event_string(event); \
gpr_log(GPR_INFO, "RETURN_EVENT[%p]: %s", cq, _ev); \
gpr_free(_ev); \
} \
} while (0)
static void on_pollset_shutdown_done(void* cq, grpc_error* error);

Loading…
Cancel
Save