[libvirt] [PATCH 2/7] build: set STATIC_ANALYSIS when running via clang or coverity

Eric Blake eblake at redhat.com
Wed Apr 14 16:26:12 UTC 2010


On 04/14/2010 10:02 AM, Jim Meyering wrote:
> From: Jim Meyering <meyering at redhat.com>
> 
> * configure.ac (STATIC_ANALYSIS): Define when run via clang's
> scan-build or coverity-prevent's cov-build.
> Use the CLANG_CC and COVERITY_BUILD_COMMAND envvars as witnesses.
> ---
>  configure.ac |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 3505b4a..664eaf0 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -2000,6 +2000,12 @@ AM_CONDITIONAL([WITH_MACVTAP], [test "$with_macvtap" = "yes"])
>  test "x$srcdir" = x. && ! test -f COPYING &&
>  cp -f COPYING.LIB COPYING
> 
> +# Detect when running under the clang static analyzer's scan-build driver
> +# or Coverity-prevent's cov-build.  Define STATIC_ANALYSIS accordingly.
> +test -n "$$CCC_ANALYZER_ANALYSIS$COVERITY_BUILD_COMMAND" && t=1 || t=0

Typo.  This isn't make, so you are blindly setting t=1.  And to be
robust to $COVERITY_BUILD starting with -, it might be better as:

test "x$CCC_ANALYZER_ANALYSIS$COVERITY_BUILD_COMMAND" = x && t=0 || t=1

> +AC_DEFINE_UNQUOTED([STATIC_ANALYSIS], [$t],
> +  [Define to 1 when performing static analysis.])
> +
>  AC_OUTPUT(Makefile src/Makefile include/Makefile docs/Makefile \
>  	  docs/schemas/Makefile \
>  	  gnulib/lib/Makefile \

But ACK to the concept, if 1/7 is independently ACK'd.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 323 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100414/ce5b15fa/attachment-0001.sig>


More information about the libvir-list mailing list