Skip to content

Commit

Permalink
Silence "variable set but not used" warnings (#374)
Browse files Browse the repository at this point in the history
We still want these sanity checks, even if they're wasted work in release.
  • Loading branch information
graebm authored Apr 25, 2022
1 parent 9c61700 commit 4333519
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions source/h1_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ static void s_write_headers(struct aws_byte_buf *dst, const struct aws_http_head
wrote_all &= s_write_crlf(dst);
}
AWS_ASSERT(wrote_all);
(void)wrote_all;
}

int aws_h1_encoder_message_init_from_request(
Expand Down Expand Up @@ -506,6 +507,7 @@ static void s_populate_chunk_line_buffer(
}
wrote_chunk_line &= s_write_crlf(chunk_line);
AWS_ASSERT(wrote_chunk_line);
(void)wrote_chunk_line;
}

struct aws_h1_trailer *aws_h1_trailer_new(
Expand Down
10 changes: 10 additions & 0 deletions source/h2_frames.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ static void s_frame_priority_settings_encode(
writes_ok &= aws_byte_buf_write_u8(output, priority->weight);

AWS_ASSERT(writes_ok);
(void)writes_ok;
}

/***********************************************************************************************************************
Expand Down Expand Up @@ -279,6 +280,7 @@ static void s_frame_prefix_encode(
writes_ok &= aws_byte_buf_write_be32(output, stream_id);

AWS_ASSERT(writes_ok);
(void)writes_ok;
}

/***********************************************************************************************************************
Expand Down Expand Up @@ -444,6 +446,7 @@ int aws_h2_encode_data_frame(
*stream_window_size_peer -= (int32_t)payload_len;

AWS_ASSERT(writes_ok);
(void)writes_ok;
return AWS_OP_SUCCESS;

handle_waiting_for_more_space:
Expand Down Expand Up @@ -721,6 +724,7 @@ static void s_encode_single_header_block_frame(
}

AWS_ASSERT(writes_ok);
(void)writes_ok;

/* Success! Wrote entire frame. It's safe to change state now */
frame->state =
Expand Down Expand Up @@ -887,6 +891,7 @@ static int s_frame_prebuilt_encode(
struct aws_byte_cursor chunk = aws_byte_cursor_advance(&frame->cursor, chunk_len);
writes_ok &= aws_byte_buf_write_from_whole_cursor(output, chunk);
AWS_ASSERT(writes_ok);
(void)writes_ok;

if (frame->cursor.len == 0) {
*complete = true;
Expand Down Expand Up @@ -966,6 +971,7 @@ struct aws_h2_frame *aws_h2_frame_new_rst_stream(
bool writes_ok = true;
writes_ok &= aws_byte_buf_write_be32(&frame->encoded_buf, error_code);
AWS_ASSERT(writes_ok);
(void)writes_ok;

return &frame->base;
}
Expand Down Expand Up @@ -1026,6 +1032,7 @@ struct aws_h2_frame *aws_h2_frame_new_settings(
writes_ok &= aws_byte_buf_write_be32(&frame->encoded_buf, settings_array[i].value);
}
AWS_ASSERT(writes_ok);
(void)writes_ok;

return &frame->base;
}
Expand Down Expand Up @@ -1059,6 +1066,7 @@ struct aws_h2_frame *aws_h2_frame_new_ping(
bool writes_ok = true;
writes_ok &= aws_byte_buf_write(&frame->encoded_buf, opaque_data, AWS_HTTP2_PING_DATA_SIZE);
AWS_ASSERT(writes_ok);
(void)writes_ok;

/* PING responses SHOULD be given higher priority than any other frame */
frame->base.high_priority = ack;
Expand Down Expand Up @@ -1117,6 +1125,7 @@ struct aws_h2_frame *aws_h2_frame_new_goaway(
writes_ok &= aws_byte_buf_write_be32(&frame->encoded_buf, error_code);
writes_ok &= aws_byte_buf_write_from_whole_cursor(&frame->encoded_buf, debug_data);
AWS_ASSERT(writes_ok);
(void)writes_ok;

return &frame->base;
}
Expand Down Expand Up @@ -1165,6 +1174,7 @@ struct aws_h2_frame *aws_h2_frame_new_window_update(
bool writes_ok = true;
writes_ok &= aws_byte_buf_write_be32(&frame->encoded_buf, window_size_increment);
AWS_ASSERT(writes_ok);
(void)writes_ok;

return &frame->base;
}
Expand Down
5 changes: 5 additions & 0 deletions source/http2_stream_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ static struct aws_h2_sm_connection *s_get_best_sm_connection_from_set(struct aws
sm_connection_a->num_streams_assigned > sm_connection_b->num_streams_assigned ? sm_connection_b
: sm_connection_a;
return errored == AWS_ERROR_SUCCESS ? chosen_connection : NULL;
(void)errored;
}

/* helper function for building the transaction: Try to assign connection for a pending stream acquisition */
Expand Down Expand Up @@ -239,6 +240,7 @@ static void s_sm_try_assign_connection_to_pending_stream_acquisition(
}
}
AWS_ASSERT(errored == 0 && "random access set went wrong");
(void)errored;
}

/* NOTE: never invoke with lock held */
Expand Down Expand Up @@ -498,6 +500,8 @@ static void s_sm_on_connection_acquired(struct aws_http_connection *connection,
} /* END CRITICAL SECTION */

AWS_ASSERT(!re_error && "connection acquired callback fails with programming errors");
(void)re_error;

/* Fail acquisitions if any */
s_finish_pending_stream_acquisitions_list_helper(
stream_manager, &stream_acquisitions_to_fail, stream_fail_error_code);
Expand Down Expand Up @@ -593,6 +597,7 @@ static void s_update_sm_connection_set_on_stream_finishes_synced(
re_error |= !added;
}
AWS_ASSERT(re_error == AWS_OP_SUCCESS);
(void)re_error;
}

static void s_sm_connection_on_scheduled_stream_finishes(
Expand Down

0 comments on commit 4333519

Please sign in to comment.