git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/3] graph: replace assert() with graph_assert() macro

From
Jeff King <peff@peff.net>
Date
Jan 7, 2020, 15:36 UTC
Message-ID
<20200107153651.GB20591@coredump.intra.peff.net>
In-Reply-To
<5dd305d2f0de43a70b46336c8f1a62437e0511e1.1578408947.git.gitgitgadget@gmail.com>
On Tue, Jan 07, 2020 at 02:55:46PM +0000, Derrick Stolee via GitGitGadget wrote:
Show 7 quoted lines
> 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/
Previous: Derrick Stolee via GitGitGadgetNext: Eric Sunshine
Message 3 of 24 in “Fix two bugs in graph.c”
  1. 0/3 Fix two bugs in graph.cDerrick Stolee via GitGitGadget, Jan 7, 2020
  2. 2/3 graph: replace assert() with graph_assert() macroDerrick Stolee via GitGitGadget, Jan 7, 2020
  3. Jeff KingJan 7, 2020
  4. Eric SunshineJan 7, 2020
  5. Derrick StoleeJan 7, 2020
  6. 1/3 graph: fix case that hit assert()Derrick Stolee via GitGitGadget, Jan 7, 2020
  7. Jeff KingJan 7, 2020
  8. Derrick StoleeJan 7, 2020
  9. Junio C HamanoJan 7, 2020
  10. Jeff KingJan 7, 2020
  11. Junio C HamanoJan 7, 2020
  12. 3/3 t4215: add bigger graph collapse testDerrick Stolee via GitGitGadget, Jan 7, 2020
  13. Jeff KingJan 7, 2020
  14. Junio C HamanoJan 7, 2020
  15. Jeff KingJan 7, 2020
  16. Derrick StoleeJan 7, 2020
  17. Junio C HamanoJan 7, 2020
  18. 0/2 Fix two bugs in graph.cDerrick Stolee via GitGitGadget, Jan 7, 2020
  19. 1/2 graph: fix case that hit assert()Derrick Stolee via GitGitGadget, Jan 7, 2020
  20. Junio C HamanoJan 7, 2020
  21. Junio C HamanoJan 8, 2020
  22. Derrick StoleeJan 8, 2020
  23. 2/2 graph: fix lack of color in horizontal linesDerrick Stolee via GitGitGadget, Jan 7, 2020
  24. Junio C HamanoJan 7, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.