Re: [PATCH spice-server] build: do not warn about address-of-packed-member

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/7/19 12:53 PM, Frediano Ziglio wrote:

The gcc warning address-of-packed-member is new and on by
default in gcc 9.

Many of the structures sent over the network are packed
and with unaligned fields.

This breaks the build -- due to -Werror.
Tell gcc to not warn about it.

Signed-off-by: Uri Lublin <uril@xxxxxxxxxx>

What are the warning exactly for?

https://gcc.gnu.org/gcc-9/changes.html

  -Waddress-of-packed-member, enabled by default, warns about an
    unaligned pointer value from the address of a packed member
    of a struct or union.


Sure we don't want to fix them?

I think it would not be too hard to overcome this specific warning, by
copying the structures, or sending their content instead of a pointer.
We would still have unaligned access, but not for unaligned pointers.

It's not easy to change the structures themselves.
For example if we change SpiceMigrateDataDisplay to make it aligned,
we likely break migration from older versions.

Uri.


---
  m4/manywarnings.m4 | 1 +
  meson.build        | 1 +
  2 files changed, 2 insertions(+)

diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4
index 4f701f4ea..20543d4a4 100644
--- a/m4/manywarnings.m4
+++ b/m4/manywarnings.m4
@@ -174,6 +174,7 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
      -Wmultichar \
      -Wnarrowing \
      -Wnested-externs \
+    -Wno-address-of-packed-member \
      -Wnonnull \
      -Wnonnull-compare \
      -Wnull-dereference \
diff --git a/meson.build b/meson.build
index 93fbdfff9..b8dde96a8 100644
--- a/meson.build
+++ b/meson.build
@@ -42,6 +42,7 @@ spice_server_global_cflags = ['-DSPICE_SERVER_INTERNAL',
                                '-Wall',
                                '-Wextra',
                                '-Wno-sign-compare',
+                              '-Wno-address-of-packed-member',
                                '-Wno-unused-parameter']
compiler = meson.get_compiler('c')

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]