Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Commit

Permalink
No longer scan for -num-threads=X (specifically the form with the e…
Browse files Browse the repository at this point in the history
…qual sign).

We've always supported this, but `swiftc` today doesn't accept the version with the equal sign and briefly looking through the history of Options.td I can't find any evidence that it ever did. We continue to support space-separated `-num-threads X`.

PiperOrigin-RevId: 355647561
  • Loading branch information
allevato authored and swiple-rules-gardener committed Feb 4, 2021
1 parent 1bea35e commit d26868f
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions swift/internal/compiling.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2191,9 +2191,9 @@ def _disable_autolink_framework_copts(framework_name):
def _find_num_threads_flag_value(user_compile_flags):
"""Finds the value of the `-num-threads` flag.
This function looks for both forms of the flag (`-num-threads X` and
`-num-threads=X`) and returns the corresponding value if found. If the flag
is present multiple times, the last value is the one returned.
This function looks for the `-num-threads` flag and returns the
corresponding value if found. If the flag is present multiple times, the
last value is the one returned.
Args:
user_compile_flags: The options passed into the compile action.
Expand All @@ -2202,15 +2202,13 @@ def _find_num_threads_flag_value(user_compile_flags):
The numeric value of the `-num-threads` flag if found, otherwise `None`.
"""
num_threads = None
saw_space_separated_num_threads = False
saw_num_threads = False
for copt in user_compile_flags:
if saw_space_separated_num_threads:
saw_space_separated_num_threads = False
if saw_num_threads:
saw_num_threads = False
num_threads = _safe_int(copt)
elif copt == "-num-threads":
saw_space_separated_num_threads = True
elif copt.startswith("-num-threads="):
num_threads = _safe_int(copt.split("=")[1])
saw_num_threads = True
return num_threads

def _emitted_output_nature(feature_configuration, user_compile_flags):
Expand Down

0 comments on commit d26868f

Please sign in to comment.