diff mbox series

[09/11] vulkan-samples: Don't turn clang 23's -Wdangling-gsl into an error

Message ID 20260830125853.1139807-10-sunilkumar.dora@windriver.com
State New
Headers show
Series clang/llvm: Upgrade to 23.1.0 | expand

Commit Message

Dora, Sunil Kumar Aug. 30, 2026, 12:58 p.m. UTC
From: Sunil Dora <sunilkumar.dora@windriver.com>

clang 23's lifetime analysis flags the framework's
postprocessing_computepass.cpp taking .begin() of a temporary, and the
project builds with -Werror:

  framework/rendering/postprocessing_computepass.cpp:154:33: error:
  object backing the pointer will be destroyed at the end of the
  full-expression [-Werror,-Wdangling-gsl]

The warning is a true positive: get_resources() returns a vector by
value, so the code compares iterators from two different temporaries
and later dereferences a dangling one. The affected class is unused
(Vulkan-Samples issue #841) but still compiled everywhere. Reported
upstream with analysis and a proposed fix:
https://github.com/KhronosGroup/Vulkan-Samples/issues/1570

Fixing the framework source is upstream's call; from the recipe, extend
the existing clang workaround flags to keep the warning non-fatal.

Signed-off-by: Sunil Dora <sunilkumar.dora@windriver.com>
---
 meta/recipes-graphics/vulkan/vulkan-samples_git.bb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta/recipes-graphics/vulkan/vulkan-samples_git.bb b/meta/recipes-graphics/vulkan/vulkan-samples_git.bb
index 75d7a39eb6..3d965ff22e 100644
--- a/meta/recipes-graphics/vulkan/vulkan-samples_git.bb
+++ b/meta/recipes-graphics/vulkan/vulkan-samples_git.bb
@@ -31,6 +31,8 @@  EXTRA_OECMAKE += "-DVKB_WSI_SELECTION=D2D"
 
 # Clang is fussy about incompatible options on aarch64/x86_64
 # x86_64-poky-linux-clang++: error: overriding '-ffp-model=precise' option with '-ffp-contract=fast' [-Werror,-Woverriding-option]
-CXXFLAGS:append:toolchain-clang = " -Wno-error=overriding-option"
+# clang 23's -Wdangling-gsl also flags framework code taking .begin() of a
+# temporary (postprocessing_computepass.cpp); keep it a warning, not an error.
+CXXFLAGS:append:toolchain-clang = " -Wno-error=overriding-option -Wno-error=dangling-gsl"
 
 COMPATIBLE_HOST = "(aarch64|x86_64).*-linux"