Commit 03b4fe7de226a54540a487a0dbd4c749c5d1c2af
1 parent
797d5db0
Add sparse checker support to the build system (Gerd Hoffman)
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. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5440 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
16 additions
and
0 deletions
configure
... | ... | @@ -85,6 +85,7 @@ case "$cpu" in |
85 | 85 | ;; |
86 | 86 | esac |
87 | 87 | gprof="no" |
88 | +sparse="no" | |
88 | 89 | bigendian="no" |
89 | 90 | mingw32="no" |
90 | 91 | EXESUF="" |
... | ... | @@ -285,6 +286,10 @@ for opt do |
285 | 286 | ;; |
286 | 287 | --audio-drv-list=*) audio_drv_list="$optarg" |
287 | 288 | ;; |
289 | + --enable-sparse) sparse="yes" | |
290 | + ;; | |
291 | + --disable-sparse) sparse="no" | |
292 | + ;; | |
288 | 293 | --disable-vnc-tls) vnc_tls="no" |
289 | 294 | ;; |
290 | 295 | --disable-slirp) slirp="no" |
... | ... | @@ -422,6 +427,7 @@ echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc." |
422 | 427 | echo " --make=MAKE use specified make [$make]" |
423 | 428 | echo " --install=INSTALL use specified install [$install]" |
424 | 429 | echo " --static enable static build [$static]" |
430 | +echo " --disable-sparse disable sparse checker" | |
425 | 431 | echo " --disable-werror disable compilation abort on warning" |
426 | 432 | echo " --disable-sdl disable SDL" |
427 | 433 | echo " --enable-cocoa enable COCOA (Mac OS X only)" |
... | ... | @@ -532,6 +538,10 @@ EOF |
532 | 538 | fi |
533 | 539 | fi |
534 | 540 | |
541 | +if test ! -x "$(which cgcc 2>/dev/null)"; then | |
542 | + sparse="no" | |
543 | +fi | |
544 | + | |
535 | 545 | # |
536 | 546 | # Solaris specific configure tool chain decisions |
537 | 547 | # |
... | ... | @@ -987,6 +997,7 @@ echo "host CPU $cpu" |
987 | 997 | echo "host big endian $bigendian" |
988 | 998 | echo "target list $target_list" |
989 | 999 | echo "gprof enabled $gprof" |
1000 | +echo "sparse enabled $sparse" | |
990 | 1001 | echo "profiler $profiler" |
991 | 1002 | echo "static build $static" |
992 | 1003 | echo "-Werror enabled $werror" |
... | ... | @@ -1135,6 +1146,11 @@ case "$cpu" in |
1135 | 1146 | exit 1 |
1136 | 1147 | ;; |
1137 | 1148 | esac |
1149 | +if test "$sparse" = "yes" ; then | |
1150 | + echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak | |
1151 | + echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak | |
1152 | + echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak | |
1153 | +fi | |
1138 | 1154 | if test "$bigendian" = "yes" ; then |
1139 | 1155 | echo "WORDS_BIGENDIAN=yes" >> $config_mak |
1140 | 1156 | echo "#define WORDS_BIGENDIAN 1" >> $config_h | ... | ... |