diff mbox series

[RFA] gdbhooks: regex syntax error

Message ID 20240206220835.70591-1-jason@redhat.com
State New
Headers show
Series [RFA] gdbhooks: regex syntax error | expand

Commit Message

Jason Merrill Feb. 6, 2024, 10:07 p.m. UTC
Briefly tested that break-on-pass completion works.  Oddly, it also works
without the patch, but the fix still seems worthwhile.  OK for trunk?

-- 8< --

Recent python complains about this pattern with
  SyntaxWarning: invalid escape sequence '\s'
because \s in a regular string just means 's'; for it to mean whitespace,
you need \\ or for the pattern to be a raw string.

gcc/ChangeLog:

	* gdbhooks.py: Fix regex syntax.
---
 gcc/gdbhooks.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


base-commit: c5d34912ad576be1ef19be92f7eabde54b9089eb

Comments

Jason Merrill Feb. 12, 2024, 11:21 p.m. UTC | #1
Ping

On 2/6/24 17:07, Jason Merrill wrote:
> Briefly tested that break-on-pass completion works.  Oddly, it also works
> without the patch, but the fix still seems worthwhile.  OK for trunk?
> 
> -- 8< --
> 
> Recent python complains about this pattern with
>    SyntaxWarning: invalid escape sequence '\s'
> because \s in a regular string just means 's'; for it to mean whitespace,
> you need \\ or for the pattern to be a raw string.
> 
> gcc/ChangeLog:
> 
> 	* gdbhooks.py: Fix regex syntax.
> ---
>   gcc/gdbhooks.py | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gcc/gdbhooks.py b/gcc/gdbhooks.py
> index 3fa62652c61..92e38880a70 100644
> --- a/gcc/gdbhooks.py
> +++ b/gcc/gdbhooks.py
> @@ -642,7 +642,7 @@ class PassNames:
>           self.names = []
>           with open(os.path.join(srcdir, 'passes.def')) as f:
>               for line in f:
> -                m = re.match('\s*NEXT_PASS \(([^,]+).*\);', line)
> +                m = re.match(r'\s*NEXT_PASS \(([^,]+).*\);', line)
>                   if m:
>                       self.names.append(m.group(1))
>   
> 
> base-commit: c5d34912ad576be1ef19be92f7eabde54b9089eb
diff mbox series

Patch

diff --git a/gcc/gdbhooks.py b/gcc/gdbhooks.py
index 3fa62652c61..92e38880a70 100644
--- a/gcc/gdbhooks.py
+++ b/gcc/gdbhooks.py
@@ -642,7 +642,7 @@  class PassNames:
         self.names = []
         with open(os.path.join(srcdir, 'passes.def')) as f:
             for line in f:
-                m = re.match('\s*NEXT_PASS \(([^,]+).*\);', line)
+                m = re.match(r'\s*NEXT_PASS \(([^,]+).*\);', line)
                 if m:
                     self.names.append(m.group(1))