diff mbox series

[1/1] dtoc: avoid invalid escape sequence '\s'

Message ID 20240227215138.236403-1-heinrich.schuchardt@canonical.com
State Accepted
Commit cf6280371fabfb94fbab3ef006030705f5da6661
Delegated to: Tom Rini
Headers show
Series [1/1] dtoc: avoid invalid escape sequence '\s' | expand

Commit Message

Heinrich Schuchardt Feb. 27, 2024, 9:51 p.m. UTC
\s is not a valid escape sequence in strings.
Mark regular expressions with r''.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 tools/dtoc/src_scan.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Tom Rini March 1, 2024, 6:53 p.m. UTC | #1
On Tue, Feb 27, 2024 at 10:51:38PM +0100, Heinrich Schuchardt wrote:

> \s is not a valid escape sequence in strings.
> Mark regular expressions with r''.
> 
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/tools/dtoc/src_scan.py b/tools/dtoc/src_scan.py
index 3bef59d616..2437200a42 100644
--- a/tools/dtoc/src_scan.py
+++ b/tools/dtoc/src_scan.py
@@ -291,8 +291,8 @@  class Scanner:
         """
         structs = {}
 
-        re_struct = re.compile('^struct ([a-z0-9_]+) {$')
-        re_asm = re.compile('../arch/[a-z0-9]+/include/asm/(.*)')
+        re_struct = re.compile(r'^struct ([a-z0-9_]+) {$')
+        re_asm = re.compile(r'../arch/[a-z0-9]+/include/asm/(.*)')
         prefix = ''
         for line in buff.splitlines():
             # Handle line continuation
@@ -470,8 +470,8 @@  class Scanner:
         re_of_match = re.compile(
             r'\.of_match\s*=\s*(of_match_ptr\()?([a-z0-9_]+)([^,]*),')
 
-        re_phase = re.compile('^\s*DM_PHASE\((.*)\).*$')
-        re_hdr = re.compile('^\s*DM_HEADER\((.*)\).*$')
+        re_phase = re.compile(r'^\s*DM_PHASE\((.*)\).*$')
+        re_hdr = re.compile(r'^\s*DM_HEADER\((.*)\).*$')
         re_alias = re.compile(r'DM_DRIVER_ALIAS\(\s*(\w+)\s*,\s*(\w+)\s*\)')
 
         # Matches the struct name for priv, plat