Patchwork sanity.bbclass: correct the gcc_arch check logic

login
register
mail settings
Submitter Zhenhua Luo
Date June 18, 2013, 10:55 a.m.
Message ID <1371552925-25557-1-git-send-email-zhenhua.luo@freescale.com>
Download mbox | patch
Permalink /patch/51905/
State Superseded
Headers show

Comments

Zhenhua Luo - June 18, 2013, 10:55 a.m.
The gcc arch check result is incorrect when gcc version is older than 4.5.
Sanity checker requests user to add "-march=native" into BUILD_CFLAGS even if
the flag is not supported by host gcc.

The status is 0 when -march=native is supported by host gcc, so set result to
True, otherwise set result to False, the compare express is changed to be more
explicit. 

Signed-off-by: Zhenhua Luo <zhenhua.luo@freescale.com>
---
 meta/classes/sanity.bbclass |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Paul Barker - June 18, 2013, 10:56 a.m.
On 18 June 2013 11:55, Zhenhua Luo <zhenhua.luo@freescale.com> wrote:
> -    if check_gcc_march(sanity_data):
> +    if check_gcc_march(sanity_data) == True:

Unless there's something I've forgotten about Python, these two are
exactly equivalent.

--
Paul Barker

Email: paul@paulbarker.me.uk
http://www.paulbarker.me.uk

Patch

diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 3b9934b..047baa5 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -325,7 +325,7 @@  def check_gcc_march(sanity_data):
         if status != 0:
             # Check if GCC could work with march
             status,result = oe.utils.getstatusoutput("${BUILD_PREFIX}gcc -march=native gcc_test.c -o gcc_test")
-            if status != 0: 
+            if status == 0: 
                 result = True
             else:
                 result = False
@@ -485,7 +485,7 @@  def check_sanity(sanity_data):
         if not check_app_exists("qemu-arm", sanity_data):
             messages = messages + "qemu-native was in ASSUME_PROVIDED but the QEMU binaries (qemu-arm) can't be found in PATH"
 
-    if check_gcc_march(sanity_data):
+    if check_gcc_march(sanity_data) == True:
         messages = messages + "Your gcc version is older than 4.5, please add the following param to local.conf\n \
         BUILD_CFLAGS_append = \" -march=native\"\n"