This is the mail archive of the gdb-patches@sources.redhat.com 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]

[rfa] valops.c - simplify hand_function_call's push struct logic


Hello,

The attatched patch should simplify the logic used when computing the
address at which the return struct is pushed.  It also eliminates a
-Wuninitialized warning.

I think it is ok.

	Andrew
Mon Nov 20 13:59:29 2000  Andrew Cagney  <cagney@b1.cygnus.com>

	* valops.c (hand_function_call): Simplify computation of address
 	of the pushed argument.
 
Index: valops.c
===================================================================
RCS file: /cvs/src/src/gdb/valops.c,v
retrieving revision 1.27
diff -u -r1.27 valops.c
--- valops.c	2000/11/08 05:10:18	1.27
+++ valops.c	2000/11/27 07:29:27
@@ -1520,26 +1520,19 @@
 		{
 		  /* stack grows downward */
 		  sp -= aligned_len;
+		  /* ... so the address of the thing we push is the
+		     stack pointer after we push it.  */
+		  addr = sp;
 		}
 	      else
 		{
 		  /* The stack grows up, so the address of the thing
 		     we push is the stack pointer before we push it.  */
 		  addr = sp;
-		}
-	      /* Push the structure.  */
-	      write_memory (sp, VALUE_CONTENTS_ALL (args[i]), len);
-	      if (INNER_THAN (1, 2))
-		{
-		  /* The stack grows down, so the address of the thing
-		     we push is the stack pointer after we push it.  */
-		  addr = sp;
-		}
-	      else
-		{
-		  /* stack grows upward */
 		  sp += aligned_len;
 		}
+	      /* Push the structure.  */
+	      write_memory (addr, VALUE_CONTENTS_ALL (args[i]), len);
 	      /* The value we're going to pass is the address of the
 		 thing we just pushed.  */
 	      /*args[i] = value_from_longest (lookup_pointer_type (value_type),

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