From 3331b6eab3976fbfa2afc196d37667036f3f4967 Mon Sep 17 00:00:00 2001 From: Serge Guelton Date: Mon, 11 Feb 2019 15:03:17 +0000 Subject: [tools] Fix python DeprecationWarning: invalid escape sequence MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The python documentation says "it’s highly recommended that you use raw strings for all but the simplest expressions." (https://docs.python.org/3/library/re.html) So do that with the attached patch generated by sed -i -e "s/re.search('/re.search(r'/g" $(git grep -l 're.search(') The warning can be seen in e.g. python3.7: $ python3.7 -Wd >>> import re; re.search('\s', '') :1: DeprecationWarning: invalid escape sequence \s Commited on behalf of Marco Falke. Differential Revision: https://reviews.llvm.org/D57528 llvm-svn: 353707 --- clang/tools/scan-build-py/libscanbuild/analyze.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'clang/tools/scan-build-py') diff --git a/clang/tools/scan-build-py/libscanbuild/analyze.py b/clang/tools/scan-build-py/libscanbuild/analyze.py index bac259cde2d..49de387c704 100644 --- a/clang/tools/scan-build-py/libscanbuild/analyze.py +++ b/clang/tools/scan-build-py/libscanbuild/analyze.py @@ -97,7 +97,7 @@ def need_analyzer(args): when compiler wrappers are used. That's the moment when build setup check the compiler and capture the location for the build process. """ - return len(args) and not re.search('configure|autogen', args[0]) + return len(args) and not re.search(r'configure|autogen', args[0]) def prefix_with(constant, pieces): -- cgit v1.2.3