From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-10.7 required=3.0 tests=AWL,BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by dcvr.yhbt.net (Postfix) with ESMTP id C8BFB1F4D7 for ; Tue, 31 May 2022 17:40:10 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="VhJPniyT"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346608AbiEaRkJ (ORCPT ); Tue, 31 May 2022 13:40:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238878AbiEaRkG (ORCPT ); Tue, 31 May 2022 13:40:06 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5835762BE5 for ; Tue, 31 May 2022 10:40:05 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id d12-20020a17090abf8c00b001e2eb431ce4so2964906pjs.1 for ; Tue, 31 May 2022 10:40:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=+DXdrvHwTlVI+OXCRlsdkE3PxgSWMCAQxkuJkJHgsrU=; b=VhJPniyTn904YaaOCTGXcR6nLPQdl9aRK5Mr7mCq7qtIDdnNVRcNxJaa6vdZ9EAFLH UAudzA/pb9rwKJQSDPmEl7NnxirUM8Q9FcEfSsP6hG/G3pwdos2BJQb3/bOQVxwzT9me v9bBHBejFwvj3LmtYMVLw8P/lYBWxLpDPZigFY+BGAih+FVkY7/bu9CuLriF4GojNNgP +YLgRNdGMMHLwtb3YftpLEQK9+Y42Dd4ZWxohSfxAG5b9o2UTMKARjGo9x5+TU9i2la5 T4stPZbzs/oeQ6s7zVx6oKRaZHpTkFTXaoTjcVdpN7JaJaNFjDvbAc3NFGwo27BQRhz+ QqzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :content-transfer-encoding:in-reply-to; bh=+DXdrvHwTlVI+OXCRlsdkE3PxgSWMCAQxkuJkJHgsrU=; b=Qiyn+occgA896X7GwOGYiN5uCl+/smcG2747JgMOfvVwplPV48b+qe+cziO/vA4onr Pr/8nED5ndID7ODeignVbLjaMb3H8f/u/fnG7wWQVkW2ClTB/87x1Fmx6JD5Q69G/veZ MitEuItBUHwrGpMVK1mG5M4tv9actJhcHgiD75nhfLQ1lrjcR8/12PjUJDJQDZolG2qC CMt6OO4vJStkhQSQ5pfaWF+Aso+eNMEO/kBtjwfnpjCGtWmDtIjyAXfv+a/7akPTFI3b D8bqjLTt9ScZF94IR6DCQK13NaTtBJ+dm8lly5Lh+pXRTmbqS6LNBaRPLtM/7JgB6uno BDZA== X-Gm-Message-State: AOAM531mV7OpOqnywN5yX6n6G6/kq4sXWlBAinscOwk8JNhdwHxuomGl uD3EtEYdo8ANO/q6uL68bzjKULKW66Mg+g== X-Google-Smtp-Source: ABdhPJwH9zQ4nG25uq4vv+JAwcMZ0M2wXrMWzHu4/tj8b08x9SXAw+vLqz+/wdgYWX+sLotW0xu+Aw== X-Received: by 2002:a17:902:d58a:b0:164:f5d1:82e9 with SMTP id k10-20020a170902d58a00b00164f5d182e9mr41342plh.3.1654018804581; Tue, 31 May 2022 10:40:04 -0700 (PDT) Received: from google.com ([2620:15c:2ce:200:42f:67e0:2ed2:1f46]) by smtp.gmail.com with ESMTPSA id s24-20020a170902989800b00162523fdb8fsm11314407plp.252.2022.05.31.10.40.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 10:40:03 -0700 (PDT) Date: Tue, 31 May 2022 10:39:58 -0700 From: Josh Steadmon To: =?iso-8859-1?Q?=C6var_Arnfj=F6r=F0?= Bjarmason Cc: git@vger.kernel.org, Junio C Hamano , Bagas Sanjaya , Abhradeep Chakraborty , Glen Choo , Andrei Rybak , Emily Shaffer Subject: Re: [PATCH v2 0/6] usage API: add and use a bug() + BUG_if_bug() Message-ID: Mail-Followup-To: Josh Steadmon , =?iso-8859-1?Q?=C6var_Arnfj=F6r=F0?= Bjarmason , git@vger.kernel.org, Junio C Hamano , Bagas Sanjaya , Abhradeep Chakraborty , Glen Choo , Andrei Rybak , Emily Shaffer References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On 2022.05.31 18:58, Ævar Arnfjörð Bjarmason wrote: > This series adds a bug() (lower-case) function to go along with > BUG(). As seen in 3-5/6 this makes it much easier to handle the cases > such as parse-options.c where we'd like to call BUG(), but would like > to first exhaustively accumulate the N issues we spot before doing so, > and not merely BUG() out on the first one. > > Changes since v1 > (https://lore.kernel.org/git/cover-0.5-00000000000-20220521T170939Z-avarab@gmail.com/): > > * Move the exit() wrapper to common-main.c, I tried to add a > "common-exit.c" or just rename "common-main.c" to "common.c", but > due to how the CMake build system declares it those changes would > result in a lot of churn, so for now just adding it to > common-main.c makes more sense. > > * Typo/grammar fixes in commit messages, as pointed out in review. > > * The BUG_if_bug() function is now optional, and the docs have been > updated to reflect that. > > * The BUG_if_bug() function now takes a va_args like BUG() to > indicate what the problem was. > > * Updated 3/6 to note that the exit(128) code changes with a > migration to BUG(). > > * Fix logic error in 4/6: We now "break" after calling bug(), to > behave as the previous code did. > > * Fix logic error in 5/6, which now makes use of the new argument(s) > to BUG_if_bug(). > > * There was some suggestion of ejecting 6/6, but I've instead > replaced it with the implementation Glen suggested in > http://lore.kernel.org/git/kl6lk0a6mzp0.fsf@chooglen-macbookpro.roam.corp.google.com > > Ævar Arnfjörð Bjarmason (6): > common-main.o: move non-trace2 exit() behavior out of trace2.c > usage.c: add a non-fatal bug() function to go with BUG() > parse-options.c: use new bug() API for optbug() > parse-options.c: use optbug() instead of BUG() "opts" check > receive-pack: use bug() and BUG_if_bug() > cache-tree.c: use bug() and BUG_if_bug() > > .../technical/api-error-handling.txt | 19 +++++- > Documentation/technical/api-trace2.txt | 4 +- > builtin/receive-pack.c | 16 ++--- > cache-tree.c | 8 +-- > common-main.c | 30 ++++++++- > git-compat-util.h | 24 ++++++- > parse-options.c | 67 ++++++++++--------- > t/helper/test-trace2.c | 22 +++++- > t/t0210-trace2-normal.sh | 52 ++++++++++++++ > trace2.c | 8 +-- > trace2.h | 8 +-- > usage.c | 30 +++++++-- > 12 files changed, 217 insertions(+), 71 deletions(-) Thanks for the updates! I have a minor question about 4/6, but regardless of if/how that's addressed, I think this version looks good. Reviewed-by: Josh Steadmon