Skip to content

Commit

Permalink
Retract "DQSQ" merging in NVCC arguments handling.
Browse files Browse the repository at this point in the history
No coverage, no tests, unreadable, unused, likely premature
optimization.
  • Loading branch information
obilaniu committed Mar 12, 2021
1 parent 2b2739d commit 6911f49
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions mesonbuild/compilers/cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,21 +217,6 @@ def _shield_nvcc_list_arg(cls, arg: str, listmode: bool=True) -> str:
# strings between them.
l = [cls._shield_nvcc_list_arg(s) for s in arg.split(SQ)]
l = sum([[s, DQSQ] for s in l][:-1], []) # Interleave l with DQSQs

# The list l now has the structure of shielded strings interleaved
# with double-quoted single-quotes.
#
# Plain concatenation would result in the tripling of the length of
# a string made up only of single quotes. See if we can merge some
# DQSQs together first.
def isdqsq(x:str) -> bool:
return x.startswith(SQ) and x.endswith(SQ) and x[1:-1].strip(SQ) == ''
for i in range(1, len(l)-2, 2):
if isdqsq(l[i]) and l[i+1] == '' and isdqsq(l[i+2]):
l[i+2] = l[i][:-1]+l[i+2][1:]
l[i] = ''

# With DQSQs merged, simply concatenate everything together and return.
return ''.join(l)
else:
# A comma is present, and list mode was active.
Expand Down

0 comments on commit 6911f49

Please sign in to comment.