Make everything compile for clang & gcc

reviewable/pr8842/r1
Craig Tiller 8 years ago
parent 7ce0bcdf0f
commit 28d776e9d2
  1. 13
      src/core/ext/transport/chttp2/transport/hpack_parser.c
  2. 4
      src/core/ext/transport/chttp2/transport/hpack_parser.h
  3. 9
      src/core/lib/transport/static_metadata.h
  4. 4
      test/core/transport/chttp2/hpack_parser_fuzzer_test.c
  5. 5
      test/core/transport/chttp2/hpack_parser_test.c
  6. 2
      tools/codegen/core/gen_static_metadata.py

@ -1615,15 +1615,14 @@ void grpc_chttp2_hpack_parser_destroy(grpc_exec_ctx *exec_ctx,
grpc_error *grpc_chttp2_hpack_parser_parse(grpc_exec_ctx *exec_ctx,
grpc_chttp2_hpack_parser *p,
grpc_slice_refcount *refcount,
const uint8_t *beg,
const uint8_t *end) {
grpc_slice slice) {
/* TODO(ctiller): limit the distance of end from beg, and perform multiple
steps in the event of a large chunk of data to limit
stack space usage when no tail call optimization is
available */
p->current_slice_refcount = refcount;
grpc_error *error = p->state(exec_ctx, p, beg, end);
p->current_slice_refcount = slice.refcount;
grpc_error *error = p->state(exec_ctx, p, GRPC_SLICE_START_PTR(slice),
GRPC_SLICE_END_PTR(slice));
p->current_slice_refcount = NULL;
return error;
}
@ -1659,9 +1658,7 @@ grpc_error *grpc_chttp2_header_parser_parse(grpc_exec_ctx *exec_ctx,
if (s != NULL) {
s->stats.incoming.header_bytes += GRPC_SLICE_LENGTH(slice);
}
grpc_error *error = grpc_chttp2_hpack_parser_parse(
exec_ctx, parser, slice.refcount, GRPC_SLICE_START_PTR(slice),
GRPC_SLICE_END_PTR(slice));
grpc_error *error = grpc_chttp2_hpack_parser_parse(exec_ctx, parser, slice);
if (error != GRPC_ERROR_NONE) {
GPR_TIMER_END("grpc_chttp2_hpack_parser_parse", 0);
return error;

@ -116,9 +116,7 @@ void grpc_chttp2_hpack_parser_set_has_priority(grpc_chttp2_hpack_parser *p);
grpc_error *grpc_chttp2_hpack_parser_parse(grpc_exec_ctx *exec_ctx,
grpc_chttp2_hpack_parser *p,
grpc_slice_refcount *refcount,
const uint8_t *beg,
const uint8_t *end);
grpc_slice slice);
/* wraps grpc_chttp2_hpack_parser_parse to provide a frame level parser for
the transport */

@ -549,10 +549,11 @@ typedef union {
} named;
} grpc_metadata_batch_callouts;
#define GRPC_BATCH_INDEX_OF(slice) \
(GRPC_IS_STATIC_METADATA_STRING((slice)) \
? GPR_CLAMP(GRPC_STATIC_METADATA_INDEX((slice)), 0, \
GRPC_BATCH_CALLOUTS_COUNT) \
#define GRPC_BATCH_INDEX_OF(slice) \
(GRPC_IS_STATIC_METADATA_STRING((slice)) \
? (grpc_metadata_batch_callouts_index)GPR_CLAMP( \
GRPC_STATIC_METADATA_INDEX((slice)), 0, \
GRPC_BATCH_CALLOUTS_COUNT) \
: GRPC_BATCH_CALLOUTS_COUNT)
extern const uint8_t grpc_static_accept_encoding_metadata[8];

@ -57,8 +57,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_chttp2_hpack_parser_init(&exec_ctx, &parser);
parser.on_header = onhdr;
GRPC_ERROR_UNREF(
grpc_chttp2_hpack_parser_parse(&exec_ctx, &parser, data, data + size));
GRPC_ERROR_UNREF(grpc_chttp2_hpack_parser_parse(
&exec_ctx, &parser, grpc_slice_from_static_buffer(data, size)));
grpc_chttp2_hpack_parser_destroy(&exec_ctx, &parser);
grpc_exec_ctx_finish(&exec_ctx);
grpc_shutdown();

@ -76,9 +76,8 @@ static void test_vector(grpc_chttp2_hpack_parser *parser,
for (i = 0; i < nslices; i++) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
GPR_ASSERT(grpc_chttp2_hpack_parser_parse(
&exec_ctx, parser, GRPC_SLICE_START_PTR(slices[i]),
GRPC_SLICE_END_PTR(slices[i])) == GRPC_ERROR_NONE);
GPR_ASSERT(grpc_chttp2_hpack_parser_parse(&exec_ctx, parser, slices[i]) ==
GRPC_ERROR_NONE);
grpc_exec_ctx_finish(&exec_ctx);
}

@ -498,7 +498,7 @@ print >>H, ' } named;'
print >>H, '} grpc_metadata_batch_callouts;'
print >>H
print >>H, '#define GRPC_BATCH_INDEX_OF(slice) \\'
print >>H, ' (GRPC_IS_STATIC_METADATA_STRING((slice)) ? GPR_CLAMP(GRPC_STATIC_METADATA_INDEX((slice)), 0, GRPC_BATCH_CALLOUTS_COUNT) : GRPC_BATCH_CALLOUTS_COUNT)'
print >>H, ' (GRPC_IS_STATIC_METADATA_STRING((slice)) ? (grpc_metadata_batch_callouts_index)GPR_CLAMP(GRPC_STATIC_METADATA_INDEX((slice)), 0, GRPC_BATCH_CALLOUTS_COUNT) : GRPC_BATCH_CALLOUTS_COUNT)'
print >>H
print >>H, 'extern const uint8_t grpc_static_accept_encoding_metadata[%d];' % (1 << len(COMPRESSION_ALGORITHMS))

Loading…
Cancel
Save