From: Eric Bresie <ebresie@gmail.com>
To: Mike Frysinger <vapier@gentoo.org>
Cc: Richard Earnshaw <richard.earnshaw@foss.arm.com>, newlib@sourceware.org
Subject: Re: Re: [PATCH v2] newlib: fix build with <gcc-5 versions
Date: Sun, 20 Mar 2022 07:39:24 -0500 [thread overview]
Message-ID: <2a049f53-52c8-4858-8075-e65a760d9875@iPad> (raw)
In-Reply-To: YjEnGIyU31Kl6zYJ@vapier
Interesting was not familiar with either of these
https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html
https://gcc.gnu.org/onlinedocs/gcc/Integer-Overflow-Builtins.html
Eric Bresie
Ebresie@gmail.com (mailto:Ebresie@gmail.com)
> On March 15, 2022 at 6:54:00 PM CDT, Mike Frysinger <vapier@gentoo.org (mailto:vapier@gentoo.org)> wrote:
> On 15 Mar 2022 12:41, Richard Earnshaw wrote:
> > On 15/03/2022 03:25, Mike Frysinger wrote:
> > > __builtin_mul_overflow showed up with gcc-5, so stub it out for older
> > > versions.
> > > ---
> > > newlib/libc/include/sys/cdefs.h | 4 ++++
> > > 1 file changed, 4 insertions(+)
> > >
> > > diff --git a/newlib/libc/include/sys/cdefs.h b/newlib/libc/include/sys/cdefs.h
> > > index da729092185c..e51f7f4b873a 100644
> > > --- a/newlib/libc/include/sys/cdefs.h
> > > +++ b/newlib/libc/include/sys/cdefs.h
> > > @@ -416,6 +416,10 @@
> > > #define __unreachable() ((void)0)
> > > #endif
> > >
> > > +#if !__GNUC_PREREQ__(5, 0)
> > > +#define __builtin_mul_overflow(a, b, size) ({ *(size) = (a) * (b); 0; })
> >
> > Wouldn't
> > (*(size) = (a) * (b), 0)
> >
> > be more portable (avoiding the GNU statement expression extension)?
>
> sure, that works too, thanks
> -mike
> signature.asc849 bytes (#attachment-1)
next reply other threads:[~2022-03-20 12:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-20 12:39 Eric Bresie [this message]
2022-03-20 12:52 Eric Bresie
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=2a049f53-52c8-4858-8075-e65a760d9875@iPad \
--to=ebresie@gmail.com \
--cc=newlib@sourceware.org \
--cc=richard.earnshaw@foss.arm.com \
--cc=vapier@gentoo.org \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).