diff mbox

[04/39] fix sparse support (?)

Message ID 1286888457-5033-5-git-send-email-pbonzini@redhat.com
State New
Headers show

Commit Message

Paolo Bonzini Oct. 12, 2010, 1 p.m. UTC
I didn't test with sparse, but the old code using += before a variable
was set was wrong.  Sparse support should probably be ripped out or
redone, but this at least keeps some sanity.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

Comments

Blue Swirl Oct. 12, 2010, 7:02 p.m. UTC | #1
On Tue, Oct 12, 2010 at 1:00 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> I didn't test with sparse, but the old code using += before a variable
> was set was wrong.  Sparse support should probably be ripped out or
> redone, but this at least keeps some sanity.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  configure |   10 +++++-----
>  1 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/configure b/configure
> index 9e2ae71..6b5c323 100755
> --- a/configure
> +++ b/configure
> @@ -2617,17 +2617,17 @@ echo "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak
>  echo "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak
>  echo "CC=$cc" >> $config_host_mak
>  echo "HOST_CC=$host_cc" >> $config_host_mak
> -if test "$sparse" = "yes" ; then
> -  echo "CC      := REAL_CC=\"\$(CC)\" cgcc"       >> $config_host_mak
> -  echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_host_mak
> -  echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
> -fi
>  echo "AR=$ar" >> $config_host_mak
>  echo "OBJCOPY=$objcopy" >> $config_host_mak
>  echo "LD=$ld" >> $config_host_mak
>  echo "WINDRES=$windres" >> $config_host_mak
>  echo "CFLAGS=$CFLAGS" >> $config_host_mak
>  echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
> +if test "$sparse" = "yes" ; then
> +  echo "CC           := REAL_CC=\"\$(CC)\" cgcc"       >> $config_host_mak
> +  echo "HOST_CC      := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_host_mak
> +  echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak

Could these be added to general list of compiler flags that are
checked and used automatically if the compiler accepts them?
Paolo Bonzini Oct. 13, 2010, 7:15 a.m. UTC | #2
On 10/12/2010 09:02 PM, Blue Swirl wrote:
> On Tue, Oct 12, 2010 at 1:00 PM, Paolo Bonzini<pbonzini@redhat.com>  wrote:
>> I didn't test with sparse, but the old code using += before a variable
>> was set was wrong.  Sparse support should probably be ripped out or
>> redone, but this at least keeps some sanity.
>>
>> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
>> ---
>>   configure |   10 +++++-----
>>   1 files changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/configure b/configure
>> index 9e2ae71..6b5c323 100755
>> --- a/configure
>> +++ b/configure
>> @@ -2617,17 +2617,17 @@ echo "INSTALL_DATA=$install -m0644 -p">>  $config_host_mak
>>   echo "INSTALL_PROG=$install -m0755 -p">>  $config_host_mak
>>   echo "CC=$cc">>  $config_host_mak
>>   echo "HOST_CC=$host_cc">>  $config_host_mak
>> -if test "$sparse" = "yes" ; then
>> -  echo "CC      := REAL_CC=\"\$(CC)\" cgcc">>  $config_host_mak
>> -  echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc">>  $config_host_mak
>> -  echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null">>  $config_host_mak
>> -fi
>>   echo "AR=$ar">>  $config_host_mak
>>   echo "OBJCOPY=$objcopy">>  $config_host_mak
>>   echo "LD=$ld">>  $config_host_mak
>>   echo "WINDRES=$windres">>  $config_host_mak
>>   echo "CFLAGS=$CFLAGS">>  $config_host_mak
>>   echo "QEMU_CFLAGS=$QEMU_CFLAGS">>  $config_host_mak
>> +if test "$sparse" = "yes" ; then
>> +  echo "CC           := REAL_CC=\"\$(CC)\" cgcc">>  $config_host_mak
>> +  echo "HOST_CC      := REAL_CC=\"\$(HOST_CC)\" cgcc">>  $config_host_mak
>> +  echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null">>  $config_host_mak
>
> Could these be added to general list of compiler flags that are
> checked and used automatically if the compiler accepts them?

The problem is that the tests are done with the REAL_CC, not with 
sparse, so the tests will not pass.  I will look at it some time, but 
for now I just wanted to avoid WTF moments for reviewers of later patches.

Paolo
diff mbox

Patch

diff --git a/configure b/configure
index 9e2ae71..6b5c323 100755
--- a/configure
+++ b/configure
@@ -2617,17 +2617,17 @@  echo "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak
 echo "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak
 echo "CC=$cc" >> $config_host_mak
 echo "HOST_CC=$host_cc" >> $config_host_mak
-if test "$sparse" = "yes" ; then
-  echo "CC      := REAL_CC=\"\$(CC)\" cgcc"       >> $config_host_mak
-  echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_host_mak
-  echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
-fi
 echo "AR=$ar" >> $config_host_mak
 echo "OBJCOPY=$objcopy" >> $config_host_mak
 echo "LD=$ld" >> $config_host_mak
 echo "WINDRES=$windres" >> $config_host_mak
 echo "CFLAGS=$CFLAGS" >> $config_host_mak
 echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
+if test "$sparse" = "yes" ; then
+  echo "CC           := REAL_CC=\"\$(CC)\" cgcc"       >> $config_host_mak
+  echo "HOST_CC      := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_host_mak
+  echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
+fi
 echo "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
 echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
 echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak