[Spice-devel] [PATCH v2 2/2] Avoid clang warnings on casts with stricter alignment requirements

Christophe de Dinechin christophe at dinechin.org
Wed May 24 08:52:30 UTC 2017


> On 24 May 2017, at 10:46, Christophe Fergeau <cfergeau at redhat.com> wrote:
> 
> On Tue, May 23, 2017 at 07:05:18PM +0200, Christophe de Dinechin wrote:
>>> , another alternative would be to have a --enable-alignment-debug,
>> 
>> I tried that, but the problem is to keep that consistent between
>> spice-common and spice-gdk (they may have different configuration). Do
>> you have a similar case? If so, how do you deal with that?
> 
> Why would they have different configuration? AC_CONFIG_SUBDIRS is going
> to pass the command line args to spice-common configure script, which
> will set (or not set) a SPICE_CHECK_ALIGNMENT #define. There might be a
> small added difficulty of making sure #include <mem.h> pick up that
> #define both when one from files in spice-common/ and in spice-gtk/, but
> that should be workable?
> Or am I missing something?

In practice, I ran into unsatisfied symbols when switching between configurations with the flag set or not. They went away when I did a clean build, but I found this annoying. Maybe there is just some missing dependency between mem.c and config.h? Let me try again, I may have mis-interpreted what was happening.


> 
>> 
>> (I could for example always leave the runtime routines in
>> spice-common, even if checks are disabled there, so that you don’t get
>> unsatisfied symbols. But that seems a bit ugly).
>> 
>> 
>>> or something like glib (SPICE_XXX_DEBUG=alignment:foo:bar)
>> 
>> Sorry, I did not really understand that. Do you mean a run-time flag
>> check? If so, since Frediano was objecting a one-instruction runtime
>> check, I think a runtime flag check would not convince him either.
> 
> Ah, if runtime checks are out, forget this ;)
> 
> Christophe



More information about the Spice-devel mailing list