qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [patch] Add spare checker support to the build system
@ 2008-10-07  9:46 Gerd Hoffmann
  2008-10-07 19:16 ` Anthony Liguori
  2008-10-07 19:21 ` Blue Swirl
  0 siblings, 2 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2008-10-07  9:46 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 356 bytes --]

  Hi,

This adds support for running the sparse checker during the build
process.  Left it off by default for now, build becomes very noisy with
sparse checking turned on as it has to complain alot (partly even in the
system headers!).  The qemu code base needs quite some cleanups before
we should consider turning it on by default.

please apply,
  Gerd

[-- Attachment #2: 0038-build-system-sparse-checker-support.patch --]
[-- Type: text/plain, Size: 2285 bytes --]

>From aa926354ee308d46fdbb92667b6ed6f6f9b11ce7 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Tue, 7 Oct 2008 11:22:11 +0200
Subject: [PATCH] build system: sparse checker support.


Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 configure |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/configure b/configure
index 9c8ed81..5b23b33 100755
--- a/configure
+++ b/configure
@@ -85,6 +85,7 @@ case "$cpu" in
   ;;
 esac
 gprof="no"
+sparse="no"
 bigendian="no"
 mingw32="no"
 EXESUF=""
@@ -286,6 +287,10 @@ for opt do
   ;;
   --audio-drv-list=*) audio_drv_list="$optarg"
   ;;
+  --enable-sparse) sparse="yes"
+  ;;
+  --disable-sparse) sparse="no"
+  ;;
   --disable-vnc-tls) vnc_tls="no"
   ;;
   --disable-slirp) slirp="no"
@@ -425,6 +430,7 @@ echo "  --host-cc=CC             use C compiler CC [$host_cc] for dyngen etc."
 echo "  --make=MAKE              use specified make [$make]"
 echo "  --install=INSTALL        use specified install [$install]"
 echo "  --static                 enable static build [$static]"
+echo "  --disable-sparse         disable sparse checker"
 echo "  --disable-werror         disable compilation abort on warning"
 echo "  --disable-sdl            disable SDL"
 echo "  --enable-cocoa           enable COCOA (Mac OS X only)"
@@ -536,6 +542,10 @@ EOF
     fi
 fi
 
+if test ! -x "$(which cgcc 2>/dev/null)"; then
+    sparse="no"
+fi
+
 #
 # Solaris specific configure tool chain decisions
 #
@@ -1007,6 +1017,7 @@ echo "host CPU          $cpu"
 echo "host big endian   $bigendian"
 echo "target list       $target_list"
 echo "gprof enabled     $gprof"
+echo "sparse enabled    $sparse"
 echo "profiler          $profiler"
 echo "static build      $static"
 echo "-Werror enabled   $werror"
@@ -1156,6 +1167,11 @@ case "$cpu" in
     exit 1
   ;;
 esac
+if test "$sparse" = "yes" ; then
+  echo "CC      := REAL_CC=\"\$(CC)\" cgcc"       >> $config_mak
+  echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_mak
+  echo "CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
+fi
 if test "$bigendian" = "yes" ; then
   echo "WORDS_BIGENDIAN=yes" >> $config_mak
   echo "#define WORDS_BIGENDIAN 1" >> $config_h
-- 
1.5.5.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [patch] Add spare checker support to the build system
  2008-10-07  9:46 [Qemu-devel] [patch] Add spare checker support to the build system Gerd Hoffmann
@ 2008-10-07 19:16 ` Anthony Liguori
  2008-10-07 19:21 ` Blue Swirl
  1 sibling, 0 replies; 6+ messages in thread
From: Anthony Liguori @ 2008-10-07 19:16 UTC (permalink / raw)
  To: qemu-devel

Gerd Hoffmann wrote:
>   Hi,
>
> This adds support for running the sparse checker during the build
> process.  Left it off by default for now, build becomes very noisy with
> sparse checking turned on as it has to complain alot (partly even in the
> system headers!).  The qemu code base needs quite some cleanups before
> we should consider turning it on by default.
>   

Applied.  Thanks.

You're missing a help description for --enable-sparse.  Could you please 
send a new patch adding that?

Regards,

Anthony Liguori

> please apply,
>   Gerd
>   

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [patch] Add spare checker support to the build system
  2008-10-07  9:46 [Qemu-devel] [patch] Add spare checker support to the build system Gerd Hoffmann
  2008-10-07 19:16 ` Anthony Liguori
@ 2008-10-07 19:21 ` Blue Swirl
  2008-10-07 20:02   ` Anthony Liguori
  2008-10-07 20:56   ` Gerd Hoffmann
  1 sibling, 2 replies; 6+ messages in thread
From: Blue Swirl @ 2008-10-07 19:21 UTC (permalink / raw)
  To: qemu-devel

On 10/7/08, Gerd Hoffmann <kraxel@redhat.com> wrote:
>   Hi,
>
>  This adds support for running the sparse checker during the build
>  process.  Left it off by default for now, build becomes very noisy with
>  sparse checking turned on as it has to complain alot (partly even in the
>  system headers!).  The qemu code base needs quite some cleanups before
>  we should consider turning it on by default.

Cool, with sparse, I found and fixed one real bug and found one
missing 'static' just in target-sparc.

The cgcc test should try compiling a program like the C compiler test.
Maybe those tests could be merged?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [patch] Add spare checker support to the build system
  2008-10-07 19:21 ` Blue Swirl
@ 2008-10-07 20:02   ` Anthony Liguori
  2008-10-07 20:57     ` Gerd Hoffmann
  2008-10-07 20:56   ` Gerd Hoffmann
  1 sibling, 1 reply; 6+ messages in thread
From: Anthony Liguori @ 2008-10-07 20:02 UTC (permalink / raw)
  To: qemu-devel

Blue Swirl wrote:
> On 10/7/08, Gerd Hoffmann <kraxel@redhat.com> wrote:
>   
>>   Hi,
>>
>>  This adds support for running the sparse checker during the build
>>  process.  Left it off by default for now, build becomes very noisy with
>>  sparse checking turned on as it has to complain alot (partly even in the
>>  system headers!).  The qemu code base needs quite some cleanups before
>>  we should consider turning it on by default.
>>     
>
> Cool, with sparse, I found and fixed one real bug and found one
> missing 'static' just in target-sparc.
>
> The cgcc test should try compiling a program like the C compiler test.
> Maybe those tests could be merged?
>   

It should if we're enabling it by default.  Since we don't enable it by 
default, presumably the user has a working version of sparse.

Also, to enable it by default, we need to think about how it interacts 
with cross compilers and other versions of GCC other than the default gcc.

Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [patch] Add spare checker support to the build system
  2008-10-07 19:21 ` Blue Swirl
  2008-10-07 20:02   ` Anthony Liguori
@ 2008-10-07 20:56   ` Gerd Hoffmann
  1 sibling, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2008-10-07 20:56 UTC (permalink / raw)
  To: qemu-devel

Blue Swirl wrote:
> Cool, with sparse, I found and fixed one real bug and found one
> missing 'static' just in target-sparc.

Great it proved being useful that quickly ;)

> The cgcc test should try compiling a program like the C compiler test.
> Maybe those tests could be merged?

cgcc isn't a compiler, it's a wrapper which runs both the real compiler
and the sparse checker, roughly comparable to distcc and ccache.  So if
$CC works, cgcc should too.

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [patch] Add spare checker support to the build system
  2008-10-07 20:02   ` Anthony Liguori
@ 2008-10-07 20:57     ` Gerd Hoffmann
  0 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2008-10-07 20:57 UTC (permalink / raw)
  To: qemu-devel

  Hi,

> Also, to enable it by default, we need to think about how it interacts
> with cross compilers and other versions of GCC other than the default gcc.

Oh, cross builds are supposed to work just fine with sparse enabled.

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-10-07 20:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-07  9:46 [Qemu-devel] [patch] Add spare checker support to the build system Gerd Hoffmann
2008-10-07 19:16 ` Anthony Liguori
2008-10-07 19:21 ` Blue Swirl
2008-10-07 20:02   ` Anthony Liguori
2008-10-07 20:57     ` Gerd Hoffmann
2008-10-07 20:56   ` Gerd Hoffmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).