Files
xen/tools/include
Andrew Cooper 56b77d7db0 build/mkheader: Fix Syntax/DeprecationWarnings
With Python 3.11, the following is emitted during a build:

  tools/include/xen-foreign/mkheader.py:162: DeprecationWarning: invalid escape sequence '\s'
    regex = "#define\s+%s\\b" % define;
  tools/include/xen-foreign/mkheader.py:177: DeprecationWarning: invalid escape sequence '\*'
    input = re.compile("/\*(.*?)\*/", re.S).sub("", input)
  tools/include/xen-foreign/mkheader.py:178: DeprecationWarning: invalid escape sequence '\s'
    input = re.compile("\n\s*\n", re.S).sub("\n", input);
  tools/include/xen-foreign/mkheader.py:182: DeprecationWarning: invalid escape sequence '\s'
    regex = "union\s+%s\s*\{(.*?)\n\};" % union;
  tools/include/xen-foreign/mkheader.py:192: DeprecationWarning: invalid escape sequence '\s'
    regex = "(?:#ifdef ([A-Z_]+))?\nstruct\s+%s\s*\{(.*?)\n\};" % struct;
  tools/include/xen-foreign/mkheader.py:218: DeprecationWarning: invalid escape sequence '\s'
    output = re.sub("\\b(union\s+%s)\\b" % union, "\\1_%s" % arch, output);
  tools/include/xen-foreign/mkheader.py:222: DeprecationWarning: invalid escape sequence '\s'
    output = re.sub("\\b(struct\s+%s)\\b" % struct, "\\1_%s" % arch, output);

Python regexes should use raw strings.  Convert all regexes, and drop escaped
backslashes.  Note that regular escape sequences are interpreted normally when
parsing a regex, so \n even in a raw-string regex is a newline.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
2024-07-04 11:43:33 +01:00
..
…
…
…
…
…