gdb: refactor make-target-delegates.py's ARGTYPES
authorTankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Tue, 14 Nov 2023 14:00:49 +0000 (15:00 +0100)
committerTankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Tue, 14 Nov 2023 14:03:51 +0000 (15:03 +0100)
Refactor the ARGTYPES regular expression in make-target-delegates.py
to eliminate '.*' for better control on what is matched.  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'.

Approved-By: Pedro Alves <pedro@palves.net>
gdb/make-target-delegates.py

index 5bbe7c0b9308f54cca2620a536b4252990d16bc3..fd5f436a43dde1d2179828098aa059bbfb201f08 100755 (executable)
@@ -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
     + ")$"
 )