git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, brad@brad-smith.co.uk,
	sunshine@sunshineco.com, Derrick Stolee <dstolee@microsoft.com>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 2/3] graph: replace assert() with graph_assert() macro
Date: Tue, 7 Jan 2020 10:36:51 -0500	[thread overview]
Message-ID: <20200107153651.GB20591@coredump.intra.peff.net> (raw)
In-Reply-To: <5dd305d2f0de43a70b46336c8f1a62437e0511e1.1578408947.git.gitgitgadget@gmail.com>

On Tue, Jan 07, 2020 at 02:55:46PM +0000, Derrick Stolee via GitGitGadget wrote:

> From: Derrick Stolee <dstolee@microsoft.com>
> 
> The assert() macro is sometimes compiled out. Instead, switch these into
> BUG() statements using our own custom macro.
> 
> Reported-by: Eric Sunshine <sunshine@sunshineco.com>
> Signed-off-by: Derrick Stolee <dstolee@microsoft.com>

I can buy the argument that compiling with and without NDEBUG can lead
to confusion. But if that is the case, wouldn't it be so for all of the
assert() calls, not just ones in the graph code?

Previous discussions[1] seemed to conclude that having a kernel-style
BUG_ON() is probably the right way forward. I.e., replace this:

> +#define graph_assert(exp) if (!(exp)) { BUG("assert failed: "#exp""); }

with something similar in git-compat-util.h. Even if we don't convert
everybody to it immediately, it would be available for use.

At any rate, I think this patch (and the third one) can be post-v2.25.
But we'd want the first one before the release.

-Peff

[1] https://lore.kernel.org/git/20171122223827.26773-1-sbeller@google.com/

  reply	other threads:[~2020-01-07 15:36 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-07 14:55 [PATCH 0/3] Fix two bugs in graph.c Derrick Stolee via GitGitGadget
2020-01-07 14:55 ` [PATCH 1/3] graph: fix case that hit assert() Derrick Stolee via GitGitGadget
2020-01-07 15:30   ` Jeff King
2020-01-07 18:47     ` Derrick Stolee
2020-01-07 19:21     ` Junio C Hamano
2020-01-07 19:31       ` Jeff King
2020-01-07 20:21         ` Junio C Hamano
2020-01-07 14:55 ` [PATCH 2/3] graph: replace assert() with graph_assert() macro Derrick Stolee via GitGitGadget
2020-01-07 15:36   ` Jeff King [this message]
2020-01-07 15:51     ` Eric Sunshine
2020-01-07 18:45       ` Derrick Stolee
2020-01-07 14:55 ` [PATCH 3/3] t4215: add bigger graph collapse test Derrick Stolee via GitGitGadget
2020-01-07 15:39   ` Jeff King
2020-01-07 18:02     ` Junio C Hamano
2020-01-07 18:04       ` Jeff King
2020-01-07 18:44         ` Derrick Stolee
2020-01-07 17:13 ` [PATCH 0/3] Fix two bugs in graph.c Junio C Hamano
2020-01-07 21:27 ` [PATCH v2 0/2] " Derrick Stolee via GitGitGadget
2020-01-07 21:27   ` [PATCH v2 1/2] graph: fix case that hit assert() Derrick Stolee via GitGitGadget
2020-01-07 21:50     ` Junio C Hamano
2020-01-08 17:34       ` Junio C Hamano
2020-01-08 19:14         ` Derrick Stolee
2020-01-07 21:27   ` [PATCH v2 2/2] graph: fix lack of color in horizontal lines Derrick Stolee via GitGitGadget
2020-01-07 21:51     ` 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=20200107153651.GB20591@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=brad@brad-smith.co.uk \
    --cc=dstolee@microsoft.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    --cc=sunshine@sunshineco.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).