On 23.07.2020 17:48, Jan Beulich wrote:
> --- a/xen/tools/compat-build-header.py
> +++ b/xen/tools/compat-build-header.py
> @@ -3,7 +3,7 @@
>  import re,sys
>  
>  pats = [
> - [ r"__InClUdE__(.*)", r"#include\1\n#pragma pack(4)" ],
> + [ r"__InClUdE__(.*)", r"#include\1" ],
>   [ r"__IfDeF__ (XEN_HAVE.*)", r"#ifdef \1" ],
>   [ r"__ElSe__", r"#else" ],
>   [ r"__EnDif__", r"#endif" ],
> @@ -11,9 +11,11 @@ pats = [
>   [ r"__UnDeF__", r"#undef" ],
>   [ r"\"xen-compat.h\"", r"<public/xen-compat.h>" ],
>   [ r"(struct|union|enum)\s+(xen_?)?(\w)", r"\1 compat_\3" ],
> - [ r"@KeeP@", r"" ],
> + [ r"typedef(.*)@KeeP@(xen_?)?([\w]+)([^\w])",
> +   r"typedef\1\2\3 __attribute__((__aligned__(__alignof(\1compat_\3))))\4" ],

I've noticed only very recently that this (but not ...

>   [ r"_t([^\w]|$)", r"_compat_t\1" ],
> - [ r"(8|16|32|64)_compat_t([^\w]|$)", r"\1_t\2" ],
> + [ r"int(8|16|32|64_aligned)_compat_t([^\w]|$)", r"int\1_t\2" ],
> + [ r"(\su?int64(_compat)?)_T([^\w]|$)", r"\1_t\3" ],

... this) trips an apparent bug in Python up to at least 3.4.6:
"unmatched group". It's been working fine for me with 3.7. I'm
not going to rule out I've screwed up the regex, but I can't
see in which way. Obviously I can't commit this knowing of this
issue. I'd be glad if people with better Python knowledge than
mine could suggest how to fix the expression or work around the
issue.

Thanks much, Jan

Reply via email to