From: Robbie Harwood <rharwood@redhat.com>
To: Peter Jones <pjones@redhat.com>, grub-devel@gnu.org
Cc: daniel.kiper@oracle.com
Subject: Re: [PATCH] misc: Make grub_min() and grub_max() more resilient.
Date: Thu, 24 Mar 2022 18:43:16 -0400 [thread overview]
Message-ID: <jlgmthfrmyj.fsf@redhat.com> (raw)
In-Reply-To: <20220324200638.3388997-1-pjones@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 887 bytes --]
Peter Jones <pjones@redhat.com> writes:
> grub_min(a,b) and grub_max(a,b) use a relatively naive implementation
> which leads to several problems:
> - they evaluate their parameters more than once
> - the naive way to address this, to declare temporary variables in a
> statement-expression, isn't resilient against nested uses, because
> MIN(a,MIN(b,c)) results in the temporary variables being declared in
> two nested scopes, which may result in a build warning depending on
> your build options.
>
> This patch changes our implementation to use a statement-expression
> inside a helper macro, and creates the symbols for the temporary
> variables with __COUNTER__ (A GNU C cpp extension) and token pasting to
> create uniquely named internal variables.
>
> Signed-off-by: Peter Jones <pjones@redhat.com>
Reviewed-by: Robbie Harwood <rharwood@redhat.com>
Be well,
--Robbie
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]
next prev parent reply other threads:[~2022-03-24 22:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-24 20:06 [PATCH] misc: Make grub_min() and grub_max() more resilient Peter Jones
2022-03-24 22:43 ` Robbie Harwood [this message]
2022-04-06 15:51 ` Daniel Kiper
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=jlgmthfrmyj.fsf@redhat.com \
--to=rharwood@redhat.com \
--cc=daniel.kiper@oracle.com \
--cc=grub-devel@gnu.org \
--cc=pjones@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.