diff options
author | Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> | 2017-09-07 11:24:46 +0200 |
---|---|---|
committer | Maxin B. John <maxin.john@intel.com> | 2017-09-26 18:16:48 +0300 |
commit | 60a3b62bddf69ec114f0ffdb5ca8ac7b5b37716e (patch) | |
tree | 40a7d0da722f5d0990d4069da8602ba36c7e6d46 | |
parent | 858ef7ef84530695629465ad76d2708796ffb0f6 (diff) | |
download | meta-java-60a3b62bddf69ec114f0ffdb5ca8ac7b5b37716e.tar.gz |
openjdk-8-common: Fix warning evaluating CFLAGS
Code is (on my opinion) simpler, making use of the dumpversion flag, instead of calling the pre-processor via a pipe.
Flag has been tested on both clang gcc:
ricardo@neopili:~/curro/qt5022/build-qt5022-pyro/repo/java$ gcc-4.8 -dumpversion
4.8
ricardo@neopili:~/curro/qt5022/build-qt5022-pyro/repo/java$ gcc-4.9 -dumpversion
4.9.3
ricardo@neopili:~/curro/qt5022/build-qt5022-pyro/repo/java$ gcc-5 -dumpversion
5.4.1
ricardo@neopili:~/curro/qt5022/build-qt5022-pyro/repo/java$ gcc-6 -dumpversion
6.4.0
ricardo@neopili:~/curro/qt5022/build-qt5022-pyro/repo/java$ gcc-7 -dumpversion
7
ricardo@neopili:~/curro/qt5022/build-qt5022-pyro/repo/java$ clang-4.0 -dumpversion
4.2.1
Without this patch:
WARNING:
/home/ricardo/curro/qt5022/build-qt5022-pyro/repo/yocto/../java/recipes-core/openjdk/openjdk-8-native_102b14.bb:
Unable to export ${CXXFLAGS}: Failure expanding variable CXXFLAGS,
expression was
-isystem/home/ricardo/curro/qt5022/build-qt5022-pyro/build/tmp/work/x86_64-linux/openjdk-8-native/102b14-r0/recipe-sysroot-native/usr/include
-O2 -pipe -D_GLIBCXX_USE_CXX11_ABI=0 ${@version_specific_cflags(d)}
${@jdk_cpp_options(d)} which triggered exception IndexError: string
index out of range
WARNING:
/home/ricardo/curro/qt5022/build-qt5022-pyro/repo/yocto/../java/recipes-core/openjdk/openjdk-8-native_102b14.bb:
Unable to export ${CFLAGS}: Failure expanding variable CFLAGS,
expression was
-isystem/home/ricardo/curro/qt5022/build-qt5022-pyro/build/tmp/work/x86_64-linux/openjdk-8-native/102b14-r0/recipe-sysroot-native/usr/include
-O2 -pipe -Wno-error=deprecated-declarations
${@version_specific_cflags(d)} ${@jdk_cpp_options(d)} which triggered
exception IndexError: string index out of range
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Maxin B. John <maxin.john@intel.com>
-rw-r--r-- | recipes-core/openjdk/openjdk-8-common.inc | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/recipes-core/openjdk/openjdk-8-common.inc b/recipes-core/openjdk/openjdk-8-common.inc index 0c5c2c3..83828e1 100644 --- a/recipes-core/openjdk/openjdk-8-common.inc +++ b/recipes-core/openjdk/openjdk-8-common.inc | |||
@@ -238,13 +238,9 @@ def version_specific_cflags(d): | |||
238 | if bb.data.inherits_class('native', d): | 238 | if bb.data.inherits_class('native', d): |
239 | from subprocess import Popen, PIPE | 239 | from subprocess import Popen, PIPE |
240 | 240 | ||
241 | cmd = d.expand('${CPP} -P -').split() | 241 | cmd = d.expand('${CC} -dumpversion').split() |
242 | cc = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) | 242 | cc = Popen(cmd, stdout=PIPE, stderr=PIPE) |
243 | # This check is GCC specific. Clang always returns 4. For Clang | 243 | version = cc.communicate()[0].decode('utf-8')[0] |
244 | # __clang_major__ and __clang_minor__ need to be checked. Ideally | ||
245 | # __GNUC_MINOR__ would be checked as well, but for this recipe | ||
246 | # GCC major is all we care about. | ||
247 | version = cc.communicate(b'__GNUC__')[0].decode('utf-8')[0] | ||
248 | else: | 244 | else: |
249 | # in the cross case, trust that GCCVERSION is correct. This won't | 245 | # in the cross case, trust that GCCVERSION is correct. This won't |
250 | # work if the native toolchain is Clang, but as of this writing that | 246 | # work if the native toolchain is Clang, but as of this writing that |