This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] make-target-delegates: line break between return type and function name


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ad6a4e2dd69f9d343864181b638e166ff1458861

commit ad6a4e2dd69f9d343864181b638e166ff1458861
Author: Pedro Alves <palves@redhat.com>
Date:   Thu May 3 00:37:23 2018 +0100

    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.

Diff:
---
 gdb/ChangeLog             |  8 ++++++++
 gdb/make-target-delegates | 20 +++++++++++++++++++-
 gdb/target.h              |  3 ++-
 3 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5b79d6f..d17e2f6 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,4 +1,12 @@
 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.
+
+2018-05-02  Pedro Alves  <palves@redhat.com>
 	    John Baldwin  <jhb@freebsd.org>
 
 	* target.h (enum strata) <debug_stratum>: New.
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};
diff --git a/gdb/target.h b/gdb/target.h
index b23b762..f78eb45 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -1067,7 +1067,8 @@ struct target_ops
 
     /* Return a vector of all tracepoints markers string id ID, or all
        markers if ID is NULL.  */
-    virtual std::vector<static_tracepoint_marker> static_tracepoint_markers_by_strid (const char *id)
+    virtual std::vector<static_tracepoint_marker>
+      static_tracepoint_markers_by_strid (const char *id)
       TARGET_DEFAULT_NORETURN (tcomplain ());
 
     /* Return a traceframe info object describing the current


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]