From 4712e403c0ccfc6d3d857df61dee1fc910f4451f Mon Sep 17 00:00:00 2001 From: Ionen Wolkens Date: Wed, 11 Dec 2024 05:00:22 -0500 Subject: [PATCH] qt6-build.eclass: split sanitize_cpu_flags checks in separate blocks About to add a new one and increasing the if levels was getting confusing. This way can remove or add new ones without affecting the others. Do need to check the sanitize variable multiple times to avoid running extra checks for nothing though. Signed-off-by: Ionen Wolkens --- eclass/qt6-build.eclass | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/eclass/qt6-build.eclass b/eclass/qt6-build.eclass index 3d3531dd96d53..a0ca9c6194052 100644 --- a/eclass/qt6-build.eclass +++ b/eclass/qt6-build.eclass @@ -309,12 +309,16 @@ _qt6-build_sanitize_cpu_flags() { avx512vp2intersect ) + local sanitize + # check if any known problematic -mno-* C(XX)FLAGS - if ! is-flagq "@($(IFS='|'; echo "${cpuflags[*]/#/-mno-}"))"; then - # check if qsimd_p.h (search for "enable all") will accept -march, and - # further check when -march=haswell is appended (which Qt uses for some - # parts) given combination with other -m* could lead to partial support - local bad flags + is-flagq "@($(IFS='|'; echo "${cpuflags[*]/#/-mno-}"))" && sanitize=1 + + # check if qsimd_p.h (search for "enable all") will accept -march, and + # further check when -march=haswell is appended (which Qt uses for some + # parts) given combination with other -m* could lead to partial support + if [[ ! -v sanitize ]]; then + local flags for flags in '' '-march=haswell'; do : "$($(tc-getCXX) -E -P ${CXXFLAGS} ${CPPFLAGS} ${flags} - <<-EOF | tail -n 1 #if (defined(__AVX2__) && (__BMI__ + __BMI2__ + __F16C__ + __FMA__ + __LZCNT__ + __POPCNT__) != 6) || \ @@ -324,11 +328,15 @@ _qt6-build_sanitize_cpu_flags() { EOF pipestatus || die )" - [[ ${_} == bad ]] && bad=1 && break + if [[ ${_} == bad ]]; then + sanitize=1 + break + fi done - [[ -v bad ]] || return 0 # *should* be fine as-is fi + [[ -v sanitize ]] || return 0 # *should* be fine as-is + # determine highest(known) usable x86-64 feature level local march=$( $(tc-getCXX) -E -P ${CXXFLAGS} ${CPPFLAGS} - <<-EOF | tail -n 1