This silences warnings like this:

    ../math/fmal.c:34:3: warning: packed attribute is unnecessary for 'struct 
x87reg_::(anonymous at ../math/fmal.c:34:3)' [-Wpacked]

Signed-off-by: Martin Storsjö <[email protected]>
---
 mingw-w64-crt/math/arm-common/log2.c | 5 +++++
 mingw-w64-crt/math/fma.c             | 6 ++++++
 mingw-w64-crt/math/fmaf.c            | 6 ++++++
 mingw-w64-crt/math/fmal.c            | 6 ++++++
 mingw-w64-crt/math/frexp.c           | 5 +++++
 5 files changed, 28 insertions(+)

diff --git a/mingw-w64-crt/math/arm-common/log2.c 
b/mingw-w64-crt/math/arm-common/log2.c
index 7d9c89087..5a8940bb4 100644
--- a/mingw-w64-crt/math/arm-common/log2.c
+++ b/mingw-w64-crt/math/arm-common/log2.c
@@ -7,6 +7,9 @@
 #include <math.h>
 #include <stdint.h>
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpacked"
+
 typedef union ieee754_double_ {
   struct __attribute__((__packed__)) {
     uint64_t f52 : 52;
@@ -25,6 +28,8 @@ typedef union ieee754_float_ {
   float f;
 } ieee754_float;
 
+#pragma GCC diagnostic pop
+
 double log2(double x)
 {
     ieee754_double u = { .f = x };
diff --git a/mingw-w64-crt/math/fma.c b/mingw-w64-crt/math/fma.c
index 644a6f6b7..424fb679e 100644
--- a/mingw-w64-crt/math/fma.c
+++ b/mingw-w64-crt/math/fma.c
@@ -39,6 +39,10 @@ double fma(double x, double y, double z){
  * Multiplying two 27-bit numbers will cause a 1-ULP error, which we cannot
  * avoid. It is kept in the very last position.
  */
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpacked"
+
 typedef union iec559_double_ {
   struct __attribute__((__packed__)) {
     uint64_t mlo : 27;
@@ -49,6 +53,8 @@ typedef union iec559_double_ {
   double f;
 } iec559_double;
 
+#pragma GCC diagnostic pop
+
 static inline void break_down(iec559_double *restrict lo, iec559_double 
*restrict hi, double x) {
   hi->f = x;
   /* Erase low-order significant bits. `hi->f` now has only 26 significant 
bits. */
diff --git a/mingw-w64-crt/math/fmaf.c b/mingw-w64-crt/math/fmaf.c
index 2773c5435..f95576202 100644
--- a/mingw-w64-crt/math/fmaf.c
+++ b/mingw-w64-crt/math/fmaf.c
@@ -39,6 +39,10 @@ float fmaf(float x, float y, float z){
  * Multiplying two 13-bit numbers will cause a 1-ULP error, which we cannot
  * avoid. It is kept in the very last position.
  */
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpacked"
+
 typedef union iec559_float_ {
   struct __attribute__((__packed__)) {
     uint32_t mlo : 13;
@@ -49,6 +53,8 @@ typedef union iec559_float_ {
   float f;
 } iec559_float;
 
+#pragma GCC diagnostic pop
+
 static inline void break_down(iec559_float *restrict lo, iec559_float 
*restrict hi, float x) {
   hi->f = x;
   /* Erase low-order significant bits. `hi->f` now has only 11 significant 
bits. */
diff --git a/mingw-w64-crt/math/fmal.c b/mingw-w64-crt/math/fmal.c
index 3db856e7c..019c110ba 100644
--- a/mingw-w64-crt/math/fmal.c
+++ b/mingw-w64-crt/math/fmal.c
@@ -30,6 +30,10 @@ long double fmal(long double x, long double y, long double 
z){
  * half, which reduces rounding errors in the more significant position but 
increases
  * them in the other end.
  */
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpacked"
+
 typedef union x87reg_ {
   struct __attribute__((__packed__)) {
     uint64_t mlo : 33;
@@ -40,6 +44,8 @@ typedef union x87reg_ {
   long double f;
 } x87reg;
 
+#pragma GCC diagnostic pop
+
 static inline void break_down(x87reg *restrict lo, x87reg *restrict hi, long 
double x) {
   hi->f = x;
   /* Erase low-order significant bits. `hi->f` now has only 31 significant 
bits. */
diff --git a/mingw-w64-crt/math/frexp.c b/mingw-w64-crt/math/frexp.c
index 69086daf8..7502902af 100644
--- a/mingw-w64-crt/math/frexp.c
+++ b/mingw-w64-crt/math/frexp.c
@@ -13,6 +13,9 @@ double frexp(double value, int* exp);
 /* It is assumed that `double` conforms to IEEE 754 and is little-endian.
  * This is true on x86 and ARM. */
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpacked"
+
 typedef union ieee754_double_ {
   struct __attribute__((__packed__)) {
     uint64_t f52 : 52;
@@ -22,6 +25,8 @@ typedef union ieee754_double_ {
   double f;
 } ieee754_double;
 
+#pragma GCC diagnostic pop
+
 double frexp(double value, int* exp)
 {
   int n;
-- 
2.43.0



_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to