[libvirt] [PATCH] src: Fix checking for clang

Andrea Bolognani posted 1 patch 6 years ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20180301163738.25229-1-abologna@redhat.com
Test syntax-check passed
src/Makefile.am | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[libvirt] [PATCH] src: Fix checking for clang
Posted by Andrea Bolognani 6 years ago
The check was trying to use the shell variable $CC instead of
the make variable $(CC); it also interpreted grep's return code
wrong: 1 means the provided pattern was *not* matched. As a
result, pdwtags was never run, not even when building with gcc.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 src/Makefile.am | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 5794915246..3bf2da543d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -668,8 +668,7 @@ struct_prefix = ($(libs_prefix)|$(other_prefix))
 # which causes the comparison against expected output to fail, so skip
 # if using clang as CC.
 PDWTAGS = \
-	$(AM_V_GEN)$CC -v 2>&1 | grep -q clang; \
-	if test $$? == 1; then \
+	$(AM_V_GEN)if $(CC) -v 2>&1 | grep -q clang; then \
 	   echo 'WARNING: skipping pdwtags test with Clang' >&2; \
 	   exit 0; \
 	fi; \
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] src: Fix checking for clang
Posted by Daniel P. Berrangé 6 years ago
On Thu, Mar 01, 2018 at 05:37:38PM +0100, Andrea Bolognani wrote:
> The check was trying to use the shell variable $CC instead of
> the make variable $(CC); it also interpreted grep's return code
> wrong: 1 means the provided pattern was *not* matched. As a
> result, pdwtags was never run, not even when building with gcc.

Heh, opps.

Yet another reason for us to move these checks into configure.ac
and then use AM_CONDITIONAL to turn on/off the make rule instead
of playing so many games in shell here.

> Signed-off-by: Andrea Bolognani <abologna@redhat.com>
> ---
>  src/Makefile.am | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/src/Makefile.am b/src/Makefile.am
> index 5794915246..3bf2da543d 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -668,8 +668,7 @@ struct_prefix = ($(libs_prefix)|$(other_prefix))
>  # which causes the comparison against expected output to fail, so skip
>  # if using clang as CC.
>  PDWTAGS = \
> -	$(AM_V_GEN)$CC -v 2>&1 | grep -q clang; \
> -	if test $$? == 1; then \
> +	$(AM_V_GEN)if $(CC) -v 2>&1 | grep -q clang; then \
>  	   echo 'WARNING: skipping pdwtags test with Clang' >&2; \
>  	   exit 0; \
>  	fi; \

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list