From 30f8d6ec67d9ae73f651a93cf531656e7a89ac75 Mon Sep 17 00:00:00 2001 From: Liu Zheng Date: Tue, 2 Jun 2026 17:54:09 +0800 Subject: [PATCH] GnuCompiler.has_arguments: detect "not supported for this target" warnings GCC may exit with code 0 while emitting a warning that an option is "not supported for this target" (e.g., HPPA with -fstack-protector). Add this pattern to the stderr inspection in has_arguments() so such flags are correctly reported as unsupported. Fixes: #5355 --- mesonbuild/compilers/mixins/gnu.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mesonbuild/compilers/mixins/gnu.py b/mesonbuild/compilers/mixins/gnu.py index 25208796ea30..63ab3edb9feb 100644 --- a/mesonbuild/compilers/mixins/gnu.py +++ b/mesonbuild/compilers/mixins/gnu.py @@ -604,6 +604,8 @@ def has_arguments(self, args: T.List[str], code: str, result = False if self.language in {'c', 'objc'} and 'is valid for C++/ObjC++' in p.stderr: result = False + if 'not supported for this target' in p.stderr: + result = False return result, p.cached def get_has_func_attribute_extra_args(self, name: str) -> T.List[str]: