vsllink.c defines the 'vsllink_debug_buffer' function when verbose USB
comms or verbose JTAG comms are enabled, but each use is guarded by
#ifdef _DEBUG_JTAG_IO. So the function is unused if only verbose USB
comms are enabled, and this is an error with -Werror. I fixed the
problem as described in the following patch.

~Eric
From e9a5be8d73e6488a13c049c612e533c387ab3eb2 Mon Sep 17 00:00:00 2001
From: Eric Wetzel <thewet...@gmail.com>
Date: Tue, 30 Aug 2011 09:42:00 -0400
Subject: [PATCH] vsllink: fix 'defined but not used' error on
 vsllink_debug_buffer If OpenOCD is built with verbose USB
 comms and not verbose JTAG comms, vsllink_debug_buffer
 would be defined, but never used. Remove guards around all
 uses of vsllink_debug_buffer and instead conditionally
 compile it as an empty inline function if verbose JTAG
 comms are not enabled.

---
 src/jtag/drivers/vsllink.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/jtag/drivers/vsllink.c b/src/jtag/drivers/vsllink.c
index 2274be4..fa5b9b1 100644
--- a/src/jtag/drivers/vsllink.c
+++ b/src/jtag/drivers/vsllink.c
@@ -78,8 +78,12 @@ struct vsllink {
 static struct vsllink *vsllink_usb_open(void);
 static void vsllink_usb_close(struct vsllink *vsllink);
 
-#if defined _DEBUG_USB_COMMS_ || defined _DEBUG_JTAG_IO_
+#if defined _DEBUG_JTAG_IO_
 static void vsllink_debug_buffer(uint8_t *buffer, int length);
+#else
+static inline void vsllink_debug_buffer(uint8_t *buffer, int length)
+{
+}
 #endif
 
 static int tap_length;
@@ -159,10 +163,8 @@ static int vsllink_execute_queue(void)
 						tap_state_name(cmd->cmd.scan
 							->end_state));
 
-#ifdef _DEBUG_JTAG_IO_
 				vsllink_debug_buffer(buffer,
 					DIV_ROUND_UP(scan_size, 8));
-#endif
 
 				type = jtag_scan_type(cmd->cmd.scan);
 
@@ -649,13 +651,11 @@ static int vsllink_jtag_execute(void)
 			command = pending_scan_result->command;
 			buf_set_buf(tdo_buffer, src_first, buffer, dest_first, length);
 
-#ifdef _DEBUG_JTAG_IO_
 			DEBUG_JTAG_IO(
 				"JTAG scan read(%d bits, from src %d bits to dest %d bits):",
 				length, src_first, dest_first);
 			vsllink_debug_buffer(buffer + dest_first / 8,
 					DIV_ROUND_UP(length, 7));
-#endif
 
 			if (last) {
 				if (jtag_read_buffer(buffer, command)
@@ -830,9 +830,8 @@ static void vsllink_usb_close(struct vsllink *vsllink)
 	free(vsllink);
 }
 
+#if defined _DEBUG_JTAG_IO_
 #define BYTES_PER_LINE  16
-
-#if defined _DEBUG_USB_COMMS_ || defined _DEBUG_JTAG_IO_
 static void vsllink_debug_buffer(uint8_t *buffer, int length)
 {
 	char line[81];
@@ -849,7 +848,7 @@ static void vsllink_debug_buffer(uint8_t *buffer, int length)
 		LOG_DEBUG("%s", line);
 	}
 }
-#endif /* _DEBUG_USB_COMMS_ || _DEBUG_JTAG_IO_ */
+#endif
 
 static const struct command_registration vsllink_command_handlers[] = {
 	{
-- 
1.7.5.1

_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to