From a8bdc56b4e36451f197f9522e2bbfcc39c5d90dd Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 15 Jul 2014 12:08:54 -0600 Subject: 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/make-target-delegates | 98 +++++++++++++++++++++++++++-------------------- 1 file changed, 57 insertions(+), 41 deletions(-) (limited to 'gdb/make-target-delegates') diff --git a/gdb/make-target-delegates b/gdb/make-target-delegates index f09f89d..28db447 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_(?