https://github.com/urnathan created https://github.com/llvm/llvm-project/pull/71170
With Fedora 39, I encountered 2 new python warnings: /home/nathan/gh/llvm/push/strict-aliasing/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py:28: SyntaxWarning: invalid escape sequence '\*' self.implementationContent += """ /home/nathan/gh/llvm/push/strict-aliasing/llvm/test/lit.cfg.py:274: SyntaxWarning: invalid escape sequence '\d' match = re.search("release (\d+)\.(\d+)", ptxas_out) Use raw strings here. I guess python got pickier or something? While there, might as well fix the blank line caused by """NEWLINE ... """ by dropping its first char. >From 9b5cb1ac8d4b9a2aaa4c06e41620e38b6c3cae8c Mon Sep 17 00:00:00 2001 From: Nathan Sidwell <nat...@acm.org> Date: Thu, 2 Nov 2023 18:14:05 -0400 Subject: [PATCH] Fix python escapes With Fedora 39, I encountered 2 new python warnings: /home/nathan/gh/llvm/push/strict-aliasing/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py:28: SyntaxWarning: invalid escape sequence '\*' self.implementationContent += """ /home/nathan/gh/llvm/push/strict-aliasing/llvm/test/lit.cfg.py:274: SyntaxWarning: invalid escape sequence '\d' match = re.search("release (\d+)\.(\d+)", ptxas_out) Use raw strings here. I guess python got pickier or something? May as well fix the blank line caused by """NEWLINE ... """ --- clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py | 4 ++-- llvm/test/lit.cfg.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py b/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py index dafb332961ede86..54cfd0741f9d122 100755 --- a/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py +++ b/clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py @@ -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 *| @@ -58,7 +58,7 @@ def GeneratePrologue(self): private: std::vector<clang::TypeLoc> &TLRG; }; -""" +"""[1:] def GenerateBaseGetLocationsDeclaration(self, CladeName): InstanceDecoration = "*" diff --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py index ab245b71cdd16a5..cf050bbfe3b1413 100644 --- a/llvm/test/lit.cfg.py +++ b/llvm/test/lit.cfg.py @@ -271,7 +271,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") _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits