Compile with --disable-assert

This commit is contained in:
Tatsuhiro Tsujikawa 2017-05-18 23:10:44 +09:00
parent 2bf3680d87
commit 1b442cb16f
12 changed files with 48 additions and 20 deletions

View File

@ -672,6 +672,9 @@ int nghttp2_frame_pack_altsvc(nghttp2_bufs *bufs, nghttp2_extension *frame) {
nghttp2_buf *buf;
nghttp2_ext_altsvc *altsvc;
/* This is required with --disable-assert. */
(void)rv;
altsvc = frame->payload;
buf = &bufs->head->buf;

View File

@ -180,6 +180,9 @@ ssize_t send_callback(nghttp2_session *session, const uint8_t *data,
void Http2Session::on_connect() {
int rv;
// This is required with --disable-assert.
(void)rv;
nghttp2_session_callbacks *callbacks;
nghttp2_session_callbacks_new(&callbacks);

View File

@ -172,6 +172,8 @@ Request::~Request() { nghttp2_gzip_inflate_del(inflater); }
void Request::init_inflater() {
int rv;
// This is required with --disable-assert.
(void)rv;
rv = nghttp2_gzip_inflate_new(&inflater);
assert(rv == 0);
}

View File

@ -43,14 +43,14 @@ static size_t deflate_data(uint8_t *out, size_t outlen, const uint8_t *in,
zst.opaque = Z_NULL;
rv = deflateInit(&zst, Z_DEFAULT_COMPRESSION);
assert(rv == Z_OK);
CU_ASSERT(rv == Z_OK);
zst.avail_in = (unsigned int)inlen;
zst.next_in = (uint8_t *)in;
zst.avail_out = (unsigned int)outlen;
zst.next_out = out;
rv = deflate(&zst, Z_SYNC_FLUSH);
assert(rv == Z_OK);
CU_ASSERT(rv == Z_OK);
deflateEnd(&zst);

View File

@ -3613,6 +3613,7 @@ StringRef strproto(shrpx_proto proto) {
// gcc needs this.
assert(0);
abort();
}
namespace {

View File

@ -163,14 +163,14 @@ void test_shrpx_config_parse_log_format(void) {
void test_shrpx_config_read_tls_ticket_key_file(void) {
char file1[] = "/tmp/nghttpx-unittest.XXXXXX";
auto fd1 = mkstemp(file1);
assert(fd1 != -1);
assert(48 ==
write(fd1, "0..............12..............34..............5", 48));
CU_ASSERT(fd1 != -1);
CU_ASSERT(48 ==
write(fd1, "0..............12..............34..............5", 48));
char file2[] = "/tmp/nghttpx-unittest.XXXXXX";
auto fd2 = mkstemp(file2);
assert(fd2 != -1);
assert(48 ==
write(fd2, "6..............78..............9a..............b", 48));
CU_ASSERT(fd2 != -1);
CU_ASSERT(48 ==
write(fd2, "6..............78..............9a..............b", 48));
close(fd1);
close(fd2);
@ -204,16 +204,18 @@ void test_shrpx_config_read_tls_ticket_key_file(void) {
void test_shrpx_config_read_tls_ticket_key_file_aes_256(void) {
char file1[] = "/tmp/nghttpx-unittest.XXXXXX";
auto fd1 = mkstemp(file1);
assert(fd1 != -1);
assert(80 == write(fd1, "0..............12..............................34..."
"...........................5",
80));
CU_ASSERT(fd1 != -1);
CU_ASSERT(80 == write(fd1,
"0..............12..............................34..."
"...........................5",
80));
char file2[] = "/tmp/nghttpx-unittest.XXXXXX";
auto fd2 = mkstemp(file2);
assert(fd2 != -1);
assert(80 == write(fd2, "6..............78..............................9a..."
"...........................b",
80));
CU_ASSERT(fd2 != -1);
CU_ASSERT(80 == write(fd2,
"6..............78..............................9a..."
"...........................b",
80));
close(fd1);
close(fd2);

View File

@ -204,6 +204,7 @@ int DNSResolver::handle_event(int rfd, int wfd) {
default:
// Unreachable
assert(0);
abort();
}
}

View File

@ -250,6 +250,7 @@ int DNSTracker::resolve(Address *result, DNSQuery *dnsq) {
return DNS_STATUS_OK;
default:
assert(0);
abort();
}
}

View File

@ -158,6 +158,8 @@ Downstream *DownstreamQueue::remove_and_get_blocked(Downstream *downstream,
auto next_downstream = link->downstream;
auto link2 = next_downstream->detach_blocked_link();
// This is required with --disable-assert.
(void)link2;
assert(link2 == link);
ent.blocked.remove(link);
delete link;

View File

@ -334,6 +334,7 @@ int Http2Session::resolve_name() {
return 0;
default:
assert(0);
abort();
}
}
@ -2115,7 +2116,10 @@ int Http2Session::write_tls() {
for (;;) {
if (wb_.rleft() > 0) {
auto iovcnt = wb_.riovec(&iov, 1);
assert(iovcnt == 1);
if (iovcnt != 1) {
assert(0);
return -1;
}
auto nwrite = conn_.write_tls(iov.iov_base, iov.iov_len);
if (nwrite == 0) {

View File

@ -1307,7 +1307,10 @@ int HttpDownstreamConnection::write_tls() {
while (input->rleft() > 0) {
auto iovcnt = input->riovec(&iov, 1);
assert(iovcnt == 1);
if (iovcnt != 1) {
assert(0);
return -1;
}
auto nwrite = conn_.write_tls(iov.iov_base, iov.iov_len);
if (nwrite == 0) {

View File

@ -478,7 +478,10 @@ int LiveCheck::write_tls() {
for (;;) {
if (wb_.rleft() > 0) {
auto iovcnt = wb_.riovec(&iov, 1);
assert(iovcnt == 1);
if (iovcnt != 1) {
assert(0);
return -1;
}
auto nwrite = conn_.write_tls(iov.iov_base, iov.iov_len);
if (nwrite == 0) {
@ -544,7 +547,10 @@ int LiveCheck::write_clear() {
for (;;) {
if (wb_.rleft() > 0) {
auto iovcnt = wb_.riovec(&iov, 1);
assert(iovcnt == 1);
if (iovcnt != 1) {
assert(0);
return -1;
}
auto nwrite = conn_.write_clear(iov.iov_base, iov.iov_len);
if (nwrite == 0) {