make-target-delegates: line break between return type and function name
authorPedro Alves <palves@redhat.com>
Wed, 2 May 2018 23:37:23 +0000 (00:37 +0100)
committerPedro Alves <palves@redhat.com>
Wed, 2 May 2018 23:51:08 +0000 (00:51 +0100)
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.

gdb/ChangeLog
gdb/make-target-delegates
gdb/target.h

index 5b79d6f445315113239db93fbc29010de5d76953..d17e2f695c77b8b285358aaa2b73a4677f1adf0c 100644 (file)
@@ -1,3 +1,11 @@
+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>
 
index 10853e3e203cb17785187f147fcb6116fe1125c3..83a1afcadfb0481bdd6e7ba746174d5b32e579bb 100755 (executable)
@@ -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};
index b23b7625be3190e6a6fda2a54bcb751a44885ab6..f78eb459dc1178ec91ee2db64f2e4226b73f215f 100644 (file)
@@ -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
This page took 0.043201 seconds and 4 git commands to generate.