public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] check_GNU_style: Use raw strings.
@ 2024-05-31 19:38 Robin Dapp
  2024-06-03 16:43 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: Robin Dapp @ 2024-05-31 19:38 UTC (permalink / raw)
  To: gcc-patches; +Cc: rdapp.gcc

Hi,

this silences some warnings when using check_GNU_style.

I didn't expect this to have any bootstrap or regtest impact
but I still ran it on x86 - no change.

Regards
 Robin

contrib/ChangeLog:

	* check_GNU_style_lib.py: Use raw strings for regexps.
---
 contrib/check_GNU_style_lib.py | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/contrib/check_GNU_style_lib.py b/contrib/check_GNU_style_lib.py
index f1a120fa8d3..6dbe4b53559 100755
--- a/contrib/check_GNU_style_lib.py
+++ b/contrib/check_GNU_style_lib.py
@@ -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):
-- 
2.45.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] check_GNU_style: Use raw strings.
  2024-05-31 19:38 [PATCH] check_GNU_style: Use raw strings Robin Dapp
@ 2024-06-03 16:43 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2024-06-03 16:43 UTC (permalink / raw)
  To: Robin Dapp, gcc-patches



On 5/31/24 1:38 PM, Robin Dapp wrote:
> Hi,
> 
> this silences some warnings when using check_GNU_style.
> 
> I didn't expect this to have any bootstrap or regtest impact
> but I still ran it on x86 - no change.
> 
> Regards
>   Robin
> 
> contrib/ChangeLog:
> 
> 	* check_GNU_style_lib.py: Use raw strings for regexps.
OK
jeff


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-06-03 16:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-31 19:38 [PATCH] check_GNU_style: Use raw strings Robin Dapp
2024-06-03 16:43 ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).