This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RE: [PATCH v5 09/15] vla: resolve dynamic bounds if value contents is a constant byte-sequence
- From: "Agovic, Sanimir" <sanimir dot agovic at intel dot com>
- To: 'Joel Brobecker' <brobecker at adacore dot com>
- Cc: "tromey at redhat dot com" <tromey at redhat dot com>, "Boell, Keven" <keven dot boell at intel dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Fri, 7 Feb 2014 12:27:24 +0000
- Subject: RE: [PATCH v5 09/15] vla: resolve dynamic bounds if value contents is a constant byte-sequence
- Authentication-results: sourceware.org; auth=none
- References: <1391704056-25246-1-git-send-email-sanimir dot agovic at intel dot com> <1391704056-25246-10-git-send-email-sanimir dot agovic at intel dot com> <20140207102715 dot GF5485 at adacore dot com>
Thanks for your review.
The inlined diff below wraps the single statement + comment within curly braces.
diff --git a/gdb/findvar.c b/gdb/findvar.c
index a543dc4..11ce3c6 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -469,8 +469,10 @@ default_read_var_value (struct symbol *var, struct frame_info *frame)
case LOC_CONST_BYTES:
if (is_dynamic_type (type))
- /* Value is a constant byte-sequence and needs no memory access. */
- type = resolve_dynamic_type (type, /* Unused address. */ 0);
+ {
+ /* Value is a constant byte-sequence and needs no memory access. */
+ type = resolve_dynamic_type (type, /* Unused address. */ 0);
+ }
v = allocate_value (type);
memcpy (value_contents_raw (v), SYMBOL_VALUE_BYTES (var),
TYPE_LENGTH (type));
-Sanimir
> -----Original Message-----
> From: Joel Brobecker [mailto:brobecker@adacore.com]
> Sent: Friday, February 07, 2014 11:27 AM
> To: Agovic, Sanimir
> Cc: tromey@redhat.com; Boell, Keven; gdb-patches@sourceware.org
> Subject: Re: [PATCH v5 09/15] vla: resolve dynamic bounds if value contents is a constant
> byte-sequence
>
> Hello!
>
> > 2013-11-26 Sanimir Agovic <sanimir.agovic@intel.com>
> > Keven Boell <keven.boell@intel.com>
> >
> > * findvar.c (default_read_var_value): Resolve dynamic bounds if location
> > points to a constant blob.
>
> Small trivial comment....
>
> > case LOC_CONST_BYTES:
> > + if (is_dynamic_type (type))
> > + /* Value is a constant byte-sequence and needs no memory access. */
> > + type = resolve_dynamic_type (type, /* Unused address. */ 0);
>
> Although not required by C, we prefer in the GDB project to still
> use curly braces around the if block. The reason is that the comment
> visually looks like a statement, so it looks like the if block as
> more than one statement, hence the use of curly braces...
>
> Thank you!
>
> --
> Joel
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052