[libvirt] [PATCH v2 1/5] make: skip pdwtags when building with CLang

Andrea Bolognani abologna at redhat.com
Wed Feb 28 15:17:56 UTC 2018


On Wed, 2018-02-28 at 14:55 +0000, Daniel P. Berrangé wrote:
> When building with CLang the structs that are emitted by pdwtags appear
> in a completely different order than with GCC, which causes the
> comparison against expected data to fail.
> 
> Ideally the test would not be sensitive to the ordering, because even
> future GCC could cause changes, but that's not easy to fix. So for now
> just skip the test when using clang.
> 
> Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
> ---
>  src/Makefile.am | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)

Where have I seen this already? Oh, right :)

  https://www.redhat.com/archives/libvir-list/2016-March/msg00514.html

> diff --git a/src/Makefile.am b/src/Makefile.am
> index 8d72f2f1e5..4207421986 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -664,8 +664,16 @@ struct_prefix = ($(libs_prefix)|$(other_prefix))
>  # remote/{,.libs/}libvirt_driver_remote_la-remote_protocol.o.  We want
>  # the newest of the two, in case configure options changed and a stale
>  # file is left around from an earlier build.
> +# The pdwtags output is completely different when building with clang
> +# which causes the comparison against expected output to fail, so skip
> +# if using clang as CC.
>  PDWTAGS = \
> -	$(AM_V_GEN)if (pdwtags --help) > /dev/null 2>&1; then \
> +	$(AM_V_GEN)$CC -v 2>&1 | grep clang >/dev/null; \
> +	if test $$? == 1; then \
> +	   echo 'WARNING: skipping pdwtags test with Clang' >&2; \
> +	   exit 0; \
> +	fi; \

You could do

  if $(CC) -v 2>&1 | grep -q clang; then
    ...

instead, it's shorter.

> +	if (pdwtags --help) > /dev/null 2>&1; then \
>  	  o=`ls -t $(<:.lo=.$(OBJEXT)) \
>  	     $(subst /,/.libs/,$(<:.lo=.$(OBJEXT))) \
>  	    2>/dev/null | sed -n 1p`; \

Reviewed-by: Andrea Bolognani <abologna at redhat.com>

-- 
Andrea Bolognani / Red Hat / Virtualization




More information about the libvir-list mailing list