Further document ada-lang.c::value_assign_to_component & fix whitespaces.
authorJoel Brobecker <brobecker@adacore.com>
Fri, 30 Jan 2015 12:33:04 +0000 (16:33 +0400)
committerJoel Brobecker <brobecker@adacore.com>
Tue, 5 May 2015 18:21:10 +0000 (11:21 -0700)
This patch improves the documentation of ada-lang.c's
value_assign_to_component to publish the fact that it also works
with not_lval values.

And touching this area of the code showed that there were a number
of whitespace issues, as well as a formatting issue of the main comment
(no leading '*' on each line). This patch fixes those while at it.

No functional change, however.

gdb/ChangeLog:

        * ada-lang.c (value_assign_to_component): Reformat and improve
        documentation. Remove all trailing spaces.

gdb/ChangeLog
gdb/ada-lang.c

index f36a7626f6412924a86adafe4e181c95647afa65..98558f78c2e1bf2eb631b91368a2f2c66bafa606 100644 (file)
@@ -1,3 +1,8 @@
+2015-05-05  Joel Brobecker  <brobecker@adacore.com>
+
+       * ada-lang.c (value_assign_to_component): Reformat and improve
+       documentation. Remove all trailing spaces.
+
 2015-05-05  Joel Brobecker  <brobecker@adacore.com>
 
        * inline-frame.c (inline_frame_sniffer, skip_inline_frames):
index c56e8bb9c4346bc7cc926be3c36fc6258dc343e7..7fe85c09217b76b869c5d7a6eeb9ea3d891504d7 100644 (file)
@@ -2682,21 +2682,27 @@ ada_value_assign (struct value *toval, struct value *fromval)
 }
 
 
-/* Given that COMPONENT is a memory lvalue that is part of the lvalue 
- * CONTAINER, assign the contents of VAL to COMPONENTS's place in 
- * CONTAINER.  Modifies the VALUE_CONTENTS of CONTAINER only, not 
- * COMPONENT, and not the inferior's memory.  The current contents 
- * of COMPONENT are ignored.  */
+/* Given that COMPONENT is a memory lvalue that is part of the lvalue
+   CONTAINER, assign the contents of VAL to COMPONENTS's place in
+   CONTAINER.  Modifies the VALUE_CONTENTS of CONTAINER only, not
+   COMPONENT, and not the inferior's memory.  The current contents
+   of COMPONENT are ignored.
+
+   Although not part of the initial design, this function also works
+   when CONTAINER and COMPONENT are not_lval's: it works as if CONTAINER
+   had a null address, and COMPONENT had an address which is equal to
+   its offset inside CONTAINER.  */
+
 static void
 value_assign_to_component (struct value *container, struct value *component,
                           struct value *val)
 {
   LONGEST offset_in_container =
     (LONGEST)  (value_address (component) - value_address (container));
-  int bit_offset_in_container = 
+  int bit_offset_in_container =
     value_bitpos (component) - value_bitpos (container);
   int bits;
-  
+
   val = value_cast (value_type (component), val);
 
   if (value_bitsize (component) == 0)
@@ -2705,17 +2711,17 @@ value_assign_to_component (struct value *container, struct value *component,
     bits = value_bitsize (component);
 
   if (gdbarch_bits_big_endian (get_type_arch (value_type (container))))
-    move_bits (value_contents_writeable (container) + offset_in_container, 
+    move_bits (value_contents_writeable (container) + offset_in_container,
               value_bitpos (container) + bit_offset_in_container,
               value_contents (val),
               TYPE_LENGTH (value_type (component)) * TARGET_CHAR_BIT - bits,
               bits, 1);
   else
-    move_bits (value_contents_writeable (container) + offset_in_container, 
+    move_bits (value_contents_writeable (container) + offset_in_container,
               value_bitpos (container) + bit_offset_in_container,
               value_contents (val), 0, bits, 0);
-}             
-                       
+}
+
 /* The value of the element of array ARR at the ARITY indices given in IND.
    ARR may be either a simple array, GNAT array descriptor, or pointer
    thereto.  */