From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
git@vger.kernel.org, "Denton Liu" <liu.denton@gmail.com>,
"Jeff Hostetler" <jeffhost@microsoft.com>
Subject: Re: [PATCH] trace2: refactor to avoid gcc warning under -O3
Date: Wed, 5 May 2021 09:34:50 -0400 [thread overview]
Message-ID: <YJKe+ncDqrqq1i8P@coredump.intra.peff.net> (raw)
In-Reply-To: <xmqqwnsd3426.fsf@gitster.g>
On Wed, May 05, 2021 at 06:47:29PM +0900, Junio C Hamano wrote:
> The patch makes sense to me, modulo that the way the variable
> "saved_errno" introduced by this patch is used and the way a
> variable with that name is typically used in our codebase are at
> odds. I.e. we typically call a variable "saved_errno" when it is
> used in this pattern:
>
> if (a_syscall_whose_error_condition_we_care_about()) {
> int saved_errno = errno;
> perform_some_cleanup_operation_that_might_clobber_errno();
> return error_errno(..., saved_errno);
> /*
> * or
> * errno = saved_errno;
> * return -1;
> * and let the caller handle 'errno'
> */
> }
>
> But since I do not think of a better name for this new variable that
> is not exactly used like so, let's queue it as-is.
I'd probably have just called it "err", but I think it is fine either
way. :)
The patch also looks good to me. I used to compile with -O3 occasionally
to fix warnings, but given the date on this commit, it seems I have not
done so in quite a while. (It reproduces on gcc 10 for me, which is not
surprising).
-Peff
next prev parent reply other threads:[~2021-05-05 13:34 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-01 7:30 [PATCH] Fix -Wmaybe-uninitialized warnings under -O0 Denton Liu
[not found] ` <CAPUEspgBkmxszgBee8C9hZnEwqztf-XKEj7LB_jWVFJaJCge0w@mail.gmail.com>
2020-04-01 9:05 ` Denton Liu
2020-04-01 9:52 ` Jeff King
2020-04-01 14:06 ` Denton Liu
2020-04-03 14:04 ` Jeff King
2020-04-03 14:38 ` Jeff King
2020-04-04 12:07 ` Denton Liu
2020-04-04 14:21 ` Jeff King
2021-05-05 8:40 ` [PATCH] trace2: refactor to avoid gcc warning under -O3 Ævar Arnfjörð Bjarmason
2021-05-05 9:47 ` Junio C Hamano
2021-05-05 13:34 ` Jeff King [this message]
2021-05-05 14:38 ` Johannes Schindelin
2021-05-06 1:26 ` Junio C Hamano
2021-05-06 20:29 ` Johannes Schindelin
2021-05-06 21:10 ` Junio C Hamano
2021-05-11 14:34 ` Johannes Schindelin
2021-05-11 18:00 ` Jeff King
2021-05-11 20:58 ` Junio C Hamano
2021-05-11 21:07 ` Jeff King
2021-05-11 21:33 ` Junio C Hamano
2021-05-11 7:03 ` Junio C Hamano
2021-05-11 13:04 ` [PATCH v2] " Ævar Arnfjörð Bjarmason
2021-05-11 16:40 ` Jeff Hostetler
2021-05-11 17:54 ` Jeff King
2021-05-11 18:08 ` Jeff King
2021-05-11 21:09 ` Junio C Hamano
2021-05-20 0:20 ` Junio C Hamano
2021-05-20 11:05 ` [PATCH v3] " Ævar Arnfjörð Bjarmason
2021-05-20 13:13 ` Jeff King
2021-05-20 22:08 ` Junio C Hamano
2021-05-21 9:34 ` Jeff King
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YJKe+ncDqrqq1i8P@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jeffhost@microsoft.com \
--cc=liu.denton@gmail.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.
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 NNTP newsgroup(s).