Skip to content

Commit f3bd91d

Browse files
authored
Merge pull request #19551 from Homebrew/runtime-cpu-detect-optflags
shims/super/cc: tweak optimisation flag handling for runtime CPU detection builds
2 parents fd0c3c0 + 351f7f8 commit f3bd91d

File tree

1 file changed

+4
-1
lines changed
  • Library/Homebrew/shims/super

1 file changed

+4
-1
lines changed

Library/Homebrew/shims/super/cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,10 @@ class Cmd
308308

309309
args << "-w" unless configure?
310310
args << "-#{ENV["HOMEBREW_OPTIMIZATION_LEVEL"]}"
311-
args.concat(optflags) unless runtime_cpu_detection?
311+
optflags.each do |optflag|
312+
flag = optflag.split("=").first
313+
args << optflag if !runtime_cpu_detection? || @args.none? { |arg| arg.start_with?(flag) }
314+
end
312315
args.concat(archflags)
313316
args << "-std=#{@arg0}" if /c[89]9/.match?(@arg0)
314317
args << "-g" if debug_symbols?

0 commit comments

Comments
 (0)