This seems to cause nativesdk-glibc failures when DEBUG_BUILD is used, it fails like this:
../sysdeps/ieee754/ldbl-96/e_jnl.c: In function '__ieee754_jnl':
../sysdeps/ieee754/ldbl-96/e_jnl.c:146:20: error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
b = invsqrtpi * temp / sqrtl (x);
~~~~~~~~~~^~~~~~
the target build suffers from the same, that's why I was using this for a while:
# glibc-2.21 fails to build with:
# iso-2022-cn-ext.c:501:4: error: 'tmpbuf' may be used uninitialized in this function [-Werror=maybe-uninitialized]
# connections.c:1916:1: error: inlining failed in call to 'clear_db_cache': call is unlikely and code size would grow [-Werror=inline]
# add few -Wno-error like meta/recipes-core/glibc/glibc.inc is trying to doin get_optimization function,
# but fails because we append -Os at the end and -O2 is found first
SELECTED_OPTIMIZATION_append_pn-glibc = "${@bb.utils.contains('TUNE_FEATURES', 'webos-minsize', ' -Wno-error=maybe-uninitialized -Wno-error=inline', '', d)}"
There is some logic in meta/recipes-core/glibc/glibc.inc to append -Wno-error to SELECTED_OPTIMIZATION when "-O", "-O1", "-Os" is used, but the same would be needed for BUILD_OPTIMIZATION now.
Or maybe it would be worth marking those uninitialized/unused variables with #pragma instead of injecting -Wno-error?
Then we can get rid of:
python () {
opt_effective = "-O"
for opt in d.getVar('SELECTED_OPTIMIZATION').split():
if opt in ("-O0", "-O", "-O1", "-O2", "-O3", "-Os"):
opt_effective = opt
if opt_effective == "-O0":
bb.fatal("%s can't be built with %s, try -O1 instead" % (d.getVar('PN'), opt_effective))
if opt_effective in ("-O", "-O1", "-Os"):
bb.note("%s doesn't build cleanly with %s, adding -Wno-error to SELECTED_OPTIMIZATION" % (d.getVar('PN'), opt_effective))
d.appendVar("SELECTED_OPTIMIZATION", " -Wno-error")
}
from meta/recipes-core/glibc/glibc.inc (not use about -O0 case) and remove following notes:
NOTE: glibc doesn't build cleanly with -O, adding -Wno-error to SELECTED_OPTIMIZATION
NOTE: nativesdk-glibc doesn't build cleanly with -O, adding -Wno-error to SELECTED_OPTIMIZATION
from every build with DEBUG_BUILD enabled.
What would be the preferred fix?