Patchwork Replace VEC(gdb_xml_value_s) with std::vector

login
register
mail settings
Submitter Metzger, Markus T
Date Dec. 7, 2017, 2:49 p.m.
Message ID <A78C989F6D9628469189715575E55B23696207B8@IRSMSX104.ger.corp.intel.com>
Download mbox | patch
Permalink /patch/24776/
State New
Headers show

Comments

Metzger, Markus T - Dec. 7, 2017, 2:49 p.m.
-----Original Message-----
From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-owner@sourceware.org] On Behalf Of Simon Marchi
Sent: 02 December 2017 17:50
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@polymtl.ca>
Subject: [PATCH] Replace VEC(gdb_xml_value_s) with std::vector

Hello Simon,

       gdb_xml_error (parser, _("Btrace format error."));
     }
 
-  begin = (ULONGEST *) xml_find_attribute (attributes, "begin")->value;
-  end = (ULONGEST *) xml_find_attribute (attributes, "end")->value;
+  begin = (ULONGEST *) xml_find_attribute (attributes, 
+ "begin")->value.get ();  end = (ULONGEST *) xml_find_attribute 
+ (attributes, "end")->value.get ();

This too.

Thanks,
Markus.

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
Simon Marchi - Dec. 7, 2017, 6:50 p.m.
On 2017-12-07 09:49 AM, Metzger, Markus T wrote:
> -----Original Message-----
> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-owner@sourceware.org] On Behalf Of Simon Marchi
> Sent: 02 December 2017 17:50
> To: gdb-patches@sourceware.org
> Cc: Simon Marchi <simon.marchi@polymtl.ca>
> Subject: [PATCH] Replace VEC(gdb_xml_value_s) with std::vector
> 
> Hello Simon,
> 
> diff --git a/gdb/btrace.c b/gdb/btrace.c index 8338ebfb0a..547f43d691 100644
> --- a/gdb/btrace.c
> +++ b/gdb/btrace.c
> @@ -2004,10 +2004,11 @@ btrace_free_objfile (struct objfile *objfile)  static void  check_xml_btrace_version (struct gdb_xml_parser *parser,
>  			  const struct gdb_xml_element *element,
> -			  void *user_data, VEC (gdb_xml_value_s) *attributes)
> +			  void *user_data,
> +			  std::vector<gdb_xml_value> &attributes)
>  {
>    const char *version
> -    = (const char *) xml_find_attribute (attributes, "version")->value;
> +    = (const char *) xml_find_attribute (attributes, 
> + "version")->value.get ();
> 
> This looks a bit odd.

Can you clarify what looks odd?

In your quote, there appears to be two added lines (two +):

> -    = (const char *) xml_find_attribute (attributes, "version")->value;
> +    = (const char *) xml_find_attribute (attributes,
> + "version")->value.get ();

But in my patch it's all on the same line.  I am confused.

> @@ -2040,8 +2042,8 @@ parse_xml_btrace_block (struct gdb_xml_parser *parser,
>        gdb_xml_error (parser, _("Btrace format error."));
>      }
>  
> -  begin = (ULONGEST *) xml_find_attribute (attributes, "begin")->value;
> -  end = (ULONGEST *) xml_find_attribute (attributes, "end")->value;
> +  begin = (ULONGEST *) xml_find_attribute (attributes, 
> + "begin")->value.get ();  end = (ULONGEST *) xml_find_attribute 
> + (attributes, "end")->value.get ();
> 
> This too.

Same thing here.

Simon
Metzger, Markus T - Dec. 8, 2017, 8:03 a.m.
> -----Original Message-----

> From: Simon Marchi [mailto:simon.marchi@ericsson.com]

> Sent: 07 December 2017 19:50

> To: Metzger, Markus T <markus.t.metzger@intel.com>; Simon Marchi

> <simon.marchi@polymtl.ca>; gdb-patches@sourceware.org

> Subject: Re: [PATCH] Replace VEC(gdb_xml_value_s) with std::vector


Hello Simon,

> In your quote, there appears to be two added lines (two +):

> 

> > -    = (const char *) xml_find_attribute (attributes, "version")->value;

> > +    = (const char *) xml_find_attribute (attributes,

> > + "version")->value.get ();

> 

> But in my patch it's all on the same line.  I am confused.


That's what I meant with odd.  Looks like some extra line breaks.

> 

> > @@ -2040,8 +2042,8 @@ parse_xml_btrace_block (struct gdb_xml_parser

> *parser,

> >        gdb_xml_error (parser, _("Btrace format error."));

> >      }

> >

> > -  begin = (ULONGEST *) xml_find_attribute (attributes,

> > "begin")->value;

> > -  end = (ULONGEST *) xml_find_attribute (attributes, "end")->value;

> > +  begin = (ULONGEST *) xml_find_attribute (attributes,

> > + "begin")->value.get ();  end = (ULONGEST *) xml_find_attribute

> > + (attributes, "end")->value.get ();


And here, the line break after ';' seems to have been removed.

Thanks,
Markus.

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
Simon Marchi - Dec. 8, 2017, 8:18 a.m.
On 2017-12-08 03:03, Metzger, Markus T wrote:
>> In your quote, there appears to be two added lines (two +):
>> 
>> > -    = (const char *) xml_find_attribute (attributes, "version")->value;
>> > +    = (const char *) xml_find_attribute (attributes,
>> > + "version")->value.get ();
>> 
>> But in my patch it's all on the same line.  I am confused.
> 
> That's what I meant with odd.  Looks like some extra line breaks.
> 
>> 
>> > @@ -2040,8 +2042,8 @@ parse_xml_btrace_block (struct gdb_xml_parser
>> *parser,
>> >        gdb_xml_error (parser, _("Btrace format error."));
>> >      }
>> >
>> > -  begin = (ULONGEST *) xml_find_attribute (attributes,
>> > "begin")->value;
>> > -  end = (ULONGEST *) xml_find_attribute (attributes, "end")->value;
>> > +  begin = (ULONGEST *) xml_find_attribute (attributes,
>> > + "begin")->value.get ();  end = (ULONGEST *) xml_find_attribute
>> > + (attributes, "end")->value.get ();
> 
> And here, the line break after ';' seems to have been removed.

Is it possible that this is done by your email client?  The snippets you 
quoted don't look like the version in the archive, there the patch looks 
fine:

   https://sourceware.org/ml/gdb-patches/2017-12/msg00045.html

Simon
Metzger, Markus T - Dec. 8, 2017, 8:26 a.m.
> -----Original Message-----
> From: Simon Marchi [mailto:simon.marchi@polymtl.ca]
> Sent: 08 December 2017 09:19
> To: Metzger, Markus T <markus.t.metzger@intel.com>
> Cc: Simon Marchi <simon.marchi@ericsson.com>; gdb-patches@sourceware.org
> Subject: Re: [PATCH] Replace VEC(gdb_xml_value_s) with std::vector

> Is it possible that this is done by your email client?  The snippets you quoted don't
> look like the version in the archive, there the patch looks
> fine:
> 
>    https://sourceware.org/ml/gdb-patches/2017-12/msg00045.html

Indeed.  They look good.  Strange.

Markus.
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

Patch

diff --git a/gdb/btrace.c b/gdb/btrace.c index 8338ebfb0a..547f43d691 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -2004,10 +2004,11 @@  btrace_free_objfile (struct objfile *objfile)  static void  check_xml_btrace_version (struct gdb_xml_parser *parser,
 			  const struct gdb_xml_element *element,
-			  void *user_data, VEC (gdb_xml_value_s) *attributes)
+			  void *user_data,
+			  std::vector<gdb_xml_value> &attributes)
 {
   const char *version
-    = (const char *) xml_find_attribute (attributes, "version")->value;
+    = (const char *) xml_find_attribute (attributes, 
+ "version")->value.get ();

This looks a bit odd.

 
@@ -2040,8 +2042,8 @@  parse_xml_btrace_block (struct gdb_xml_parser *parser,