Skip to content

Commit

Permalink
eliminate python SyntaxWarnings from check-all output.
Browse files Browse the repository at this point in the history
```
src_dir/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py:28: SyntaxWarning: invalid escape sequence '\*'    self.implementationContent += """
src_dir/llvm/utils/lit/lit/TestRunner.py:205: SyntaxWarning: invalid escape sequence '\c'                      """
src_dir/llvm/utils/lit/lit/TestRunner.py:1561: SyntaxWarning: invalid escape sequence '\s'                     match = _caching_re_compile("^\s*%else\s*(%{)?").search(ln)
src_dir/libcxx/utils/libcxx/test/format.py:64: SyntaxWarning: invalid escape sequence '\s'                     for output in re.split('[$]\s*":"\s*"RUN: at line \d+"', fullOutput):
src_dir/libcxx/utils/libcxx/test/params.py:121: SyntaxWarning: invalid escape sequence '\+'                    AddSubstitution("%{cxx_std}", re.sub("\+", "x", std)),
src_dir/libcxx/utils/libcxx/test/params.py:214: SyntaxWarning: invalid escape sequence '\+'                    AddFeature("stdlib=libc++") if re.match(".+-libc\+\+", stdlib) else None,
src_dir/compiler-rt/test/lit.common.cfg.py:800: SyntaxWarning: invalid escape sequence '\$'                    "-Wl,-z,origin -Wl,-rpath,\$ORIGIN -L%T -l%xdynamiclib_namespec"
src_dir/compiler-rt/test/lit.common.cfg.py:809: SyntaxWarning: invalid escape sequence '\$'                    "-Wl,-rpath,\$ORIGIN -L%T -l%xdynamiclib_namespec" + postfix,
src_dir/compiler-rt/test/lit.common.cfg.py:817: SyntaxWarning: invalid escape sequence '\$'                    "-Wl,-R\$ORIGIN -L%T -l%xdynamiclib_namespec" + postfix,
src_dir/llvm/test/lit.cfg.py:275: SyntaxWarning: invalid escape sequence '\d'                                  match = re.search("release (\d+)\.(\d+)", ptxas_out)
```
  • Loading branch information
eleftg authored and tru committed Nov 27, 2023
1 parent f6c231c commit e919a83
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(self, templateClasses):

def GeneratePrologue(self):

self.implementationContent += """
self.implementationContent += r"""
/*===- Generated file -------------------------------------------*- C++ -*-===*\
|* *|
|* Introspection of available AST node SourceLocations *|
Expand Down
6 changes: 3 additions & 3 deletions compiler-rt/test/lit.common.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ def is_windows_lto_supported():
config.substitutions.append(
(
"%ld_flags_rpath_exe" + postfix,
"-Wl,-z,origin -Wl,-rpath,\$ORIGIN -L%T -l%xdynamiclib_namespec"
r"-Wl,-z,origin -Wl,-rpath,\$ORIGIN -L%T -l%xdynamiclib_namespec"
+ postfix,
)
)
Expand All @@ -806,15 +806,15 @@ def is_windows_lto_supported():
config.substitutions.append(
(
"%ld_flags_rpath_exe" + postfix,
"-Wl,-rpath,\$ORIGIN -L%T -l%xdynamiclib_namespec" + postfix,
r"-Wl,-rpath,\$ORIGIN -L%T -l%xdynamiclib_namespec" + postfix,
)
)
config.substitutions.append(("%ld_flags_rpath_so" + postfix, ""))
elif config.host_os == "SunOS":
config.substitutions.append(
(
"%ld_flags_rpath_exe" + postfix,
"-Wl,-R\$ORIGIN -L%T -l%xdynamiclib_namespec" + postfix,
r"-Wl,-R\$ORIGIN -L%T -l%xdynamiclib_namespec" + postfix,
)
)
config.substitutions.append(("%ld_flags_rpath_so" + postfix, ""))
Expand Down
2 changes: 1 addition & 1 deletion libcxx/utils/libcxx/test/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def _parseLitOutput(fullOutput):
injecting additional Lit output around it.
"""
parsed = ''
for output in re.split('[$]\s*":"\s*"RUN: at line \d+"', fullOutput):
for output in re.split(r'[$]\s*":"\s*"RUN: at line \d+"', fullOutput):
if output: # skip blank lines
commandOutput = re.search("# command output:\n(.+)\n$", output, flags=re.DOTALL)
if commandOutput:
Expand Down
4 changes: 2 additions & 2 deletions libcxx/utils/libcxx/test/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def getModuleFlag(cfg, enable_modules):
),
actions=lambda std: [
AddFeature(std),
AddSubstitution("%{cxx_std}", re.sub("\+", "x", std)),
AddSubstitution("%{cxx_std}", re.sub(r"\+", "x", std)),
AddCompileFlag(lambda cfg: getStdFlag(cfg, std)),
],
),
Expand Down Expand Up @@ -211,7 +211,7 @@ def getModuleFlag(cfg, enable_modules):
AddFeature("stdlib={}".format(stdlib)),
# Also add an umbrella feature 'stdlib=libc++' for all flavors of libc++, to simplify
# the test suite.
AddFeature("stdlib=libc++") if re.match(".+-libc\+\+", stdlib) else None,
AddFeature("stdlib=libc++") if re.match(r".+-libc\+\+", stdlib) else None,
],
),
),
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def ptxas_version(ptxas):
ptxas_cmd = subprocess.Popen([ptxas, "--version"], stdout=subprocess.PIPE)
ptxas_out = ptxas_cmd.stdout.read().decode("ascii")
ptxas_cmd.wait()
match = re.search("release (\d+)\.(\d+)", ptxas_out)
match = re.search(r"release (\d+)\.(\d+)", ptxas_out)
if match:
return (int(match.group(1)), int(match.group(2)))
print("couldn't determine ptxas version")
Expand Down
4 changes: 2 additions & 2 deletions llvm/utils/lit/lit/TestRunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def expand_glob_expressions(args, cwd):


def quote_windows_command(seq):
"""
r"""
Reimplement Python's private subprocess.list2cmdline for MSys compatibility
Based on CPython implementation here:
Expand Down Expand Up @@ -1558,7 +1558,7 @@ def tryParseIfCond(ln):
return cond, ln

def tryParseElse(ln):
match = _caching_re_compile("^\s*%else\s*(%{)?").search(ln)
match = _caching_re_compile(r"^\s*%else\s*(%{)?").search(ln)
if not match:
return False, ln
if not match.group(1):
Expand Down

0 comments on commit e919a83

Please sign in to comment.