Patchwork gcc-common: Don't use "is" for comparing strings, use "=="

login
register
mail settings
Submitter Kartik Mohta
Date July 4, 2012, 3:21 a.m.
Message ID <1341372067-24821-1-git-send-email-kartikmohta@gmail.com>
Download mbox | patch
Permalink /patch/31139/
State Accepted
Commit 7fd82cc90a48302ed42b6bfa962bb0de2c652b45
Headers show

Comments

Kartik Mohta - July 4, 2012, 3:21 a.m.
Needed because the equality check was failing here even though upon
printing the LHS and RHS were the same.
As per http://stackoverflow.com/a/2987975/64537, using "is" compares the
memory addresses of the two objects which is not what we want here. We
just want to compare the values.

Signed-off-by: Kartik Mohta <kartikmohta@gmail.com>
---
 meta/recipes-devtools/gcc/gcc-common.inc |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Khem Raj - July 4, 2012, 6:36 a.m.
On Tue, Jul 3, 2012 at 8:21 PM, Kartik Mohta <kartikmohta@gmail.com> wrote:
> Needed because the equality check was failing here even though upon
> printing the LHS and RHS were the same.
> As per http://stackoverflow.com/a/2987975/64537, using "is" compares the
> memory addresses of the two objects which is not what we want here. We
> just want to compare the values.

indeed. This looks ok

>
> Signed-off-by: Kartik Mohta <kartikmohta@gmail.com>
> ---
>  meta/recipes-devtools/gcc/gcc-common.inc |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/meta/recipes-devtools/gcc/gcc-common.inc b/meta/recipes-devtools/gcc/gcc-common.inc
> index 45828bb..0a9324a 100644
> --- a/meta/recipes-devtools/gcc/gcc-common.inc
> +++ b/meta/recipes-devtools/gcc/gcc-common.inc
> @@ -10,7 +10,7 @@ inherit autotools gettext
>  FILESDIR = "${@os.path.dirname(d.getVar('FILE',1))}/gcc-${PV}"
>
>  def get_gcc_fpu_setting(bb, d):
> -    if d.getVar('ARMPKGSFX_EABI', True) is "hf" and  d.getVar('TRANSLATED_TARGET_ARCH', True) is "arm":
> +    if d.getVar('ARMPKGSFX_EABI', True) == "hf" and d.getVar('TRANSLATED_TARGET_ARCH', True) == "arm":
>          return "--with-float=hard"
>      if d.getVar('TARGET_FPU', True) in [ 'soft' ]:
>          return "--with-float=soft"
> --
> 1.7.4.1
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Saul Wold - July 9, 2012, 5:24 p.m.
On 07/03/2012 08:21 PM, Kartik Mohta wrote:
> Needed because the equality check was failing here even though upon
> printing the LHS and RHS were the same.
> As per http://stackoverflow.com/a/2987975/64537, using "is" compares the
> memory addresses of the two objects which is not what we want here. We
> just want to compare the values.
>
> Signed-off-by: Kartik Mohta <kartikmohta@gmail.com>
> ---
>   meta/recipes-devtools/gcc/gcc-common.inc |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/meta/recipes-devtools/gcc/gcc-common.inc b/meta/recipes-devtools/gcc/gcc-common.inc
> index 45828bb..0a9324a 100644
> --- a/meta/recipes-devtools/gcc/gcc-common.inc
> +++ b/meta/recipes-devtools/gcc/gcc-common.inc
> @@ -10,7 +10,7 @@ inherit autotools gettext
>   FILESDIR = "${@os.path.dirname(d.getVar('FILE',1))}/gcc-${PV}"
>
>   def get_gcc_fpu_setting(bb, d):
> -    if d.getVar('ARMPKGSFX_EABI', True) is "hf" and  d.getVar('TRANSLATED_TARGET_ARCH', True) is "arm":
> +    if d.getVar('ARMPKGSFX_EABI', True) == "hf" and d.getVar('TRANSLATED_TARGET_ARCH', True) == "arm":
>           return "--with-float=hard"
>       if d.getVar('TARGET_FPU', True) in [ 'soft' ]:
>           return "--with-float=soft"
>

Merged into OE-Core

Thanks
	Sau!

Patch

diff --git a/meta/recipes-devtools/gcc/gcc-common.inc b/meta/recipes-devtools/gcc/gcc-common.inc
index 45828bb..0a9324a 100644
--- a/meta/recipes-devtools/gcc/gcc-common.inc
+++ b/meta/recipes-devtools/gcc/gcc-common.inc
@@ -10,7 +10,7 @@  inherit autotools gettext
 FILESDIR = "${@os.path.dirname(d.getVar('FILE',1))}/gcc-${PV}"
 
 def get_gcc_fpu_setting(bb, d):
-    if d.getVar('ARMPKGSFX_EABI', True) is "hf" and  d.getVar('TRANSLATED_TARGET_ARCH', True) is "arm":
+    if d.getVar('ARMPKGSFX_EABI', True) == "hf" and d.getVar('TRANSLATED_TARGET_ARCH', True) == "arm":
         return "--with-float=hard"
     if d.getVar('TARGET_FPU', True) in [ 'soft' ]:
         return "--with-float=soft"