microsoft-gsl: upgrade 4.2.2 -> 5.0.0

Release notes:
https://github.com/microsoft/GSL/releases/tag/v5.0.0

Switch to the rel/5.0 branch. New in this release is the gsl::dyn_array
container, so the -dev package gains include/gsl/dyn_array.

Fix the build with clang 22. The tests are compiled with -Weverything
-Werror, so every new clang diagnostic becomes a build failure; the newly
added lifetime-safety suggestions produce:

  notnull_tests.cpp:63:19: error: parameter in intra-TU constructor should
    be marked [[clang::lifetimebound]]
    [-Werror,-Wlifetime-safety-intra-tu-constructor-suggestions]

Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Khem Raj
2026-09-08 08:23:17 -07:00
parent e2cc2b4e02
commit 2eaf5f05b5
2 changed files with 24 additions and 10 deletions
@@ -1,4 +1,14 @@
#!/bin/sh
gsl_tests && echo "PASS: gsl_tests" || echo "FAIL: gsl_tests"
gsl_noexcept_tests && echo "PASS: gsl_noexcept_tests" || echo "FAIL: gsl_noexcept_tests"
# Upstream builds one executable per tests/*.cpp source, so iterate rather
# than naming them individually.
cd "$(dirname "$0")" || exit 1
for t in *_tests; do
[ -x "./$t" ] || continue
if "./$t"; then
echo "PASS: $t"
else
echo "FAIL: $t"
fi
done
@@ -8,10 +8,10 @@ HOMEPAGE = "https://github.com/microsoft/GSL"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=363055e71e77071107ba2bb9a54bd9a7"
SRC_URI = "git://github.com/microsoft/GSL.git;protocol=https;branch=rel/4.2;tag=v${PV} \
SRC_URI = "git://github.com/microsoft/GSL.git;protocol=https;branch=rel/5.0;tag=v${PV} \
file://run-ptest \
"
SRCREV = "152d6eb989a1ecd23fe9c9cfb2fb8cfc7c0cd0c1"
SRCREV = "417ef685eafd626db765f0027b7fc5a0057e0770"
inherit cmake pkgconfig ptest
@@ -24,18 +24,22 @@ PACKAGECONFIG ??= "${@bb.utils.contains('PTEST_ENABLED', '1', 'ptest','', d)}"
PACKAGECONFIG[ptest] = "-DGSL_TEST=ON,-DGSL_TEST=OFF,googletest"
# clang disagrees with https://github.com/google/googletest/pull/3457
CXXFLAGS:append:toolchain-clang = " -Wno-error=switch-default"
# The tests are built with -Weverything -Werror, so each clang release turns
# its new diagnostics into build failures.
CXXFLAGS:append:toolchain-clang = "\
-Wno-error=switch-default \
-Wno-unknown-warning-option \
-Wno-error=lifetime-safety-intra-tu-suggestions \
-Wno-error=lifetime-safety-intra-tu-constructor-suggestions \
"
# Disable disabled-macro-expansion warning as error as its seen on musl
CXXFLAGS:append:toolchain-clang:libc-musl = " -Wno-error=disabled-macro-expansion"
do_install_ptest() {
install -d ${D}${bindir}
install -m 0755 ${B}/tests/gsl_tests ${D}${bindir}
install -m 0755 ${B}/tests/gsl_noexcept_tests ${D}${bindir}
install -d ${D}${PTEST_PATH}
install -m 0755 ${B}/tests/*_tests ${D}${PTEST_PATH}
}
FILES:${PN}-ptest = "${bindir}/gsl*_tests"
# there is already other gsl recipe, so recipe name does not match the real component name
CVE_PRODUCT = "microsoft:gsl"