Skip to content

Commit d96e623

Browse files
lgoettgensaviatesk
authored andcommitted
Fix JET-reported issues in BinaryPlatforms.triplet(::AbstractPlatform) (#59343)
The issue is that JET reported that in `libgfortran_version(p).major` the first arg of `getproperty` could be `nothing`. This is already checked in the previous line, but in a way that the compiler cannot remember until that call. Putting it into a variable should fix that. It would be great if this could get backported to at least 1.12 (1.10 and 1.11 would also be great), since that is where people try to use JET for their packages, and this reduces the Base noise in the output.
1 parent ad8dd86 commit d96e623

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

base/binaryplatforms.jl

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -520,14 +520,17 @@ function triplet(p::AbstractPlatform)
520520
)
521521

522522
# Tack on optional compiler ABI flags
523-
if libgfortran_version(p) !== nothing
524-
str = string(str, "-libgfortran", libgfortran_version(p).major)
523+
libgfortran_version_ = libgfortran_version(p)
524+
if libgfortran_version_ !== nothing
525+
str = string(str, "-libgfortran", libgfortran_version_.major)
525526
end
526-
if cxxstring_abi(p) !== nothing
527-
str = string(str, "-", cxxstring_abi(p))
527+
cxxstring_abi_ = cxxstring_abi(p)
528+
if cxxstring_abi_ !== nothing
529+
str = string(str, "-", cxxstring_abi_)
528530
end
529-
if libstdcxx_version(p) !== nothing
530-
str = string(str, "-libstdcxx", libstdcxx_version(p).patch)
531+
libstdcxx_version_ = libstdcxx_version(p)
532+
if libstdcxx_version_ !== nothing
533+
str = string(str, "-libstdcxx", libstdcxx_version_.patch)
531534
end
532535

533536
# Tack on all extra tags

0 commit comments

Comments
 (0)