configure: Use the -Wno-packed-not-aligned compiler option if available

Gerald Pfeifer gerald at pfeifer.com
Sat Nov 4 14:06:07 CDT 2017


GCC 8 is going to add a warning option -Wpacked-not-aligned, active
by default, which is documented as follows:

  Warn if a structure field with explicitly specified alignment in a
  packed struct or union is misaligned.  For example, a warning will
  be issued on struct S, like, "warning: alignment 1 of
  'struct S' is less than 8", in this code:

    struct __attribute__ ((aligned (8))) S8 { char a[8]; };
    struct __attribute__ ((packed)) S {
      struct S8 s8;
    };

This is causing half a megabyte of warning messages in my nightly
builds such as

    388 ../../include/d3d9types.h:1579:19: warning: 'SyncGPUTime' offset 20 in 'struct _D3DPRESENTSTATS' isn't aligned to 8 [-Wpacked-not-aligned]
    776 ../../include/d3d9types.h:1580:1: warning: alignment 4 of 'struct _D3DPRESENTSTATS' is less than 8 [-Wpacked-not-aligned]
   1112 ../../include/winnt.h:4578:1: warning: alignment 4 of 'struct _TOKEN_STATISTICS' is less than 8 [-Wpacked-not-aligned]

I assume we do want to disable all these warnings, which my patch
below does.

Gerald

Signed-off-by: Gerald Pfeifer <gerald at pfeifer.com>
---
 configure.ac | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index 29f4cd1ffa..637979a83a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1824,6 +1824,7 @@ then
   WINE_TRY_CFLAGS([-Wdeclaration-after-statement])
   WINE_TRY_CFLAGS([-Wempty-body])
   WINE_TRY_CFLAGS([-Wignored-qualifiers])
+  WINE_TRY_CFLAGS([-Wno-packed-not-aligned])
   WINE_TRY_CFLAGS([-Wshift-overflow=2])
   WINE_TRY_CFLAGS([-Wstrict-prototypes])
   WINE_TRY_CFLAGS([-Wtype-limits])
-- 
2.14.1



More information about the wine-patches mailing list