From a8bdc56b4e36451f197f9522e2bbfcc39c5d90dd Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 15 Jul 2014 12:08:54 -0600 Subject: [PATCH] rewrite make-target-delegates matching code This patch rewrites the make-target-delegates matching code a little bit. The result is functionally the same (the output has some small whitespace differences), but the new code is more forgiving regarding the formatting of target.h. In particular now there's no need to ensure that the return type and the method name appear on the same line. 2014-07-23 Tom Tromey * make-target-delegates ($ARGS_PART): Match trailing close paren. ($INTRO_PART): Don't match whitespace. ($METHOD_TRAILER): Move earlier. Remove trailing semicolon and argument matching. ($METHOD): Add $METHOD_TRAILER. (trim): Rewrite. (scan_target_h): New sub. Change main loop not to collect state. * target-delegates.c: Rebuild. --- gdb/ChangeLog | 12 +++++ gdb/make-target-delegates | 98 +++++++++++++++++++++++---------------- gdb/target-delegates.c | 28 +++++------ 3 files changed, 83 insertions(+), 55 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5abebaca0ff..0b27e2c1bba 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +2014-07-23 Tom Tromey + + * make-target-delegates ($ARGS_PART): Match trailing close paren. + ($INTRO_PART): Don't match whitespace. + ($METHOD_TRAILER): Move earlier. Remove trailing semicolon and + argument matching. + ($METHOD): Add $METHOD_TRAILER. + (trim): Rewrite. + (scan_target_h): New sub. + Change main loop not to collect state. + * target-delegates.c: Rebuild. + 2014-07-23 Gary Benson * cp-support.c (gdb_demangle): Fix build on systems without diff --git a/gdb/make-target-delegates b/gdb/make-target-delegates index f09f89d935d..28db447b36f 100755 --- a/gdb/make-target-delegates +++ b/gdb/make-target-delegates @@ -31,10 +31,10 @@ $ENDER = qr,^\s*};$,; $SYMBOL = qr,[a-zA-Z_][a-zA-Z0-9_]*,; # Match the name part of a method in struct target_ops. $NAME_PART = qr,\(\*(?${SYMBOL}+)\)\s,; -# Match the start of arguments to a method. -$ARGS_PART = qr,(?\(.*)$,; -# Match indentation. -$INTRO_PART = qr,^\s*,; +# Match the arguments to a method. +$ARGS_PART = qr,(?\(.*\)),; +# We strip the indentation so here we only need the caret. +$INTRO_PART = qr,^,; # Match the return type when it is "ordinary". $SIMPLE_RETURN_PART = qr,[^\(]+,; @@ -44,17 +44,22 @@ $VEC_RETURN_PART = qr,VEC\s*\([^\)]+\)[^\(]*,; # Match the TARGET_DEFAULT_* attribute for a method. $TARGET_DEFAULT_PART = qr,TARGET_DEFAULT_(?