Skip to content

Commit eba5498

Browse files
pobrnjpakkane
authored andcommitted
compilers: cpp: fix header name and return value use in header check
There are two issues: 1. has_header() wants just the header name without surrounding <> or similar; it fails otherwise. 2. has_header() returns a tuple of two bools, where the first element determines whether or not the header has been found. So use that element specifically, otherwise the tuple will always evaluate to true because it is not empty. Fixes: 675b47b ("compilers: cpp: improve libc++ vs libstdc++ detection (again)")
1 parent 03ffb5b commit eba5498

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mesonbuild/compilers/cpp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ class _StdCPPLibMixin(CompilerMixinBase):
185185

186186
def language_stdlib_provider(self, env: Environment) -> str:
187187
# https://stackoverflow.com/a/31658120
188-
header = 'version' if self.has_header('<version>', '', env) else 'ciso646'
188+
header = 'version' if self.has_header('version', '', env)[0] else 'ciso646'
189189
is_libcxx = self.has_header_symbol(header, '_LIBCPP_VERSION', '', env)[0]
190190
lib = 'c++' if is_libcxx else 'stdc++'
191191
return lib

0 commit comments

Comments
 (0)