This is the mail archive of the gdb-patches@sourceware.org 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]
Other format: [Raw text]

RFA: fix compilation warning


I attempted to do a fresh checkout and build just now, and found it was failing with a variable-maybe-used-uninitialized compiler diagnostic. The attached patch fixes it. OK to check in?

-Sandra

2008-12-26  Sandra Loosemore  <sandra@codesourcery.com>

	gdb/
	* breakpoint.c (update_watchpoint): Refactor to avoid compiler
	warning.
Index: gdb/breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.367
diff -u -r1.367 breakpoint.c
--- gdb/breakpoint.c	22 Dec 2008 04:37:37 -0000	1.367
+++ gdb/breakpoint.c	26 Dec 2008 18:47:54 -0000
@@ -898,19 +898,23 @@
 	if ((b->type == bp_watchpoint || b->type == bp_hardware_watchpoint)
 	    && reparse)
 	  {
-	    int i, mem_cnt, target_resources_ok, other_type_used;
+	    int i, mem_cnt, other_type_used;
 
 	    i = hw_watchpoint_used_count (bp_hardware_watchpoint,
 					  &other_type_used);
 	    mem_cnt = can_use_hardware_watchpoint (val_chain);
 
-	    if (mem_cnt)
-	      target_resources_ok = TARGET_CAN_USE_HARDWARE_WATCHPOINT
-			 (bp_hardware_watchpoint, i + mem_cnt, other_type_used);
-	    if (!mem_cnt || target_resources_ok <= 0)
+	    if (!mem_cnt)
 	      b->type = bp_watchpoint;
 	    else
-	      b->type = bp_hardware_watchpoint;
+	      {
+		int target_resources_ok = TARGET_CAN_USE_HARDWARE_WATCHPOINT
+		  (bp_hardware_watchpoint, i + mem_cnt, other_type_used);
+		if (target_resources_ok <= 0)
+		  b->type = bp_watchpoint;
+		else
+		  b->type = bp_hardware_watchpoint;
+	      }
 	  }
 
       /* Look at each value on the value chain.  */

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