public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Corinna Vinschen <vinschen@redhat.com>
To: Mingye Wang <arthur200126@gmail.com>
Cc: Newlib <newlib@sourceware.org>,
	Torbjorn SVENSSON <torbjorn.svensson@foss.st.com>
Subject: Re: [PATCHv2] Make SIG2STR_MAX usable in #if
Date: Wed, 21 Jun 2023 15:20:34 +0200	[thread overview]
Message-ID: <ZJL5It02HEwrTI5J@calimero.vinschen.de> (raw)
In-Reply-To: <CAD66C+bEhiZ83BK44tmdcxQbGsCRcgx8C1YCKyrDs30dytk-QQ@mail.gmail.com>

On Jun 21 20:13, Mingye Wang wrote:
> > That should be 7 + 11 - 1 = 17 and 7 + 6 - 1 = 12, shouldn't it?
> 
> Yep, it should be. Misread my terminal output and wondered for a bit
> why the second one is longer than the first. Should have thought about
> double-checking.

> From bccdc7d72cc1ea8a0d2aa04acf86e0afd2a3d6b5 Mon Sep 17 00:00:00 2001
> From: Mingye Wang <arthur200126@gmail.com>
> Date: Wed, 21 Jun 2023 20:11:57 +0800
> Subject: [PATCH] Make SIG2STR_MAX usable in #if
> 
> The text accepted for POSIX issue 8 requires that SIG2STR_MAX be usable
> in #if, which we currently break with sizeof. Use static values instead.
> ---
>  newlib/libc/include/sys/signal.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/newlib/libc/include/sys/signal.h b/newlib/libc/include/sys/signal.h
> index 8dc5fb9c34..96bf9781ae 100644
> --- a/newlib/libc/include/sys/signal.h
> +++ b/newlib/libc/include/sys/signal.h
> @@ -245,9 +245,9 @@ int sigqueue (pid_t, int, const union sigval);
>  /* POSIX Issue 8 adds sig2str() and str2sig() */
>  
>  #if __SIZEOF_INT__ >= 4
> -#define SIG2STR_MAX (sizeof("RTMAX+") + sizeof("4294967295") - 1)
> +#define SIG2STR_MAX 17	/* (sizeof("RTMAX+") + sizeof("4294967295") - 1) */
>  #else
> -#define SIG2STR_MAX (sizeof("RTMAX+") + sizeof("65535") - 1)
> +#define SIG2STR_MAX 12	/* (sizeof("RTMAX+") + sizeof("65535") - 1) */
>  #endif
>  
>  int sig2str(int, char *);

Pushed.


Thanks,
Corinna


      reply	other threads:[~2023-06-21 13:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-19  6:15 [Bug?] SIG2STR_MAX not good for #if Mingye Wang
2023-06-19  9:00 ` Corinna Vinschen
2023-06-19 11:11   ` Joel Sherrill
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 [this message]

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=ZJL5It02HEwrTI5J@calimero.vinschen.de \
    --to=vinschen@redhat.com \
    --cc=arthur200126@gmail.com \
    --cc=newlib@sourceware.org \
    --cc=torbjorn.svensson@foss.st.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 read-only IMAP folder(s) and NNTP newsgroup(s).