git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: "Carlo Marcelo Arenas Belón" <carenas@gmail.com>
Cc: git@vger.kernel.org, hanwen@google.com
Subject: Re: [PATCH 3/3] fixup! reftable: add a heap-based priority queue for reftable records
Date: Thu, 2 Sep 2021 05:09:48 -0400	[thread overview]
Message-ID: <YTCU3F+0sKcrym6F@coredump.intra.peff.net> (raw)
In-Reply-To: <20210902053023.44006-4-carenas@gmail.com>

On Wed, Sep 01, 2021 at 10:30:23PM -0700, Carlo Marcelo Arenas Belón wrote:

> diff --git a/reftable/pq.c b/reftable/pq.c
> index 8918d158e2..a6acca006b 100644
> --- a/reftable/pq.c
> +++ b/reftable/pq.c
> @@ -43,12 +43,14 @@ int merged_iter_pqueue_is_empty(struct merged_iter_pqueue pq)
>  
>  void merged_iter_pqueue_check(struct merged_iter_pqueue pq)
>  {
> +#ifndef NDEBUG
>  	int i = 0;
>  	for (i = 1; i < pq.len; i++) {
>  		int parent = (i - 1) / 2;
>  
>  		assert(pq_less(pq.heap[parent], pq.heap[i]));
>  	}
> +#endif
>  }

This will trigger -Wunused-parameter warnings, since the function body
is now empty when NDEBUG is undefined. Probably switching the assert()
to die() would be better, since the whole point of the function is just
to exit on error.

If there's a problem using die() from the reftable code, it could also
return an error and the caller in the test helper could propagate it.

-Peff

  reply	other threads:[~2021-09-02  9:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-02  5:30 [PATCH 0/3] hn/reftable: fixes for building with -DNDEBUG Carlo Marcelo Arenas Belón
2021-09-02  5:30 ` [PATCH 1/3] fixup! refs: RFC: Reftable support for git-core Carlo Marcelo Arenas Belón
2021-09-02  9:05   ` Jeff King
2021-09-02  9:26     ` Han-Wen Nienhuys
2021-09-02  5:30 ` [PATCH 2/3] fixup! reftable: add merged table view Carlo Marcelo Arenas Belón
2021-09-02  5:30 ` [PATCH 3/3] fixup! reftable: add a heap-based priority queue for reftable records Carlo Marcelo Arenas Belón
2021-09-02  9:09   ` Jeff King [this message]
2021-09-02 20:08     ` Junio C Hamano
2021-09-02 22:40       ` Jeff King
2021-09-03  4:42         ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YTCU3F+0sKcrym6F@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=carenas@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=hanwen@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).