mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-26 21:33:59 +08:00
check_GNU_style: Use raw strings.
This silences some warnings when using check_GNU_style. contrib/ChangeLog: * check_GNU_style_lib.py: Use raw strings for regexps.
This commit is contained in:
parent
68b0742a49
commit
03e1a72703
@ -103,7 +103,7 @@ class SpacesCheck:
|
||||
|
||||
class SpacesAndTabsMixedCheck:
|
||||
def __init__(self):
|
||||
self.re = re.compile('\ \t')
|
||||
self.re = re.compile(r'\ \t')
|
||||
|
||||
def check(self, filename, lineno, line):
|
||||
stripped = line.lstrip()
|
||||
@ -115,7 +115,7 @@ class SpacesAndTabsMixedCheck:
|
||||
|
||||
class TrailingWhitespaceCheck:
|
||||
def __init__(self):
|
||||
self.re = re.compile('(\s+)$')
|
||||
self.re = re.compile(r'(\s+)$')
|
||||
|
||||
def check(self, filename, lineno, line):
|
||||
assert(len(line) == 0 or line[-1] != '\n')
|
||||
@ -128,7 +128,7 @@ class TrailingWhitespaceCheck:
|
||||
|
||||
class SentenceSeparatorCheck:
|
||||
def __init__(self):
|
||||
self.re = re.compile('\w\.(\s|\s{3,})\w')
|
||||
self.re = re.compile(r'\w\.(\s|\s{3,})\w')
|
||||
|
||||
def check(self, filename, lineno, line):
|
||||
m = self.re.search(line)
|
||||
@ -140,7 +140,7 @@ class SentenceSeparatorCheck:
|
||||
|
||||
class SentenceEndOfCommentCheck:
|
||||
def __init__(self):
|
||||
self.re = re.compile('\w\.(\s{0,1}|\s{3,})\*/')
|
||||
self.re = re.compile(r'\w\.(\s{0,1}|\s{3,})\*/')
|
||||
|
||||
def check(self, filename, lineno, line):
|
||||
m = self.re.search(line)
|
||||
@ -152,7 +152,7 @@ class SentenceEndOfCommentCheck:
|
||||
|
||||
class SentenceDotEndCheck:
|
||||
def __init__(self):
|
||||
self.re = re.compile('\w(\s*\*/)')
|
||||
self.re = re.compile(r'\w(\s*\*/)')
|
||||
|
||||
def check(self, filename, lineno, line):
|
||||
m = self.re.search(line)
|
||||
@ -164,7 +164,7 @@ class SentenceDotEndCheck:
|
||||
class FunctionParenthesisCheck:
|
||||
# TODO: filter out GTY stuff
|
||||
def __init__(self):
|
||||
self.re = re.compile('\w(\s{2,})?(\()')
|
||||
self.re = re.compile(r'\w(\s{2,})?(\()')
|
||||
|
||||
def check(self, filename, lineno, line):
|
||||
if '#define' in line:
|
||||
@ -179,7 +179,7 @@ class FunctionParenthesisCheck:
|
||||
|
||||
class SquareBracketCheck:
|
||||
def __init__(self):
|
||||
self.re = re.compile('\w\s+(\[)')
|
||||
self.re = re.compile(r'\w\s+(\[)')
|
||||
|
||||
def check(self, filename, lineno, line):
|
||||
if filename.endswith('.md'):
|
||||
@ -194,7 +194,7 @@ class SquareBracketCheck:
|
||||
|
||||
class ClosingParenthesisCheck:
|
||||
def __init__(self):
|
||||
self.re = re.compile('\S\s+(\))')
|
||||
self.re = re.compile(r'\S\s+(\))')
|
||||
|
||||
def check(self, filename, lineno, line):
|
||||
m = self.re.search(line)
|
||||
@ -208,7 +208,7 @@ class BracesOnSeparateLineCheck:
|
||||
# This will give false positives for C99 compound literals.
|
||||
|
||||
def __init__(self):
|
||||
self.re = re.compile('(\)|else)\s*({)')
|
||||
self.re = re.compile(r'(\)|else)\s*({)')
|
||||
|
||||
def check(self, filename, lineno, line):
|
||||
m = self.re.search(line)
|
||||
@ -219,7 +219,7 @@ class BracesOnSeparateLineCheck:
|
||||
|
||||
class TrailinigOperatorCheck:
|
||||
def __init__(self):
|
||||
regex = '^\s.*(([^a-zA-Z_]\*)|([-%<=&|^?])|([^*]/)|([^:][+]))$'
|
||||
regex = r'^\s.*(([^a-zA-Z_]\*)|([-%<=&|^?])|([^*]/)|([^:][+]))$'
|
||||
self.re = re.compile(regex)
|
||||
|
||||
def check(self, filename, lineno, line):
|
||||
|
Loading…
Reference in New Issue
Block a user