[v2] newlib: change static to __fenv_static for fe{enable,disable,get}except

Message ID DB9PR83MB0923A4C79F18C02E48E95E049243A@DB9PR83MB0923.EURPRD83.prod.outlook.com
State New
Headers
Series [v2] newlib: change static to __fenv_static for fe{enable,disable,get}except |

Commit Message

Radek Barton July 3, 2025, 6:59 p.m. UTC
  Hello.

Sending the version with the __cygwin_fenv_static suggestion applied.

Radek

---
From 5c708ec741b4c4dd7676b7030451bc08607ce352 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Radek=20Barto=C5=88?= <radek.barton@microsoft.com>
Date: Thu, 3 Jul 2025 12:00:22 +0200
Subject: [PATCH v2] newlib: change static to __fenv_static for
 fe{enable,disable,get}except
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This fixes undefined references to those functions when building cygwin1.dll for AArch64.

Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
---
 newlib/libc/machine/aarch64/sys/fenv.h | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
  

Comments

Richard Earnshaw July 4, 2025, 9:37 a.m. UTC | #1
On 03/07/2025 19:59, Radek Barton wrote:
> Hello.
> 
> Sending the version with the __cygwin_fenv_static suggestion applied.
> 

This looks OK to me. Corinna, is there anything you want to add?

R.

> Radek
> 
> ---
> From 5c708ec741b4c4dd7676b7030451bc08607ce352 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Radek=20Barto=C5=88?= <radek.barton@microsoft.com>
> Date: Thu, 3 Jul 2025 12:00:22 +0200
> Subject: [PATCH v2] newlib: change static to __fenv_static for
>  fe{enable,disable,get}except
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> This fixes undefined references to those functions when building cygwin1.dll for AArch64.
> 
> Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
> ---
>  newlib/libc/machine/aarch64/sys/fenv.h | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/newlib/libc/machine/aarch64/sys/fenv.h b/newlib/libc/machine/aarch64/sys/fenv.h
> index 6b0879269..1f97791a7 100644
> --- a/newlib/libc/machine/aarch64/sys/fenv.h
> +++ b/newlib/libc/machine/aarch64/sys/fenv.h
> @@ -80,9 +80,17 @@ extern const fenv_t	*_fe_dfl_env;
>  
>  #if __BSD_VISIBLE
>  
> -/* We currently provide no external definitions of the functions below. */
> +/* We currently provide no external definitions of the functions below
> +   except of for Cygwin where those functions are exported by
> +   winsup/cygwin/cygwin.din. */
> +
> +#ifdef __CYGWIN__
> +#define __cygwin_fenv_static __fenv_static
> +#else
> +#define __cygwin_fenv_static static
> +#endif
>  
> -static inline int
> +__cygwin_fenv_static inline int
>  feenableexcept(int __mask)
>  {
>  	fenv_t __old_r, __new_r;
> @@ -93,7 +101,7 @@ feenableexcept(int __mask)
>  	return ((__old_r >> _FPUSW_SHIFT) & FE_ALL_EXCEPT);
>  }
>  
> -static inline int
> +__cygwin_fenv_static inline int
>  fedisableexcept(int __mask)
>  {
>  	fenv_t __old_r, __new_r;
> @@ -104,7 +112,7 @@ fedisableexcept(int __mask)
>  	return ((__old_r >> _FPUSW_SHIFT) & FE_ALL_EXCEPT);
>  }
>  
> -static inline int
> +__cygwin_fenv_static inline int
>  fegetexcept(void)
>  {
>  	fenv_t __r;
  
Corinna Vinschen July 4, 2025, 9:41 a.m. UTC | #2
On Jul  4 10:37, Richard Earnshaw (lists) wrote:
> On 03/07/2025 19:59, Radek Barton wrote:
> > Hello.
> > 
> > Sending the version with the __cygwin_fenv_static suggestion applied.
> > 
> 
> This looks OK to me. Corinna, is there anything you want to add?

Fine with me, please push.


Thanks,
Corinna

> 
> R.
> 
> > Radek
> > 
> > ---
> > From 5c708ec741b4c4dd7676b7030451bc08607ce352 Mon Sep 17 00:00:00 2001
> > From: =?UTF-8?q?Radek=20Barto=C5=88?= <radek.barton@microsoft.com>
> > Date: Thu, 3 Jul 2025 12:00:22 +0200
> > Subject: [PATCH v2] newlib: change static to __fenv_static for
> >  fe{enable,disable,get}except
> > MIME-Version: 1.0
> > Content-Type: text/plain; charset=UTF-8
> > Content-Transfer-Encoding: 8bit
> > 
> > This fixes undefined references to those functions when building cygwin1.dll for AArch64.
> > 
> > Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
> > ---
> >  newlib/libc/machine/aarch64/sys/fenv.h | 16 ++++++++++++----
> >  1 file changed, 12 insertions(+), 4 deletions(-)
> > 
> > diff --git a/newlib/libc/machine/aarch64/sys/fenv.h b/newlib/libc/machine/aarch64/sys/fenv.h
> > index 6b0879269..1f97791a7 100644
> > --- a/newlib/libc/machine/aarch64/sys/fenv.h
> > +++ b/newlib/libc/machine/aarch64/sys/fenv.h
> > @@ -80,9 +80,17 @@ extern const fenv_t	*_fe_dfl_env;
> >  
> >  #if __BSD_VISIBLE
> >  
> > -/* We currently provide no external definitions of the functions below. */
> > +/* We currently provide no external definitions of the functions below
> > +   except of for Cygwin where those functions are exported by
> > +   winsup/cygwin/cygwin.din. */
> > +
> > +#ifdef __CYGWIN__
> > +#define __cygwin_fenv_static __fenv_static
> > +#else
> > +#define __cygwin_fenv_static static
> > +#endif
> >  
> > -static inline int
> > +__cygwin_fenv_static inline int
> >  feenableexcept(int __mask)
> >  {
> >  	fenv_t __old_r, __new_r;
> > @@ -93,7 +101,7 @@ feenableexcept(int __mask)
> >  	return ((__old_r >> _FPUSW_SHIFT) & FE_ALL_EXCEPT);
> >  }
> >  
> > -static inline int
> > +__cygwin_fenv_static inline int
> >  fedisableexcept(int __mask)
> >  {
> >  	fenv_t __old_r, __new_r;
> > @@ -104,7 +112,7 @@ fedisableexcept(int __mask)
> >  	return ((__old_r >> _FPUSW_SHIFT) & FE_ALL_EXCEPT);
> >  }
> >  
> > -static inline int
> > +__cygwin_fenv_static inline int
> >  fegetexcept(void)
> >  {
> >  	fenv_t __r;
  
Richard Earnshaw July 4, 2025, 10:17 a.m. UTC | #3
I've tweaked the commit message and pushed this.

Thanks

R.

On 03/07/2025 19:59, Radek Barton wrote:
> Hello.
> 
> Sending the version with the __cygwin_fenv_static suggestion applied.
> 
> Radek
> 
> ---
> From 5c708ec741b4c4dd7676b7030451bc08607ce352 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Radek=20Barto=C5=88?= <radek.barton@microsoft.com>
> Date: Thu, 3 Jul 2025 12:00:22 +0200
> Subject: [PATCH v2] newlib: change static to __fenv_static for
>  fe{enable,disable,get}except
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> This fixes undefined references to those functions when building cygwin1.dll for AArch64.
> 
> Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
> ---
>  newlib/libc/machine/aarch64/sys/fenv.h | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/newlib/libc/machine/aarch64/sys/fenv.h b/newlib/libc/machine/aarch64/sys/fenv.h
> index 6b0879269..1f97791a7 100644
> --- a/newlib/libc/machine/aarch64/sys/fenv.h
> +++ b/newlib/libc/machine/aarch64/sys/fenv.h
> @@ -80,9 +80,17 @@ extern const fenv_t	*_fe_dfl_env;
>  
>  #if __BSD_VISIBLE
>  
> -/* We currently provide no external definitions of the functions below. */
> +/* We currently provide no external definitions of the functions below
> +   except of for Cygwin where those functions are exported by
> +   winsup/cygwin/cygwin.din. */
> +
> +#ifdef __CYGWIN__
> +#define __cygwin_fenv_static __fenv_static
> +#else
> +#define __cygwin_fenv_static static
> +#endif
>  
> -static inline int
> +__cygwin_fenv_static inline int
>  feenableexcept(int __mask)
>  {
>  	fenv_t __old_r, __new_r;
> @@ -93,7 +101,7 @@ feenableexcept(int __mask)
>  	return ((__old_r >> _FPUSW_SHIFT) & FE_ALL_EXCEPT);
>  }
>  
> -static inline int
> +__cygwin_fenv_static inline int
>  fedisableexcept(int __mask)
>  {
>  	fenv_t __old_r, __new_r;
> @@ -104,7 +112,7 @@ fedisableexcept(int __mask)
>  	return ((__old_r >> _FPUSW_SHIFT) & FE_ALL_EXCEPT);
>  }
>  
> -static inline int
> +__cygwin_fenv_static inline int
>  fegetexcept(void)
>  {
>  	fenv_t __r;
  

Patch

diff --git a/newlib/libc/machine/aarch64/sys/fenv.h b/newlib/libc/machine/aarch64/sys/fenv.h
index 6b0879269..1f97791a7 100644
--- a/newlib/libc/machine/aarch64/sys/fenv.h
+++ b/newlib/libc/machine/aarch64/sys/fenv.h
@@ -80,9 +80,17 @@  extern const fenv_t	*_fe_dfl_env;
 
 #if __BSD_VISIBLE
 
-/* We currently provide no external definitions of the functions below. */
+/* We currently provide no external definitions of the functions below
+   except of for Cygwin where those functions are exported by
+   winsup/cygwin/cygwin.din. */
+
+#ifdef __CYGWIN__
+#define __cygwin_fenv_static __fenv_static
+#else
+#define __cygwin_fenv_static static
+#endif
 
-static inline int
+__cygwin_fenv_static inline int
 feenableexcept(int __mask)
 {
 	fenv_t __old_r, __new_r;
@@ -93,7 +101,7 @@  feenableexcept(int __mask)
 	return ((__old_r >> _FPUSW_SHIFT) & FE_ALL_EXCEPT);
 }
 
-static inline int
+__cygwin_fenv_static inline int
 fedisableexcept(int __mask)
 {
 	fenv_t __old_r, __new_r;
@@ -104,7 +112,7 @@  fedisableexcept(int __mask)
 	return ((__old_r >> _FPUSW_SHIFT) & FE_ALL_EXCEPT);
 }
 
-static inline int
+__cygwin_fenv_static inline int
 fegetexcept(void)
 {
 	fenv_t __r;