From: Joel Sherrill <joel@rtems.org>
To: Newlib <newlib@sourceware.org>, Mingye Wang <arthur200126@gmail.com>
Subject: Re: [Bug?] SIG2STR_MAX not good for #if
Date: Mon, 19 Jun 2023 06:11:57 -0500 [thread overview]
Message-ID: <CAF9ehCV-u5ud0FmWR8qFLSg_9LaeYfvmF6CVm6-Lth7Heby2dg@mail.gmail.com> (raw)
In-Reply-To: <ZJAZFKYOxIxOrcin@calimero.vinschen.de>
[-- Attachment #1: Type: text/plain, Size: 1636 bytes --]
On Mon, Jun 19, 2023, 4:00 AM Corinna Vinschen <vinschen@redhat.com> wrote:
> On Jun 19 14:15, Mingye Wang wrote:
> > When building schilytools on MSYS2, I got hit with:
> >
> > ```
> > defs.h:1288:21: error: missing binary operator before token "("
> > 1288 | #if NUMBUFLEN < SIG2STR_MAX
> > ```
> >
> > For context, the source goes:
> >
> > ```
> > #define NUMBUFLEN 21 /* big enough for 64 bits */
> > #if NUMBUFLEN < SIG2STR_MAX
> > #undef NUMBUFLEN
> > #define NUMBUFLEN (SIG2STR_MAX-1)
> > #endif
> > ```
> >
> > A cursory inspection of /usr/include leads me to this "#define
> > SIG2STR_MAX (sizeof("RTMAX+") + sizeof("4294967295") - 1)" definition;
> > redefining it with a plain number makes the build go through. Looking
> > up the newlib source code, it appears that the definition is not
> > specific to MSYS2 or Cygwin, but common to all newlib distributions.
> >
> > The wording proposed for SIG2STR_MAX by geoffclare in comment 4975[1]
> > under the POSIX issue 8 bug report requires that the definition is
> > suitable for #if, which newlib currently violates. Now this isn't
> > quite standard yet and is subject to change, so I can't say for sure
> > this is newlib's bug.
> >
> > [1]: https://www.austingroupbugs.net/view.php?id=1138#c4975
>
> We could redefine SIG2STR_MAX as static values (still dependent on
> __SIZEOF_INT__) and prepend the sizeof expressions as comments.
>
FWIW This appears to be a common extension and ere does not appear in the
POSIX standard.
Given that, it should be compatible with glibc
--joel
>
> Do you want to provide a patch?
>
>
> Thanks,
> Corinna
>
>
next prev parent reply other threads:[~2023-06-19 11:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-19 6:15 Mingye Wang
2023-06-19 9:00 ` Corinna Vinschen
2023-06-19 11:11 ` Joel Sherrill [this message]
2023-06-21 1:08 ` Mingye Wang
2023-06-21 1:22 ` [PATCH] Make SIG2STR_MAX usable in #if Mingye Wang
2023-06-21 7:33 ` Torbjorn SVENSSON
2023-06-21 9:13 ` Corinna Vinschen
2023-06-21 12:13 ` [PATCHv2] " Mingye Wang
2023-06-21 13:20 ` Corinna Vinschen
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=CAF9ehCV-u5ud0FmWR8qFLSg_9LaeYfvmF6CVm6-Lth7Heby2dg@mail.gmail.com \
--to=joel@rtems.org \
--cc=arthur200126@gmail.com \
--cc=newlib@sourceware.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).