mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] [PATCH] powerpc, powerpc64, s390x: remove unsigned suffix on SA_* macros
@ 2025-03-24 16:24 Alex Rønne Petersen
  2025-03-25 21:20 ` Rich Felker
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Rønne Petersen @ 2025-03-24 16:24 UTC (permalink / raw)
  To: musl; +Cc: Alex Rønne Petersen

I'm not really sure why this was ever here. It's not done for any other ports,
and AFAICT glibc doesn't do this either. It causes -Wsign-conversion warnings in
code that's completely fine, such as `act->sa_flags & SA_SIGINFO`.
---
 arch/powerpc/bits/signal.h   | 16 ++++++++--------
 arch/powerpc64/bits/signal.h | 16 ++++++++--------
 arch/s390x/bits/signal.h     | 16 ++++++++--------
 3 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/arch/powerpc/bits/signal.h b/arch/powerpc/bits/signal.h
index c1bf3caf..de1af5c5 100644
--- a/arch/powerpc/bits/signal.h
+++ b/arch/powerpc/bits/signal.h
@@ -70,14 +70,14 @@ typedef struct __ucontext {
 	mcontext_t uc_mcontext;
 } ucontext_t;
 
-#define SA_NOCLDSTOP  1U
-#define SA_NOCLDWAIT  2U
-#define SA_SIGINFO    4U
-#define SA_ONSTACK    0x08000000U
-#define SA_RESTART    0x10000000U
-#define SA_NODEFER    0x40000000U
-#define SA_RESETHAND  0x80000000U
-#define SA_RESTORER   0x04000000U
+#define SA_NOCLDSTOP  1
+#define SA_NOCLDWAIT  2
+#define SA_SIGINFO    4
+#define SA_ONSTACK    0x08000000
+#define SA_RESTART    0x10000000
+#define SA_NODEFER    0x40000000
+#define SA_RESETHAND  0x80000000
+#define SA_RESTORER   0x04000000
 
 #endif
 
diff --git a/arch/powerpc64/bits/signal.h b/arch/powerpc64/bits/signal.h
index d5493b18..cf25d498 100644
--- a/arch/powerpc64/bits/signal.h
+++ b/arch/powerpc64/bits/signal.h
@@ -61,14 +61,14 @@ typedef struct __ucontext {
 	mcontext_t uc_mcontext;
 } ucontext_t;
 
-#define SA_NOCLDSTOP  1U
-#define SA_NOCLDWAIT  2U
-#define SA_SIGINFO    4U
-#define SA_ONSTACK    0x08000000U
-#define SA_RESTART    0x10000000U
-#define SA_NODEFER    0x40000000U
-#define SA_RESETHAND  0x80000000U
-#define SA_RESTORER   0x04000000U
+#define SA_NOCLDSTOP  1
+#define SA_NOCLDWAIT  2
+#define SA_SIGINFO    4
+#define SA_ONSTACK    0x08000000
+#define SA_RESTART    0x10000000
+#define SA_NODEFER    0x40000000
+#define SA_RESETHAND  0x80000000
+#define SA_RESTORER   0x04000000
 
 #endif
 
diff --git a/arch/s390x/bits/signal.h b/arch/s390x/bits/signal.h
index e5aca4ba..ba131e6b 100644
--- a/arch/s390x/bits/signal.h
+++ b/arch/s390x/bits/signal.h
@@ -72,14 +72,14 @@ typedef struct __ucontext {
 	sigset_t uc_sigmask;
 } ucontext_t;
 
-#define SA_NOCLDSTOP  1U
-#define SA_NOCLDWAIT  2U
-#define SA_SIGINFO    4U
-#define SA_ONSTACK    0x08000000U
-#define SA_RESTART    0x10000000U
-#define SA_NODEFER    0x40000000U
-#define SA_RESETHAND  0x80000000U
-#define SA_RESTORER   0x04000000U
+#define SA_NOCLDSTOP  1
+#define SA_NOCLDWAIT  2
+#define SA_SIGINFO    4
+#define SA_ONSTACK    0x08000000
+#define SA_RESTART    0x10000000
+#define SA_NODEFER    0x40000000
+#define SA_RESETHAND  0x80000000
+#define SA_RESTORER   0x04000000
 
 #endif
 
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [musl] [PATCH] powerpc, powerpc64, s390x: remove unsigned suffix on SA_* macros
  2025-03-24 16:24 [musl] [PATCH] powerpc, powerpc64, s390x: remove unsigned suffix on SA_* macros Alex Rønne Petersen
@ 2025-03-25 21:20 ` Rich Felker
  2025-03-25 21:30   ` Alex Rønne Petersen
  0 siblings, 1 reply; 3+ messages in thread
From: Rich Felker @ 2025-03-25 21:20 UTC (permalink / raw)
  To: Alex Rønne Petersen; +Cc: musl

On Mon, Mar 24, 2025 at 05:24:32PM +0100, Alex Rønne Petersen wrote:
> I'm not really sure why this was ever here. It's not done for any other ports,
> and AFAICT glibc doesn't do this either. It causes -Wsign-conversion warnings in
> code that's completely fine, such as `act->sa_flags & SA_SIGINFO`.
> ---
>  arch/powerpc/bits/signal.h   | 16 ++++++++--------
>  arch/powerpc64/bits/signal.h | 16 ++++++++--------
>  arch/s390x/bits/signal.h     | 16 ++++++++--------
>  3 files changed, 24 insertions(+), 24 deletions(-)
> 
> diff --git a/arch/powerpc/bits/signal.h b/arch/powerpc/bits/signal.h
> index c1bf3caf..de1af5c5 100644
> --- a/arch/powerpc/bits/signal.h
> +++ b/arch/powerpc/bits/signal.h
> @@ -70,14 +70,14 @@ typedef struct __ucontext {
>  	mcontext_t uc_mcontext;
>  } ucontext_t;
>  
> -#define SA_NOCLDSTOP  1U
> -#define SA_NOCLDWAIT  2U
> -#define SA_SIGINFO    4U
> -#define SA_ONSTACK    0x08000000U
> -#define SA_RESTART    0x10000000U
> -#define SA_NODEFER    0x40000000U
> -#define SA_RESETHAND  0x80000000U
> -#define SA_RESTORER   0x04000000U
> +#define SA_NOCLDSTOP  1
> +#define SA_NOCLDWAIT  2
> +#define SA_SIGINFO    4
> +#define SA_ONSTACK    0x08000000
> +#define SA_RESTART    0x10000000
> +#define SA_NODEFER    0x40000000
> +#define SA_RESETHAND  0x80000000
> +#define SA_RESTORER   0x04000000

Unfortunately this seems to leave the signedness inconsistent:
SA_RESETHAND is still unsigned. Should that be fixed too by defining
it as a negative value? That might be the motivation for why they were
all made unsigned on ppc originally...

Rich

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [musl] [PATCH] powerpc, powerpc64, s390x: remove unsigned suffix on SA_* macros
  2025-03-25 21:20 ` Rich Felker
@ 2025-03-25 21:30   ` Alex Rønne Petersen
  0 siblings, 0 replies; 3+ messages in thread
From: Alex Rønne Petersen @ 2025-03-25 21:30 UTC (permalink / raw)
  To: Rich Felker; +Cc: musl

On Tue, Mar 25, 2025 at 10:20 PM Rich Felker <dalias@libc.org> wrote:
>
> On Mon, Mar 24, 2025 at 05:24:32PM +0100, Alex Rønne Petersen wrote:
> > I'm not really sure why this was ever here. It's not done for any other ports,
> > and AFAICT glibc doesn't do this either. It causes -Wsign-conversion warnings in
> > code that's completely fine, such as `act->sa_flags & SA_SIGINFO`.
> > ---
> >  arch/powerpc/bits/signal.h   | 16 ++++++++--------
> >  arch/powerpc64/bits/signal.h | 16 ++++++++--------
> >  arch/s390x/bits/signal.h     | 16 ++++++++--------
> >  3 files changed, 24 insertions(+), 24 deletions(-)
> >
> > diff --git a/arch/powerpc/bits/signal.h b/arch/powerpc/bits/signal.h
> > index c1bf3caf..de1af5c5 100644
> > --- a/arch/powerpc/bits/signal.h
> > +++ b/arch/powerpc/bits/signal.h
> > @@ -70,14 +70,14 @@ typedef struct __ucontext {
> >       mcontext_t uc_mcontext;
> >  } ucontext_t;
> >
> > -#define SA_NOCLDSTOP  1U
> > -#define SA_NOCLDWAIT  2U
> > -#define SA_SIGINFO    4U
> > -#define SA_ONSTACK    0x08000000U
> > -#define SA_RESTART    0x10000000U
> > -#define SA_NODEFER    0x40000000U
> > -#define SA_RESETHAND  0x80000000U
> > -#define SA_RESTORER   0x04000000U
> > +#define SA_NOCLDSTOP  1
> > +#define SA_NOCLDWAIT  2
> > +#define SA_SIGINFO    4
> > +#define SA_ONSTACK    0x08000000
> > +#define SA_RESTART    0x10000000
> > +#define SA_NODEFER    0x40000000
> > +#define SA_RESETHAND  0x80000000
> > +#define SA_RESTORER   0x04000000
>
> Unfortunately this seems to leave the signedness inconsistent:
> SA_RESETHAND is still unsigned. Should that be fixed too by defining
> it as a negative value? That might be the motivation for why they were
> all made unsigned on ppc originally...

FWIW, save for a few odd-duck ports (alpha, hppa, sparc), glibc seems
content to define SA_RESETHAND as 0x80000000.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-03-25 21:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-24 16:24 [musl] [PATCH] powerpc, powerpc64, s390x: remove unsigned suffix on SA_* macros Alex Rønne Petersen
2025-03-25 21:20 ` Rich Felker
2025-03-25 21:30   ` Alex Rønne Petersen

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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).