RE: [PATCH] Fix compile warning at MeeGo The gcc version is MeeGo 4.5.1
Hi Marcel: > it is a false positive. > > The only caller that uses the cond value is sim_set_cf_indicator. And it > only uses conf if the return value is TRUE. So where can this go wrong? You are right. I will ask MeeGo tool chain guy to resolve it. > Marcel > > > ___ > ofono mailing list > ofono@ofono.org > http://lists.ofono.org/listinfo/ofono ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
RE: [PATCH] Fix compile warning at MeeGo The gcc version is MeeGo 4.5.1
Hi Martin, > > > src/call-forwarding.c |2 +- > > > 1 files changed, 1 insertions(+), 1 deletions(-) > > > > > > diff --git a/src/call-forwarding.c b/src/call-forwarding.c > > > index 512f223..36ba4f1 100644 > > > --- a/src/call-forwarding.c > > > +++ b/src/call-forwarding.c > > > @@ -246,7 +246,7 @@ static gboolean is_cfu_enabled(struct > > ofono_call_forwarding *cf, > > > static void sim_set_cf_indicator(struct ofono_call_forwarding *cf) > > > { > > > gboolean cfu_voice; > > > - struct ofono_call_forwarding_condition *cond; > > > + struct ofono_call_forwarding_condition *cond = NULL; > > > > > > cfu_voice = is_cfu_enabled(cf, &cond); > > > > I really hate trying to fix compiler warnings like this. > > > > /* > > * For now we only support Voice, although Fax & all Data > > * basic services are applicable as well. > > */ > > for (; l; l = l->next) { > > cond = l->data; > > > > if (cond->cls > BEARER_CLASS_VOICE) > > continue; > > > > if (out) > > *out = cond; > > > > return TRUE; > > } > > > > return FALSE; > > > > So this is clearly a false positive. The only why this would fail is > This is not a false positive, it is quite possible not to reach the "for(;;)" > branch, and uninitialized the *cond. > I have added > *out = NULL; > Out of the branch, and found that the warning gone. > So here I think gcc is right, and we need the patch. it is a false positive. The only caller that uses the cond value is sim_set_cf_indicator. And it only uses conf if the return value is TRUE. So where can this go wrong? Regards Marcel ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
RE: [PATCH] Fix compile warning at MeeGo The gcc version is MeeGo 4.5.1
> -Original Message- > From: ofono-boun...@ofono.org [mailto:ofono-boun...@ofono.org] On Behalf > Of Marcel Holtmann > Sent: Friday, January 07, 2011 1:45 AM > To: ofono@ofono.org > Subject: Re: [PATCH] Fix compile warning at MeeGo The gcc version is MeeGo > 4.5.1 > > Hi Martin, > > > src/call-forwarding.c |2 +- > > 1 files changed, 1 insertions(+), 1 deletions(-) > > > > diff --git a/src/call-forwarding.c b/src/call-forwarding.c > > index 512f223..36ba4f1 100644 > > --- a/src/call-forwarding.c > > +++ b/src/call-forwarding.c > > @@ -246,7 +246,7 @@ static gboolean is_cfu_enabled(struct > ofono_call_forwarding *cf, > > static void sim_set_cf_indicator(struct ofono_call_forwarding *cf) > > { > > gboolean cfu_voice; > > - struct ofono_call_forwarding_condition *cond; > > + struct ofono_call_forwarding_condition *cond = NULL; > > > > cfu_voice = is_cfu_enabled(cf, &cond); > > I really hate trying to fix compiler warnings like this. > > /* > * For now we only support Voice, although Fax & all Data > * basic services are applicable as well. > */ > for (; l; l = l->next) { > cond = l->data; > > if (cond->cls > BEARER_CLASS_VOICE) > continue; > > if (out) > *out = cond; > > return TRUE; > } > > return FALSE; > > So this is clearly a false positive. The only why this would fail is This is not a false positive, it is quite possible not to reach the "for(;;)" branch, and uninitialized the *cond. I have added *out = NULL; Out of the branch, and found that the warning gone. So here I think gcc is right, and we need the patch. > when l->data is NULL, but even then cond is initialized properly. > > Regards > > Marcel > > > ___ > ofono mailing list > ofono@ofono.org > http://lists.ofono.org/listinfo/ofono ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH] Fix compile warning at MeeGo The gcc version is MeeGo 4.5.1
Hi Martin, > src/call-forwarding.c |2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/src/call-forwarding.c b/src/call-forwarding.c > index 512f223..36ba4f1 100644 > --- a/src/call-forwarding.c > +++ b/src/call-forwarding.c > @@ -246,7 +246,7 @@ static gboolean is_cfu_enabled(struct > ofono_call_forwarding *cf, > static void sim_set_cf_indicator(struct ofono_call_forwarding *cf) > { > gboolean cfu_voice; > - struct ofono_call_forwarding_condition *cond; > + struct ofono_call_forwarding_condition *cond = NULL; > > cfu_voice = is_cfu_enabled(cf, &cond); I really hate trying to fix compiler warnings like this. /* * For now we only support Voice, although Fax & all Data * basic services are applicable as well. */ for (; l; l = l->next) { cond = l->data; if (cond->cls > BEARER_CLASS_VOICE) continue; if (out) *out = cond; return TRUE; } return FALSE; So this is clearly a false positive. The only why this would fail is when l->data is NULL, but even then cond is initialized properly. Regards Marcel ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH] Fix compile warning at MeeGo The gcc version is MeeGo 4.5.1
On Thu, Jan 6, 2011 at 7:54 AM, Xu, Martin wrote: > Using the old version of gcc 4.4.2 I did not meet the issue, but using 4.5.1, > we have warning. Humn, gcc 4.5.2 here and I don't get the warning. IMHO, this warning doesn't make sense. Lucas De Marchi ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH] Fix compile warning at MeeGo The gcc version is MeeGo 4.5.1
From: Martin Xu --- src/call-forwarding.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/call-forwarding.c b/src/call-forwarding.c index 512f223..36ba4f1 100644 --- a/src/call-forwarding.c +++ b/src/call-forwarding.c @@ -246,7 +246,7 @@ static gboolean is_cfu_enabled(struct ofono_call_forwarding *cf, static void sim_set_cf_indicator(struct ofono_call_forwarding *cf) { gboolean cfu_voice; - struct ofono_call_forwarding_condition *cond; + struct ofono_call_forwarding_condition *cond = NULL; cfu_voice = is_cfu_enabled(cf, &cond); -- 1.7.2.2 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
RE: [PATCH] Fix compile warning at MeeGo The gcc version is MeeGo 4.5.1
> -Original Message- > From: ofono-boun...@ofono.org [mailto:ofono-boun...@ofono.org] On Behalf > Of Sjur Br?ndeland > Sent: Thursday, January 06, 2011 5:49 PM > To: ofono@ofono.org > Cc: blutolan (none) > Subject: Re: [PATCH] Fix compile warning at MeeGo The gcc version is MeeGo > 4.5.1 > > Hi Martin. > > On Thu, Jan 6, 2011 at 10:46 AM, wrote: > > From: blutolan Thanks, just reinstall the system, and missing that. :-) ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
RE: [PATCH] Fix compile warning at MeeGo The gcc version is MeeGo 4.5.1
Using the old version of gcc 4.4.2 I did not meet the issue, but using 4.5.1, we have warning. > -Original Message- > From: Xu, Martin > Sent: Thursday, January 06, 2011 5:46 PM > To: ofono@ofono.org > Cc: Xu, Martin; blutolan > Subject: [PATCH] Fix compile warning at MeeGo The gcc version is MeeGo 4.5.1 > > From: blutolan > > --- > src/call-forwarding.c |2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/src/call-forwarding.c b/src/call-forwarding.c > index 512f223..36ba4f1 100644 > --- a/src/call-forwarding.c > +++ b/src/call-forwarding.c > @@ -246,7 +246,7 @@ static gboolean is_cfu_enabled(struct > ofono_call_forwarding *cf, > static void sim_set_cf_indicator(struct ofono_call_forwarding *cf) > { > gboolean cfu_voice; > - struct ofono_call_forwarding_condition *cond; > + struct ofono_call_forwarding_condition *cond = NULL; > > cfu_voice = is_cfu_enabled(cf, &cond); > > -- > 1.7.2.2 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH] Fix compile warning at MeeGo The gcc version is MeeGo 4.5.1
Hi Martin. On Thu, Jan 6, 2011 at 10:46 AM, wrote: > From: blutolan Your git-config is wrong, you need to set name and email right in your git-config before committing. Regards, Sjur ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH] Fix compile warning at MeeGo The gcc version is MeeGo 4.5.1
From: blutolan --- src/call-forwarding.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/call-forwarding.c b/src/call-forwarding.c index 512f223..36ba4f1 100644 --- a/src/call-forwarding.c +++ b/src/call-forwarding.c @@ -246,7 +246,7 @@ static gboolean is_cfu_enabled(struct ofono_call_forwarding *cf, static void sim_set_cf_indicator(struct ofono_call_forwarding *cf) { gboolean cfu_voice; - struct ofono_call_forwarding_condition *cond; + struct ofono_call_forwarding_condition *cond = NULL; cfu_voice = is_cfu_enabled(cf, &cond); -- 1.7.2.2 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono