<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 15 May 2017, at 11:58, Frediano Ziglio <<a href="mailto:fziglio@redhat.com" class="">fziglio@redhat.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;" class=""><blockquote style="border-left-width: 2px; border-left-style: solid; border-left-color: rgb(16, 16, 255); margin-left: 5px; padding-left: 5px; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica, Arial, sans-serif; font-size: 12pt;" class=""><div class=""><blockquote class=""><div class=""><br class="Apple-interchange-newline">On 12 May 2017, at 15:29, Frediano Ziglio <<a href="mailto:fziglio@redhat.com" class="" target="_blank">fziglio@redhat.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><blockquote class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote class=""><br class="Apple-interchange-newline">On 11 May 2017, at 12:56, Daniel P. Berrange <<a href="mailto:berrange@redhat.com" class="" target="_blank">berrange@redhat.com</a>> wrote:<br class=""><br class="">On Thu, May 11, 2017 at 12:47:08PM +0200, Christophe de Dinechin wrote:<br class=""><blockquote class="">From: Christophe de Dinechin <<a href="mailto:dinechin@redhat.com" class="" target="_blank">dinechin@redhat.com</a>><br class=""><br class="">Signed-off-by: Christophe de Dinechin <<a href="mailto:dinechin@redhat.com" class="" target="_blank">dinechin@redhat.com</a>><br class="">---<br class="">configure.ac | 14 ++++++++++++++<br class="">1 file changed, 14 insertions(+)<br class=""><br class="">diff --git a/configure.ac b/configure.ac<br class="">index 74b5811..ecab365 100644<br class="">--- a/configure.ac<br class="">+++ b/configure.ac<br class="">@@ -62,6 +62,18 @@ esac<br class="">AC_MSG_RESULT([$os_win32])<br class="">AM_CONDITIONAL([OS_WIN32],[test "$os_win32" = "yes"])<br class=""><br class="">+AC_MSG_CHECKING([for native macOS])<br class="">+case "$host_os" in<br class="">+     *darwin*)<br class="">+        os_mac=yes<br class="">+        ;;<br class="">+     *)<br class="">+        os_mac=no<br class="">+        ;;<br class="">+esac<br class="">+AC_MSG_RESULT([$os_mac])<br class="">+AM_CONDITIONAL([OS_MAC],[test "$os_mac" = "yes"])<br class="">+<br class="">AC_CHECK_HEADERS([sys/socket.h netinet/in.h arpa/inet.h])<br class="">AC_CHECK_HEADERS([termios.h])<br class="">AC_CHECK_HEADERS([epoxy/egl.h],<br class="">@@ -468,6 +480,8 @@ esac<br class="">if test "$with_coroutine" = "auto"; then<br class=""> if test "$os_win32" = "yes"; then<br class="">   with_coroutine=winfiber<br class="">+  elif test "$os_mac" = "yes"; then<br class="">+    with_coroutine=gthread<br class=""> else<br class="">   with_coroutine=ucontext<br class=""> fi<br class=""></blockquote><br class="">Despite ucontext being deprecated we are still better off using that &<br class="">ignoring the warnings, than using the gthread impl.<br class=""></blockquote><br class="">Yes, I remember you explained the benefits of keeping ucontext. But for the<br class="">moment at least, on macOS, it is not a warning:<br class=""><br class="">/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/ucontext.h:43:2:<br class="">error:<br class="">     The deprecated ucontext routines require _XOPEN_SOURCE to be defined<br class="">#error The deprecated ucontext routines require _XOPEN_SOURCE to be defined<br class="">^<br class="">1 error generated.<br class=""><br class="">So I can:<br class="">- Add the error in the patch description<br class="">- Attempt to define _XOPEN_SOURCE in the configuration. I’m concerned about<br class="">side effects.<br class=""><br class="">The latter leads to another can of worms. Notably, the macro container_of<br class="">triggers the alignment warning for container_of, so I have a set of<br class="">alignment warnings, and a set of deprecation warnings. But it builds. The<br class="">incremental patch would be something like:<br class=""><br class=""><br class="">diff --git a/configure.ac b/configure.ac<br class="">index ecab365..8b433ba 100644<br class="">--- a/configure.ac<br class="">+++ b/configure.ac<br class="">@@ -481,7 +481,8 @@ if test "$with_coroutine" = "auto"; then<br class="">  if test "$os_win32" = "yes"; then<br class="">    with_coroutine=winfiber<br class="">  elif test "$os_mac" = "yes"; then<br class="">-    with_coroutine=gthread<br class="">+    with_coroutine=ucontext<br class="">+    AC_DEFINE([_XOPEN_SOURCE], [1], [Define _XOPEN_SOURCE on macOS for<br class="">ucontext])<br class="">  else<br class="">    with_coroutine=ucontext<br class="">  fi<br class="">diff --git a/src/continuation.h b/src/continuation.h<br class="">index 675a257..cbca06e 100644<br class="">--- a/src/continuation.h<br class="">+++ b/src/continuation.h<br class="">@@ -49,7 +49,7 @@ int cc_swap(struct continuation *from, struct continuation<br class="">*to);<br class=""><br class="">#define offset_of(type, member) ((unsigned long)(&((type *)0)->member))<br class="">#define container_of(obj, type, member) \<br class="">-        (type *)(((char *)obj) - offset_of(type, member))<br class="">+        (type *)(void *)(((char *)obj) - offset_of(type, member))<br class=""><br class="">#endif<br class="">/*<br class=""><br class=""></blockquote><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">This change is ok. If it was a member of a structure surely the</span><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">structure must be aligned, if not the code that allocated the structure</span><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">is broken, not container_of.</span><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">Wondering why this change is needed. Maybe code using ucontext is</span><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">causing it?</span><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></div></div></blockquote><div class=""><br class=""></div><div class="">It’s another case that triggers the “cast changes alignment” warning. The correct fix is a SPICE_ALIGNED_CAST.</div></div></blockquote><div class=""><br class=""></div><div class="">I would go then with 3 macros instead of two<br class=""></div><div class=""><br class=""></div><div class="">SPICE_ALIGNED_CAST, SPICE_UNALIGNED_CAST. We know if is aligned or not and we just make the cast, no additional checks.<br class=""></div><div class="">SPICE_ALIGNED_CHECK_CAST. We are not sure and we do the check giving warning<br class=""></div></div></div></blockquote><div><br class=""></div><div>What are the cases where you are sure enough that it’s aligned to not even check? If the compiler does its inlining job properly, the test is a bitmask test witih a constant, so typically one instruction unless it fails. I don’t think it’s really worth having a non-checking variant. Maybe I could add a G_UNLIKELY?</div><div><br class=""></div><div>Christophe</div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;" class=""><div class=""><br class=""></div><div class="">How does it sound?<br class=""></div><div class=""><br class=""></div><div class="">Frediano<br class=""></div><blockquote style="border-left-width: 2px; border-left-style: solid; border-left-color: rgb(16, 16, 255); margin-left: 5px; padding-left: 5px; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica, Arial, sans-serif; font-size: 12pt;" class=""><div class=""><div class=""><br class=""></div><div class="">Christophe</div><div class=""><br class=""></div><br class=""><blockquote class=""><div class=""><div class=""><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Would that be better in your opinion?<br class=""><br class=""><br class="">Christophe<br class=""><br class=""><blockquote class=""><br class="">Regards,<br class="">Daniel<br class=""></blockquote></blockquote><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">Frediano</span><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">_______________________________________________</span><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">Spice-devel mailing list</span><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><a href="mailto:Spice-devel@lists.freedesktop.org" class="" target="_blank" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Spice-devel@lists.freedesktop.org</a><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><a href="https://lists.freedesktop.org/mailman/listinfo/spice-devel" class="" target="_blank" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">https://lists.freedesktop.org/mailman/listinfo/spice-devel</a><br data-mce-bogus="1" class=""></div></div></blockquote></div><br class=""></blockquote><div class=""><br class=""></div></div><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Spice-devel mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""><a href="mailto:Spice-devel@lists.freedesktop.org" class="">Spice-devel@lists.freedesktop.org</a></span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""><a href="https://lists.freedesktop.org/mailman/listinfo/spice-devel" class="">https://lists.freedesktop.org/mailman/listinfo/spice-devel</a></span></div></blockquote></div><br class=""></body></html>