Remove unneeded back-references.

This commit is contained in:
Markus Reiter 2020-09-18 22:31:23 +02:00
parent a8a921dfaa
commit e3646c9b4e
3 changed files with 7 additions and 5 deletions

View File

@ -166,10 +166,12 @@ module SharedEnvExtension
# end</pre> # end</pre>
def compiler def compiler
@compiler ||= if (cc = @cc) @compiler ||= if (cc = @cc)
warn_about_non_apple_gcc($&) if cc =~ GNU_GCC_REGEXP warn_about_non_apple_gcc(cc) if cc.match?(GNU_GCC_REGEXP)
fetch_compiler(cc, "--cc") fetch_compiler(cc, "--cc")
elsif (cc = homebrew_cc) elsif (cc = homebrew_cc)
warn_about_non_apple_gcc($&) if cc =~ GNU_GCC_REGEXP warn_about_non_apple_gcc(cc) if cc.match?(GNU_GCC_REGEXP)
compiler = fetch_compiler(cc, "HOMEBREW_CC") compiler = fetch_compiler(cc, "HOMEBREW_CC")
if @formula if @formula

View File

@ -46,9 +46,9 @@ module Stdenv
send(compiler) send(compiler)
return unless cc =~ GNU_GCC_REGEXP return unless cc.match?(GNU_GCC_REGEXP)
gcc_formula = gcc_version_formula($&) gcc_formula = gcc_version_formula(cc)
append_path "PATH", gcc_formula.opt_bin.to_s append_path "PATH", gcc_formula.opt_bin.to_s
end end
alias generic_setup_build_environment setup_build_environment alias generic_setup_build_environment setup_build_environment

View File

@ -111,7 +111,7 @@ module Superenv
path.append("/usr/bin", "/bin", "/usr/sbin", "/sbin") path.append("/usr/bin", "/bin", "/usr/sbin", "/sbin")
begin begin
path.append(gcc_version_formula($&).opt_bin) if homebrew_cc =~ GNU_GCC_REGEXP path.append(gcc_version_formula(homebrew_cc).opt_bin) if homebrew_cc.match?(GNU_GCC_REGEXP)
rescue FormulaUnavailableError rescue FormulaUnavailableError
# Don't fail and don't add these formulae to the path if they don't exist. # Don't fail and don't add these formulae to the path if they don't exist.
nil nil