Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> writes: > Unlike the code this replaces we'll log to trace2 with this new bug() > function (as with other usage.c functions, including BUG()), I do not terribly mind repeated fprintf(stderr, ...) or error() in a loop, but this aspect of the change is probably among the two things that make the series shine (the other obviously being bug_if() which allows us to lose the "did we see any bug?" counter). > Any caller to bug() can follow up such calls with BUG_if_bug(), > which will BUG() out (i.e. abort()) if there were any preceding calls > to bug(), callers can also decide not to call BUG_if_bug() and leave > the resulting BUG() invocation until exit() time. There are currently > no bug() API users that don't call BUG_if_bug() themselves after a > for-loop, but allowing for not calling BUG_if_bug() keeps the API > flexible. As the tests and documentation here show we'll catch missing > BUG_if_bug() invocations in our exit() wrapper. OK. > I'd previously proposed this as part of another series[1], in that > use-case we ended thinking a BUG() would be better (and eventually > 96e41f58fe1 (fsck: report invalid object type-path combinations, > 2021-10-01) ended up with neither). Here though we'll end up > converting various existing code that was already doing what we're > doing better with this new API. I think the last paragraph is an after-three-dash material.