[2/3] gdb: refactor make-target-delegates.py's ARGTYPES
Checks
Commit Message
Refactor the ARGTYPES regular expression in make-target-delegates.py
to eliminate '.*' for better control on what is matched. This will be
helpful in the next patch where we recognize default argument values.
Also, simplify the "E" match group, for which the optional SYMBOL
becomes redundant because that case can be matched by the "T" group.
After applying this patch, running './make-target-delegates.py' does not
change anything in 'target-delegates.c'.
---
gdb/make-target-delegates.py | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
Comments
Hi Baris,
On 2023-11-14 09:41, Tankut Baris Aktemur wrote:
> Refactor the ARGTYPES regular expression in make-target-delegates.py
> to eliminate '.*' for better control on what is matched. This will be
> helpful in the next patch where we recognize default argument values.
> Also, simplify the "E" match group, for which the optional SYMBOL
> becomes redundant because that case can be matched by the "T" group.
>
> After applying this patch, running './make-target-delegates.py' does not
> change anything in 'target-delegates.c'.
With the tweak to the commit log to not mention default arguments:
Approved-By: Pedro Alves <pedro@palves.net>
@@ -73,17 +73,18 @@ METHOD = re.compile(
+ METHOD_TRAILER
)
+# Space-separated symbols.
+CP_SYMBOLS = CP_SYMBOL + r"(\s+" + CP_SYMBOL + r")*"
+
# Regular expression used to dissect argument types.
ARGTYPES = re.compile(
"^("
+ r"(?P<E>enum\s+"
+ SYMBOL
- + r"\s*)("
- + SYMBOL
- + ")?"
- + r"|(?P<T>.*(enum\s+)?"
- + SYMBOL
- + r".*(\s|\*|&))"
+ + r")"
+ + r"|(?P<T>"
+ + CP_SYMBOLS
+ + r"(\s|\*|&)+)"
+ SYMBOL
+ ")$"
)