From 44b8e2ff1a661e3e41038cde8ceed3b6a52a42b7 Mon Sep 17 00:00:00 2001
From: Andre Maroneze <andre.maroneze@cea.fr>
Date: Mon, 25 Mar 2024 11:07:25 +0100
Subject: [PATCH] [Libc] change fexcept_t type and add macro for portability
 checks

---
 share/libc/fenv.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/share/libc/fenv.h b/share/libc/fenv.h
index 265d4237501..2ddec71c27e 100644
--- a/share/libc/fenv.h
+++ b/share/libc/fenv.h
@@ -76,7 +76,13 @@ fenv_t;
 // From POSIX 1-2017:
 // - "fexcept_t does not have to be an integer type."
 // - "... the user cannot inspect it."
+#ifdef __FC_FEXCEPT_T_IS_SCALAR
+// Non-portable code may consider fexcept_t as a scalar; this allows
+// such code to be parsed.
 typedef unsigned int fexcept_t;
+#else
+typedef struct __fc_fexcept_t { int _fc; } fexcept_t;
+#endif
 
 __FC_EXTERN volatile fenv_t __fc_fenv_state;
 
-- 
GitLab