diff mbox series

[1/1] xen/scripts: Fix regex syntax warnings with Python 3.12

Message ID 20241219181352.709315-2-Ariel.Otilibili-Anieli@eurecom.fr (mailing list archive)
State New
Headers show
Series xen/scripts: Fix regex syntax warnings with Python 3.12 | expand

Commit Message

Ariel Otilibili-Anieli Dec. 19, 2024, 6:10 p.m. UTC
Same fix than commit 826a9eb072 (tools: Fix regex syntax warnings with Python 3.12).

It clears out the warning:

```
$ xen/scripts/xen-analysis.py
xen/scripts/xen_analysis/cppcheck_analysis.py:94: SyntaxWarning: invalid escape sequence '\*'
  comment_line_starts = re.match('^[ \t]*/\*.*$', line)
```

The  warning appears only the first time the command is run, then it disappears.

Fixes: 02b26c02c7 (xen/scripts: add cppcheck tool to the xen-analysis.py script)
Signed-off-by: Ariel Otilibili <Ariel.Otilibili-Anieli@eurecom.fr>
--
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Anthony PERARD <anthony.perard@vates.tech>
Cc: Michal Orzel <michal.orzel@amd.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Julien Grall <julien@xen.org>
Cc: "Roger Pau Monné" <roger.pau@citrix.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/scripts/xen_analysis/cppcheck_analysis.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ariel Otilibili-Anieli Dec. 19, 2024, 6:23 p.m. UTC | #1
CCing Luca Fancellu.

On Thursday, December 19, 2024 19:10 CET, Ariel Otilibili <Ariel.Otilibili-Anieli@eurecom.fr> wrote:

> Same fix than commit 826a9eb072 (tools: Fix regex syntax warnings with Python 3.12).
> 
> It clears out the warning:
> 
> ```
> $ xen/scripts/xen-analysis.py
> xen/scripts/xen_analysis/cppcheck_analysis.py:94: SyntaxWarning: invalid escape sequence '\*'
>   comment_line_starts = re.match('^[ \t]*/\*.*$', line)
> ```
> 
> The  warning appears only the first time the command is run, then it disappears.
> 
> Fixes: 02b26c02c7 (xen/scripts: add cppcheck tool to the xen-analysis.py script)
> Signed-off-by: Ariel Otilibili <Ariel.Otilibili-Anieli@eurecom.fr>
> --
> Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> Cc: Anthony PERARD <anthony.perard@vates.tech>
> Cc: Michal Orzel <michal.orzel@amd.com>
> Cc: Jan Beulich <jbeulich@suse.com>
> Cc: Julien Grall <julien@xen.org>
> Cc: "Roger Pau Monné" <roger.pau@citrix.com>
> Cc: Stefano Stabellini <sstabellini@kernel.org>
> ---
>  xen/scripts/xen_analysis/cppcheck_analysis.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/xen/scripts/xen_analysis/cppcheck_analysis.py b/xen/scripts/xen_analysis/cppcheck_analysis.py
> index ce7bda91b6..532a14b0ad 100644
> --- a/xen/scripts/xen_analysis/cppcheck_analysis.py
> +++ b/xen/scripts/xen_analysis/cppcheck_analysis.py
> @@ -91,7 +91,7 @@ def __generate_suppression_list(out_file):
>                          line = header_content[tmp_line]
>                          # Matches a line with just optional spaces/tabs and the
>                          # start of a comment '/*'
> -                        comment_line_starts = re.match('^[ \t]*/\*.*$', line)
> +                        comment_line_starts = re.match(r'^[ \t]*/\*.*$', line)
>                          # Matches a line with text and the end of a comment '*/'
>                          comment_line_stops = re.match(r'^.*\*/$', line)
>                          if (not comment_section) and comment_line_starts:
> -- 
> 2.47.1
>
Luca Fancellu Dec. 20, 2024, 8:49 a.m. UTC | #2
Hi Ariel,

> On 19 Dec 2024, at 18:10, Ariel Otilibili <Ariel.Otilibili-Anieli@eurecom.fr> wrote:
> 
> Same fix than commit 826a9eb072 (tools: Fix regex syntax warnings with Python 3.12).
> 
> It clears out the warning:
> 
> ```
> $ xen/scripts/xen-analysis.py
> xen/scripts/xen_analysis/cppcheck_analysis.py:94: SyntaxWarning: invalid escape sequence '\*'
>  comment_line_starts = re.match('^[ \t]*/\*.*$', line)
> ```
> 
> The  warning appears only the first time the command is run, then it disappears.
> 
> Fixes: 02b26c02c7 (xen/scripts: add cppcheck tool to the xen-analysis.py script)
> Signed-off-by: Ariel Otilibili <Ariel.Otilibili-Anieli@eurecom.fr>
> --

Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
Ariel Otilibili-Anieli Dec. 20, 2024, 9:03 a.m. UTC | #3
On Friday, December 20, 2024 09:49 CET, Luca Fancellu <Luca.Fancellu@arm.com> wrote:

> Hi Ariel,
> 
> > On 19 Dec 2024, at 18:10, Ariel Otilibili <Ariel.Otilibili-Anieli@eurecom.fr> wrote:
> > 
> > Same fix than commit 826a9eb072 (tools: Fix regex syntax warnings with Python 3.12).
> > 
> > It clears out the warning:
> > 
> > ```
> > $ xen/scripts/xen-analysis.py
> > xen/scripts/xen_analysis/cppcheck_analysis.py:94: SyntaxWarning: invalid escape sequence '\*'
> >  comment_line_starts = re.match('^[ \t]*/\*.*$', line)
> > ```
> > 
> > The  warning appears only the first time the command is run, then it disappears.
> > 
> > Fixes: 02b26c02c7 (xen/scripts: add cppcheck tool to the xen-analysis.py script)
> > Signed-off-by: Ariel Otilibili <Ariel.Otilibili-Anieli@eurecom.fr>
> > --
> 
> Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>

Hi Luca; thanks for the feedback.
> 
>
diff mbox series

Patch

diff --git a/xen/scripts/xen_analysis/cppcheck_analysis.py b/xen/scripts/xen_analysis/cppcheck_analysis.py
index ce7bda91b6..532a14b0ad 100644
--- a/xen/scripts/xen_analysis/cppcheck_analysis.py
+++ b/xen/scripts/xen_analysis/cppcheck_analysis.py
@@ -91,7 +91,7 @@  def __generate_suppression_list(out_file):
                         line = header_content[tmp_line]
                         # Matches a line with just optional spaces/tabs and the
                         # start of a comment '/*'
-                        comment_line_starts = re.match('^[ \t]*/\*.*$', line)
+                        comment_line_starts = re.match(r'^[ \t]*/\*.*$', line)
                         # Matches a line with text and the end of a comment '*/'
                         comment_line_stops = re.match(r'^.*\*/$', line)
                         if (not comment_section) and comment_line_starts: