TCF Agent: code cleanup: got rid of compiler warnings
diff --git a/agent/machine/a64/tcf/stack-crawl-a64.c b/agent/machine/a64/tcf/stack-crawl-a64.c
index 8916ac9..a952995 100644
--- a/agent/machine/a64/tcf/stack-crawl-a64.c
+++ b/agent/machine/a64/tcf/stack-crawl-a64.c
@@ -1046,7 +1046,6 @@
     pc_data.o = 0;
     if (org_pc.o) {
         if (stk_frame->frame == 0) {
-            uint32_t instr = 0;
             if (read_u32(org_pc.v, &instr) == 0) {
                 if ((instr & 0xffe07fff) == 0xa9a07bfd) {
                     /* Prologue: stp x29,x30,[sp, #-xxx]! */
diff --git a/agent/machine/arm/tcf/disassembler-arm.c b/agent/machine/arm/tcf/disassembler-arm.c
index 965427f..65ea7c3 100644
--- a/agent/machine/arm/tcf/disassembler-arm.c
+++ b/agent/machine/arm/tcf/disassembler-arm.c
@@ -1620,7 +1620,6 @@
             if (!P && !U && !W) {
                 if (D && (instr & 0x000000d0) == 0x00000010) {
                     /* 64-bit transfers between ARM core and extension registers */
-                    int L = (instr & (1 << 20)) != 0;
                     int C = (instr & (1 << 8)) != 0;
                     uint32_t dn = instr & 0xf;
                     uint32_t sn = dn * 2;
diff --git a/agent/machine/arm/tcf/disassembler-thumb.c b/agent/machine/arm/tcf/disassembler-thumb.c
index e782700..2eb549b 100644
--- a/agent/machine/arm/tcf/disassembler-thumb.c
+++ b/agent/machine/arm/tcf/disassembler-thumb.c
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2013, 2014 Xilinx, Inc. and others.
+ * Copyright (c) 2013, 2016 Xilinx, Inc. and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * and Eclipse Distribution License v1.0 which accompany this distribution.
@@ -570,7 +570,6 @@
         unsigned i, j;
         uint32_t op = (instr >> 7) & 3;
         int L = (instr & (1 << 4)) != 0;
-        int W = (instr & (1 << 5)) != 0;
         if (op == 0 || op == 3) {
             if (!L) {
                 add_str("srs");
diff --git a/agent/tcf/framework/errors.c b/agent/tcf/framework/errors.c
index 3e3c222..c97b532 100644
--- a/agent/tcf/framework/errors.c
+++ b/agent/tcf/framework/errors.c
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2007, 2015 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007, 2016 Wind River Systems, Inc. and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * and Eclipse Distribution License v1.0 which accompany this distribution.
@@ -70,14 +70,14 @@
 static int msgs_pos = 0;
 
 static char * msg_buf = NULL;
-static size_t msg_max = 0;
-static size_t msg_len = 0;
+static size_t msg_buf_max = 0;
+static size_t msg_buf_len = 0;
 
 static void realloc_msg_buf(void) {
     assert(is_dispatch_thread());
-    if (msg_max <= msg_len + 128 || msg_max > msg_len + 2048) {
-        msg_max = msg_len + 256;
-        msg_buf = (char *)loc_realloc(msg_buf, msg_max);
+    if (msg_buf_max <= msg_buf_len + 128 || msg_buf_max > msg_buf_len + 2048) {
+        msg_buf_max = msg_buf_len + 256;
+        msg_buf = (char *)loc_realloc(msg_buf, msg_buf_max);
     }
 }
 
@@ -121,7 +121,7 @@
 static char * system_strerror(DWORD error_code, HMODULE module) {
     WCHAR * buf = NULL;
     assert(is_dispatch_thread());
-    msg_len = 0;
+    msg_buf_len = 0;
     if (FormatMessageW(
             FORMAT_MESSAGE_ALLOCATE_BUFFER |
             FORMAT_MESSAGE_FROM_SYSTEM |
@@ -132,20 +132,20 @@
             error_code,
             MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
             (LPWSTR)&buf, 0, NULL)) {
-        msg_len = WideCharToMultiByte(CP_UTF8, 0, buf, -1, NULL, 0, NULL, NULL);
-        if (msg_len > 0) {
+        msg_buf_len = WideCharToMultiByte(CP_UTF8, 0, buf, -1, NULL, 0, NULL, NULL);
+        if (msg_buf_len > 0) {
             realloc_msg_buf();
-            msg_len = WideCharToMultiByte(CP_UTF8, 0, buf, -1, msg_buf, (int)msg_max, NULL, NULL);
+            msg_buf_len = WideCharToMultiByte(CP_UTF8, 0, buf, -1, msg_buf, (int)msg_buf_max, NULL, NULL);
         }
     }
-    if (msg_len == 0) {
+    if (msg_buf_len == 0) {
         realloc_msg_buf();
-        msg_len = snprintf(msg_buf, msg_max, "System error code 0x%08x", (unsigned)error_code);
+        msg_buf_len = snprintf(msg_buf, msg_buf_max, "System error code 0x%08x", (unsigned)error_code);
     }
     if (buf != NULL) LocalFree(buf);
-    while (msg_len > 0 && msg_buf[msg_len - 1] <= ' ') msg_len--;
-    if (msg_len > 0 && msg_buf[msg_len - 1] == '.') msg_len--;
-    msg_buf[msg_len] = 0;
+    while (msg_buf_len > 0 && msg_buf[msg_buf_len - 1] <= ' ') msg_buf_len--;
+    if (msg_buf_len > 0 && msg_buf[msg_buf_len - 1] == '.') msg_buf_len--;
+    msg_buf[msg_buf_len] = 0;
     return msg_buf;
 }
 
@@ -215,7 +215,7 @@
                     char * s = x;
                     while (*s) {
                         realloc_msg_buf();
-                        msg_buf[msg_len++] = *s++;
+                        msg_buf[msg_buf_len++] = *s++;
                     }
                     loc_free(x);
                 }
@@ -240,7 +240,7 @@
     if (param != NULL) {
         while (*param) {
             realloc_msg_buf();
-            msg_buf[msg_len++] = *param++;
+            msg_buf[msg_buf_len++] = *param++;
         }
     }
 }
@@ -249,7 +249,7 @@
     int fmt_pos = 0;
     int in_quotes = 0;
 
-    msg_len = 0;
+    msg_buf_len = 0;
     while (fmt[fmt_pos]) {
         char ch = fmt[fmt_pos++];
         realloc_msg_buf();
@@ -257,10 +257,10 @@
             in_quotes = 0;
         }
         else if (in_quotes) {
-            msg_buf[msg_len++] = ch;
+            msg_buf[msg_buf_len++] = ch;
         }
         else if (ch == '\'' && fmt[fmt_pos] == '\'') {
-            msg_buf[msg_len++] = ch;
+            msg_buf[msg_buf_len++] = ch;
             fmt_pos++;
         }
         else if (ch =='\'') {
@@ -298,11 +298,11 @@
             if (fmt[fmt_pos] == '}') fmt_pos++;
         }
         else {
-            msg_buf[msg_len++] = ch;
+            msg_buf[msg_buf_len++] = ch;
         }
     }
     realloc_msg_buf();
-    msg_buf[msg_len++] = 0;
+    msg_buf[msg_buf_len++] = 0;
     return msg_buf;
 }
 
diff --git a/agent/tcf/framework/mdep.h b/agent/tcf/framework/mdep.h
index 06c0a76..9b8f146 100644
--- a/agent/tcf/framework/mdep.h
+++ b/agent/tcf/framework/mdep.h
@@ -78,6 +78,7 @@
 #include <sys/stat.h>
 #include <sys/utime.h>
 #include <stdio.h>
+#include <time.h>
 #include <io.h>
 
 #if defined(_MSC_VER)
diff --git a/agent/tcf/services/processes.c b/agent/tcf/services/processes.c
index 45f0228..8025fdf 100644
--- a/agent/tcf/services/processes.c
+++ b/agent/tcf/services/processes.c
@@ -1157,7 +1157,6 @@
         si.hStdOutput = hpipes[1][1];
         si.hStdError  = hpipes[2][1];
         if (args != NULL) {
-            int i = 0;
             int cmd_size = 0;
             int cmd_pos = 0;
 #           define cmd_append(ch) { \
diff --git a/agent/tcf/services/vm.c b/agent/tcf/services/vm.c
index bc18841..98d837c 100644
--- a/agent/tcf/services/vm.c
+++ b/agent/tcf/services/vm.c
@@ -726,7 +726,6 @@
                     LocationPiece * org_piece = pieces + cnt++;
                     if (org_piece->bit_size == 0) org_piece->bit_size = org_piece->size * 8;
                     if (bit_offs + org_piece->bit_size > offs * 8) {
-                        LocationPiece * piece = NULL;
                         if (state->pieces_cnt >= state->pieces_max) {
                             state->pieces_max += 4;
                             state->pieces = (LocationPiece *)tmp_realloc(state->pieces, state->pieces_max * sizeof(LocationPiece));
@@ -775,14 +774,14 @@
                     if (entry_state.pieces_cnt > 0) {
                         size_t i;
                         uint64_t value = 0;
-                        void * value_addr = NULL;
-                        size_t value_size = 0;
+                        void * piece_buf = NULL;
+                        size_t piece_size = 0;
                         read_location_pieces(entry_state.ctx, entry_state.stack_frame,
                             entry_state.pieces, entry_state.pieces_cnt, 0,
-                            &value_addr, &value_size);
-                        if (value_size > sizeof(value)) inv_dwarf("Invalid OP_entry_value expression");
-                        for (i = 0; i < value_size; i++) {
-                            value |= ((uint8_t *)value_addr)[i] << (i * 8);
+                            &piece_buf, &piece_size);
+                        if (piece_size > sizeof(value)) inv_dwarf("Invalid OP_entry_value expression");
+                        for (i = 0; i < piece_size; i++) {
+                            value |= ((uint8_t *)piece_buf)[i] << (i * 8);
                         }
                         s->type_stk[s->stk_pos] = TYPE_CLASS_CARDINAL;
                         s->stk[s->stk_pos++] = value;