diff options
author | Ionen Wolkens <ionen@gentoo.org> | 2024-12-11 05:00:22 -0500 |
---|---|---|
committer | Ionen Wolkens <ionen@gentoo.org> | 2024-12-11 06:44:29 -0500 |
commit | 4712e403c0ccfc6d3d857df61dee1fc910f4451f (patch) | |
tree | 33432d22bdcaad18bf768eab3939e916ddfc100c | |
parent | sys-kernel/gentoo-sources: drop 6.12.1 (diff) | |
download | gentoo-4712e403c0ccfc6d3d857df61dee1fc910f4451f.tar.gz gentoo-4712e403c0ccfc6d3d857df61dee1fc910f4451f.tar.bz2 gentoo-4712e403c0ccfc6d3d857df61dee1fc910f4451f.zip |
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 <ionen@gentoo.org>
-rw-r--r-- | eclass/qt6-build.eclass | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/eclass/qt6-build.eclass b/eclass/qt6-build.eclass index 3d3531dd96d5..a0ca9c619405 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 |