diff options
author | Pedro Alves <palves@redhat.com> | 2018-05-03 00:37:23 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2018-05-03 00:51:08 +0100 |
commit | ad6a4e2dd69f9d343864181b638e166ff1458861 (patch) | |
tree | 2b384cb81ff1653fad3e1e9cf560b5f25e3a1f04 /gdb/make-target-delegates | |
parent | f6ac5f3d63e03a81c4ff3749aba234961cc9090e (diff) | |
download | gdb-ad6a4e2dd69f9d343864181b638e166ff1458861.zip gdb-ad6a4e2dd69f9d343864181b638e166ff1458861.tar.gz gdb-ad6a4e2dd69f9d343864181b638e166ff1458861.tar.bz2 |
make-target-delegates: line break between return type and function name
Before the target_ops C++ification, this wasn't necessary simply
because the methods were wrapped in ()'s, like
'(*to_my_long_method_name) (target_ops *)',
so
std::vector<long_type_name>(*to_my_long_method_name) ()TARGET_DEFAULT_IGNORE ()
still parsed correctly. With the (*) gone, we need this.
gdb/ChangeLog:
2018-05-02 Pedro Alves <palves@redhat.com>
* make-target-delegates (scan_target_h): Don't trim lines here.
Replace sequences of tabs and/or whitespace with a single
whitespace.
(top level, parsing methods): Trim each line before processing it
here.
Diffstat (limited to 'gdb/make-target-delegates')
-rwxr-xr-x | gdb/make-target-delegates | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/gdb/make-target-delegates b/gdb/make-target-delegates index 10853e3..83a1afc 100755 --- a/gdb/make-target-delegates +++ b/gdb/make-target-delegates @@ -102,7 +102,6 @@ sub scan_target_h() { # Strip // comments. $_ =~ s,//.*$,,; - $_ = trim ($_); $all_the_text .= $_; } @@ -110,6 +109,21 @@ sub scan_target_h() { # Now strip out the C comments. $all_the_text =~ s,/\*(.*?)\*/,,g; + # Replace sequences of tabs and/or whitespace with a single + # whitespace character. We need the whitespace because the method + # may have been split between multiple lines, like e.g.: + # + # virtual std::vector<long_type_name> + # my_long_method_name () + # TARGET_DEFAULT_IGNORE (); + # + # If we didn't preserve the whitespace, then we'd end up with: + # + # virtual std::vector<long_type_name>my_long_method_name ()TARGET_DEFAULT_IGNORE () + # + # ... which wouldn't later be parsed correctly. + $all_the_text =~ s/[\t\s]+/ /g; + return split (/;/, $all_the_text); } @@ -348,6 +362,10 @@ print "\n"; @argtypes_array = (); foreach $current_line (@lines) { + # See comments in scan_target_h. Here we strip away the leading + # and trailing whitespace. + $current_line = trim ($current_line); + next unless $current_line =~ m/$METHOD/; my $name = $+{name}; |