Index: xen-4.1.6-testing/tools/libxc/xc_tmem.c
===================================================================
--- xen-4.1.6-testing.orig/tools/libxc/xc_tmem.c
+++ xen-4.1.6-testing/tools/libxc/xc_tmem.c
@@ -390,7 +390,8 @@ static int xc_tmem_restore_new_pool(
 
 int xc_tmem_restore(xc_interface *xch, int dom, int io_fd)
 {
-    uint32_t save_max_pools, save_version;
+    uint32_t save_version;
+    uint32_t __attribute__((__unused__)) save_max_pools;
     uint32_t this_max_pools, this_version;
     uint32_t pool_id;
     uint32_t minusone;
Index: xen-4.1.6-testing/tools/libxc/xc_domain_restore.c
===================================================================
--- xen-4.1.6-testing.orig/tools/libxc/xc_domain_restore.c
+++ xen-4.1.6-testing/tools/libxc/xc_domain_restore.c
@@ -1103,7 +1103,6 @@ int xc_domain_restore(xc_interface *xch,
     int vcpuextstate = 0;
     uint32_t vcpuextstate_size = 0;
     unsigned long mfn, pfn;
-    unsigned int prev_pc;
     int nraces = 0;
 
     /* The new domain's shared-info frame number. */
@@ -1269,7 +1268,6 @@ int xc_domain_restore(xc_interface *xch,
      * Now simply read each saved frame into its new machine frame.
      * We uncanonicalise page tables as we go.
      */
-    prev_pc = 0;
 
     n = m = 0;
  loadpages:
Index: xen-4.1.6-testing/tools/misc/gtraceview.c
===================================================================
--- xen-4.1.6-testing.orig/tools/misc/gtraceview.c
+++ xen-4.1.6-testing/tools/misc/gtraceview.c
@@ -622,7 +622,8 @@ void crt_init(void)
 void nr_addch(int nr, int ch)
 {
     int i;
-    int y, x;
+    int x;
+    int __attribute__((__unused__)) y;
     getyx(stdscr, y, x);
     for (i = 0; i < nr; i++) {
         if (x == COLS-1)
Index: xen-4.1.6-testing/tools/firmware/rombios/32bit/tcgbios/tcgbios.c
===================================================================
--- xen-4.1.6-testing.orig/tools/firmware/rombios/32bit/tcgbios/tcgbios.c
+++ xen-4.1.6-testing/tools/firmware/rombios/32bit/tcgbios/tcgbios.c
@@ -1064,7 +1064,7 @@ uint32_t HashLogEvent32(struct hlei *hle
 	uint32_t rc = 0;
 	uint16_t size;
 	uint32_t logdataptr;
-	uint32_t logdatalen;
+	uint32_t __attribute__((__unused__)) logdatalen;
 	uint32_t hashdataptr;
 	uint32_t hashdatalen;
 
Index: xen-4.1.6-testing/tools/console/client/main.c
===================================================================
--- xen-4.1.6-testing.orig/tools/console/client/main.c
+++ xen-4.1.6-testing/tools/console/client/main.c
@@ -277,7 +277,8 @@ int main(int argc, char **argv)
 
 	};
 	char *dom_path = NULL, *path = NULL;
-	int spty, xsfd;
+	int spty;
+	int __attribute__((__unused__)) xsfd;
 	struct xs_handle *xs;
 	char *end;
 	console_type type = CONSOLE_INVAL;
Index: xen-4.1.6-testing/tools/xenstat/xentop/xentop.c
===================================================================
--- xen-4.1.6-testing.orig/tools/xenstat/xentop/xentop.c
+++ xen-4.1.6-testing/tools/xenstat/xentop/xentop.c
@@ -272,7 +272,8 @@ static void fail(const char *str)
 /* Return the row containing the cursor. */
 static int current_row(void)
 {
-	int y, x;
+	int __attribute__((__unused__)) x;
+	int y;
 	getyx(stdscr, y, x);
 	return y;
 }
@@ -280,7 +281,8 @@ static int current_row(void)
 /* Return the number of lines on the screen. */
 static int lines(void)
 {
-	int y, x;
+	int __attribute__((__unused__)) x;
+	int y;
 	getmaxyx(stdscr, y, x);
 	return y;
 }
Index: xen-4.1.6-testing/tools/libxl/libxlu_cfg.c
===================================================================
--- xen-4.1.6-testing.orig/tools/libxl/libxlu_cfg.c
+++ xen-4.1.6-testing/tools/libxl/libxlu_cfg.c
@@ -348,7 +348,7 @@ char *xlu__cfgl_dequote(CfgParseContext
 
 #define NUMERIC_CHAR(minlen,maxlen,base,basetext) do{                        \
                 char numbuf[(maxlen)+1], *ep;                                \
-                unsigned long val;                                           \
+                unsigned long __attribute__((__unused__)) val;               \
                                                                              \
                 strncpy(numbuf,p,(maxlen));                                  \
                 numbuf[(maxlen)]= 0;                                         \
Index: xen-4.1.6-testing/tools/libxl/libxl.c
===================================================================
--- xen-4.1.6-testing.orig/tools/libxl/libxl.c
+++ xen-4.1.6-testing/tools/libxl/libxl.c
@@ -221,7 +221,7 @@ int libxl_domain_rename(libxl_ctx *ctx,
 int libxl_domain_resume(libxl_ctx *ctx, uint32_t domid)
 {
     libxl__gc gc = LIBXL_INIT_GC(ctx);
-    int rc = 0;
+    int __attribute__((__unused__)) rc = 0;
 
     if (libxl__domain_is_hvm(ctx, domid)) {
         LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Called domain_resume on "
@@ -1306,7 +1306,7 @@ libxl_nicinfo *libxl_list_nics(libxl_ctx
 {
     libxl__gc gc = LIBXL_INIT_GC(ctx);
     char *dompath, *nic_path_fe;
-    char **l, **list;
+    char **l;
     char *val, *tok;
     unsigned int nb_nics, i;
     libxl_nicinfo *res, *nics;
@@ -1314,7 +1314,7 @@ libxl_nicinfo *libxl_list_nics(libxl_ctx
     dompath = libxl__xs_get_dompath(&gc, domid);
     if (!dompath)
         goto err;
-    list = l = libxl__xs_directory(&gc, XBT_NULL,
+    l = libxl__xs_directory(&gc, XBT_NULL,
                            libxl__sprintf(&gc, "%s/device/vif", dompath), &nb_nics);
     if (!l)
         goto err;
Index: xen-4.1.6-testing/tools/libxl/libxl_pci.c
===================================================================
--- xen-4.1.6-testing.orig/tools/libxl/libxl_pci.c
+++ xen-4.1.6-testing/tools/libxl/libxl_pci.c
@@ -240,7 +240,7 @@ static int libxl_create_pci_backend(libx
     flexarray_t *front = NULL;
     flexarray_t *back = NULL;
     libxl__device device;
-    int ret = ERROR_NOMEM, i;
+    int i;
 
     front = flexarray_make(16, 1);
     if (!front)
@@ -249,8 +249,6 @@ static int libxl_create_pci_backend(libx
     if (!back)
         goto out;
 
-    ret = 0;
-
     LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Creating pci backend");
 
     /* add pci device */
Index: xen-4.1.6-testing/tools/libxl/libxl_dom.c
===================================================================
--- xen-4.1.6-testing.orig/tools/libxl/libxl_dom.c
+++ xen-4.1.6-testing/tools/libxl/libxl_dom.c
@@ -275,14 +275,13 @@ int libxl__build_hvm(libxl_ctx *ctx, uin
               libxl_domain_build_info *info, libxl_domain_build_state *state)
 {
     libxl__gc gc = LIBXL_INIT_GC(ctx);
-    int ret, rc = ERROR_INVAL;
+    int ret;
 
     if (info->kernel.mapped) {
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "libxl__build_hvm kernel cannot be mmapped");
         goto out;
     }
 
-    rc = ERROR_FAIL;
     ret = xc_hvm_build_target_mem(
         ctx->xch,
         domid,
@@ -300,7 +299,6 @@ int libxl__build_hvm(libxl_ctx *ctx, uin
         LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, ret, "hvm build set params failed");
         goto out;
     }
-    rc = 0;
 out:
     libxl__free_all(&gc);
     return 0;
Index: xen-4.1.6-testing/tools/libxl/libxl_utils.c
===================================================================
--- xen-4.1.6-testing.orig/tools/libxl/libxl_utils.c
+++ xen-4.1.6-testing/tools/libxl/libxl_utils.c
@@ -531,7 +531,7 @@ int libxl_devid_to_device_disk(libxl_ctx
     libxl__gc gc = LIBXL_INIT_GC(ctx);
     char *val;
     char *dompath, *diskpath, *be_path;
-    unsigned int devid_n;
+    unsigned int __attribute__((__unused__)) devid_n;
     int rc = ERROR_INVAL;
 
     devid_n = libxl__device_disk_dev_number(devid);
Index: xen-4.1.6-testing/tools/debugger/gdbsx/gx/gx_comm.c
===================================================================
--- xen-4.1.6-testing.orig/tools/debugger/gdbsx/gx/gx_comm.c
+++ xen-4.1.6-testing/tools/debugger/gdbsx/gx/gx_comm.c
@@ -163,7 +163,7 @@ readchar(void)
     static char buf[BUFSIZ];
     static int bufcnt = 0;
     static char *bufp;
-    uint64_t ll;
+    uint64_t __attribute__((__unused__)) ll;
 
     if (bufcnt-- > 0)
         return *bufp++ & 0x7f;
Index: xen-4.1.6-testing/tools/python/xen/lowlevel/checkpoint/libcheckpoint.c
===================================================================
--- xen-4.1.6-testing.orig/tools/python/xen/lowlevel/checkpoint/libcheckpoint.c
+++ xen-4.1.6-testing/tools/python/xen/lowlevel/checkpoint/libcheckpoint.c
@@ -820,7 +820,7 @@ static int create_suspend_thread(checkpo
 
 static void stop_suspend_thread(checkpoint_state* s)
 {
-  int err;
+  int __attribute__((__unused__)) err;
 
   s->done = 1;
 
Index: xen-4.1.6-testing/tools/python/xen/lowlevel/netlink/libnetlink.c
===================================================================
--- xen-4.1.6-testing.orig/tools/python/xen/lowlevel/netlink/libnetlink.c
+++ xen-4.1.6-testing/tools/python/xen/lowlevel/netlink/libnetlink.c
@@ -433,7 +433,8 @@ int rtnl_from_file(FILE *rtnl, rtnl_filt
        nladdr.nl_groups = 0;
 
        while (1) {
-               int err, len, type;
+               int err, len;
+               int __attribute__((__unused__)) type;
                int l;
 
                status = fread(&buf, 1, sizeof(*h), rtnl);
Index: xen-4.1.6-testing/xen/arch/x86/msi.c
===================================================================
--- xen-4.1.6-testing.orig/xen/arch/x86/msi.c
+++ xen-4.1.6-testing/xen/arch/x86/msi.c
@@ -823,7 +823,7 @@ static void __pci_disable_msi(struct msi
 {
     struct pci_dev *dev;
     int pos;
-    u16 control;
+    u16 __attribute__((__unused__)) control;
     u8 bus, slot, func;
 
     dev = entry->dev;
Index: xen-4.1.6-testing/xen/common/cpupool.c
===================================================================
--- xen-4.1.6-testing.orig/xen/common/cpupool.c
+++ xen-4.1.6-testing/xen/common/cpupool.c
@@ -356,7 +356,7 @@ int cpupool_add_domain(struct domain *d,
 {
     struct cpupool *c;
     int rc;
-    int n_dom = 0;
+    int __attribute__((__unused__)) n_dom = 0;
 
     if ( poolid == CPUPOOLID_NONE )
         return 0;
@@ -384,8 +384,8 @@ int cpupool_add_domain(struct domain *d,
  */
 void cpupool_rm_domain(struct domain *d)
 {
-    int cpupool_id;
-    int n_dom;
+    int __attribute__((__unused__)) cpupool_id;
+    int __attribute__((__unused__)) n_dom;
 
     if ( d->cpupool == NULL )
         return;
Index: xen-4.1.6-testing/xen/common/grant_table.c
===================================================================
--- xen-4.1.6-testing.orig/xen/common/grant_table.c
+++ xen-4.1.6-testing/xen/common/grant_table.c
@@ -793,7 +793,7 @@ __gnttab_unmap_common(
     struct domain   *ld, *rd;
     struct active_grant_entry *act;
     s16              rc = 0;
-    u32              old_pin;
+    u32 __attribute__((__unused__)) old_pin;
 
     ld = current->domain;
 
Index: xen-4.1.6-testing/xen/common/kexec.c
===================================================================
--- xen-4.1.6-testing.orig/xen/common/kexec.c
+++ xen-4.1.6-testing/xen/common/kexec.c
@@ -573,7 +573,8 @@ static int kexec_exec(XEN_GUEST_HANDLE(v
 {
     xen_kexec_exec_t exec;
     xen_kexec_image_t *image;
-    int base, bit, pos, ret = -EINVAL;
+    int base, bit, pos;
+    int __attribute__((__unused__)) ret = -EINVAL;
 
     if ( unlikely(copy_from_guest(&exec, uarg, 1)) )
         return -EFAULT;
Index: xen-4.1.6-testing/xen/drivers/passthrough/vtd/intremap.c
===================================================================
--- xen-4.1.6-testing.orig/xen/drivers/passthrough/vtd/intremap.c
+++ xen-4.1.6-testing/xen/drivers/passthrough/vtd/intremap.c
@@ -367,7 +367,7 @@ unsigned int io_apic_read_remap_rte(
     unsigned int ioapic_pin = (reg - 0x10) / 2;
     int index;
     struct IO_xAPIC_route_entry old_rte = { 0 };
-    struct IO_APIC_route_remap_entry *remap_rte;
+    struct IO_APIC_route_remap_entry __attribute__((__unused__)) *remap_rte;
     int rte_upper = (reg & 1) ? 1 : 0;
     struct iommu *iommu = ioapic_to_iommu(IO_APIC_ID(apic));
     struct ir_ctrl *ir_ctrl = iommu_ir_ctrl(iommu);
@@ -878,7 +878,7 @@ int iommu_enable_x2apic_IR(void)
 
     for_each_drhd_unit ( drhd )
     {
-        struct qi_ctrl *qi_ctrl = NULL;
+        struct qi_ctrl __attribute__((__unused__)) *qi_ctrl = NULL;
 
         iommu = drhd->iommu;
         qi_ctrl = iommu_qi_ctrl(iommu);
Index: xen-4.1.6-testing/xen/common/sched_credit2.c
===================================================================
--- xen-4.1.6-testing.orig/xen/common/sched_credit2.c
+++ xen-4.1.6-testing/xen/common/sched_credit2.c
@@ -1857,7 +1857,8 @@ static void deactivate_runqueue(struct c
 
 static void init_pcpu(const struct scheduler *ops, int cpu)
 {
-    int rqi, old_rqi, flags;
+    int rqi, flags;
+    int __attribute__((__unused__)) old_rqi;
     struct csched_private *prv = CSCHED_PRIV(ops);
     struct csched_runqueue_data *rqd;
     spinlock_t *old_lock;
Index: xen-4.1.6-testing/xen/common/unlzo.c
===================================================================
--- xen-4.1.6-testing.orig/xen/common/unlzo.c
+++ xen-4.1.6-testing/xen/common/unlzo.c
@@ -68,7 +68,7 @@ static int INIT parse_header(u8 *input,
 {
 	int l;
 	u8 *parse = input;
-	u8 level = 0;
+	u8 __attribute__((__unused__)) level = 0;
 	u16 version;
 
 	/* read magic: 9 first bits */
Index: xen-4.1.6-testing/xen/arch/x86/time.c
===================================================================
--- xen-4.1.6-testing.orig/xen/arch/x86/time.c
+++ xen-4.1.6-testing/xen/arch/x86/time.c
@@ -1018,7 +1018,8 @@ static void local_time_calibration(void)
      * System timestamps, extrapolated from local and master oscillators,
      * taken during this calibration and the previous calibration.
      */
-    s_time_t prev_local_stime, curr_local_stime;
+    s_time_t curr_local_stime;
+    s_time_t __attribute__((__unused__)) prev_local_stime;
     s_time_t prev_master_stime, curr_master_stime;
 
     /* TSC timestamps taken during this calibration and prev calibration. */
Index: xen-4.1.6-testing/xen/arch/x86/cpu/amd.c
===================================================================
--- xen-4.1.6-testing.orig/xen/arch/x86/cpu/amd.c
+++ xen-4.1.6-testing/xen/arch/x86/cpu/amd.c
@@ -398,7 +398,7 @@ static void __devinit init_amd(struct cp
 {
 	u32 l, h;
 	int mbytes = num_physpages >> (20-PAGE_SHIFT);
-	int r;
+	int __attribute__((__unused__)) r;
 
 #ifdef CONFIG_SMP
 	unsigned long long value;
Index: xen-4.1.6-testing/xen/arch/x86/mm/p2m.c
===================================================================
--- xen-4.1.6-testing.orig/xen/arch/x86/mm/p2m.c
+++ xen-4.1.6-testing/xen/arch/x86/mm/p2m.c
@@ -2340,7 +2340,7 @@ p2m_remove_page(struct p2m_domain *p2m,
                 unsigned int page_order)
 {
     unsigned long i;
-    mfn_t mfn_return;
+    mfn_t __attribute__((__unused__)) mfn_return;
     p2m_type_t t;
     p2m_access_t a;
 
@@ -2409,7 +2409,7 @@ guest_physmap_mark_populate_on_demand(st
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     unsigned long i, pod_count = 0;
     p2m_type_t ot;
-    mfn_t omfn;
+    mfn_t __attribute__((__unused__)) omfn;
     int rc = 0;
 
     if ( !IS_PRIV_FOR(current->domain, d) )
Index: xen-4.1.6-testing/xen/arch/x86/hvm/emulate.c
===================================================================
--- xen-4.1.6-testing.orig/xen/arch/x86/hvm/emulate.c
+++ xen-4.1.6-testing/xen/arch/x86/hvm/emulate.c
@@ -59,7 +59,7 @@ static int hvmemul_do_io(
     ioreq_t *p = get_ioreq(curr);
     unsigned long ram_gfn = paddr_to_pfn(ram_gpa);
     p2m_type_t p2mt;
-    mfn_t ram_mfn;
+    mfn_t __attribute__((__unused__)) ram_mfn;
     int rc;
 
     /* Check for paged out page */
Index: xen-4.1.6-testing/xen/arch/x86/hvm/hvm.c
===================================================================
--- xen-4.1.6-testing.orig/xen/arch/x86/hvm/hvm.c
+++ xen-4.1.6-testing/xen/arch/x86/hvm/hvm.c
@@ -286,7 +286,8 @@ void hvm_migrate_timers(struct vcpu *v)
 
 void hvm_migrate_pirqs(struct vcpu *v)
 {
-    int pirq, irq;
+    int pirq;
+    int __attribute__((__unused__)) irq;
     struct irq_desc *desc;
     struct domain *d = v->domain;
     struct hvm_irq_dpci *hvm_irq_dpci = d->arch.hvm_domain.irq.dpci;
@@ -3781,7 +3782,7 @@ long do_hvm_op(unsigned long op, XEN_GUE
             unsigned long pfn = a.first_pfn;
             p2m_type_t t;
             p2m_type_t nt;
-            mfn_t mfn;
+            mfn_t __attribute__((__unused__)) mfn;
             mfn = gfn_to_mfn_unshare(p2m, pfn, &t, 0);
             if ( p2m_is_paging(t) )
             {
Index: xen-4.1.6-testing/xen/arch/x86/acpi/cpu_idle.c
===================================================================
--- xen-4.1.6-testing.orig/xen/arch/x86/acpi/cpu_idle.c
+++ xen-4.1.6-testing/xen/arch/x86/acpi/cpu_idle.c
@@ -279,7 +279,7 @@ static void acpi_processor_ffh_cstate_en
 
 static void acpi_idle_do_entry(struct acpi_processor_cx *cx)
 {
-    int unused;
+    int __attribute__((__unused__)) unused;
 
     switch ( cx->entry_method )
     {
Index: xen-4.1.6-testing/xen/arch/x86/cpu/intel_cacheinfo.c
===================================================================
--- xen-4.1.6-testing.orig/xen/arch/x86/cpu/intel_cacheinfo.c
+++ xen-4.1.6-testing/xen/arch/x86/cpu/intel_cacheinfo.c
@@ -170,7 +170,8 @@ unsigned int __cpuinit init_intel_cachei
 	unsigned int trace = 0, l1i = 0, l1d = 0, l2 = 0, l3 = 0; /* Cache sizes */
 	unsigned int new_l1d = 0, new_l1i = 0; /* Cache sizes from cpuid(4) */
 	unsigned int new_l2 = 0, new_l3 = 0, i; /* Cache sizes from cpuid(4) */
-	unsigned int l2_id = 0, l3_id = 0, num_threads_sharing, index_msb;
+	unsigned int num_threads_sharing, index_msb;
+	unsigned int __attribute__((__unused__)) l2_id = 0, l3_id = 0;
 
 	if (c->cpuid_level > 3) {
 		static int is_initialized;
Index: xen-4.1.6-testing/xen/arch/x86/mm/mem_sharing.c
===================================================================
--- xen-4.1.6-testing.orig/xen/arch/x86/mm/mem_sharing.c
+++ xen-4.1.6-testing/xen/arch/x86/mm/mem_sharing.c
@@ -375,7 +375,7 @@ int mem_sharing_debug_gfn(struct domain
 {
     p2m_type_t p2mt;
     mfn_t mfn;
-    struct page_info *page;
+    struct page_info __attribute__((__unused__)) *page;
 
     mfn = gfn_to_mfn(p2m_get_hostp2m(d), gfn, &p2mt);
     page = mfn_to_page(mfn);
Index: xen-4.1.6-testing/xen/arch/x86/hvm/viridian.c
===================================================================
--- xen-4.1.6-testing.orig/xen/arch/x86/hvm/viridian.c
+++ xen-4.1.6-testing/xen/arch/x86/hvm/viridian.c
@@ -270,7 +270,7 @@ int rdmsr_viridian_regs(uint32_t idx, ui
 int viridian_hypercall(struct cpu_user_regs *regs)
 {
     int mode = hvm_guest_x86_mode(current);
-    unsigned long input_params_gpa, output_params_gpa;
+    unsigned long __attribute__((__unused__)) input_params_gpa, output_params_gpa;
     uint16_t status = HV_STATUS_SUCCESS;
 
     union hypercall_input {
Index: xen-4.1.6-testing/xen/arch/x86/mm.c
===================================================================
--- xen-4.1.6-testing.orig/xen/arch/x86/mm.c
+++ xen-4.1.6-testing/xen/arch/x86/mm.c
@@ -5227,7 +5227,7 @@ static int ptwr_emulated_update(
 {
     unsigned long mfn;
     unsigned long unaligned_addr = addr;
-    struct page_info *page;
+    struct page_info __attribute__((__unused__)) *page;
     l1_pgentry_t pte, ol1e, nl1e, *pl1e;
     struct vcpu *v = current;
     struct domain *d = v->domain;
Index: xen-4.1.6-testing/xen/arch/x86/x86_64/mm.c
===================================================================
--- xen-4.1.6-testing.orig/xen/arch/x86/x86_64/mm.c
+++ xen-4.1.6-testing/xen/arch/x86/x86_64/mm.c
@@ -436,7 +436,8 @@ void destroy_m2p_mapping(struct mem_hota
 static int setup_compat_m2p_table(struct mem_hotadd_info *info)
 {
     unsigned long i, va, smap, emap, rwva, epfn = info->epfn;
-    unsigned int n, memflags;
+    unsigned int n;
+    unsigned int __attribute__((__unused__)) memflags;
     l3_pgentry_t *l3_ro_mpt = NULL;
     l2_pgentry_t *l2_ro_mpt = NULL;
     struct page_info *l1_pg;
Index: xen-4.1.6-testing/xen/arch/x86/cpu/mcheck/mce.c
===================================================================
--- xen-4.1.6-testing.orig/xen/arch/x86/cpu/mcheck/mce.c
+++ xen-4.1.6-testing/xen/arch/x86/cpu/mcheck/mce.c
@@ -151,7 +151,6 @@ static struct mcinfo_bank *mca_init_bank
                                          struct mc_info *mi, int bank)
 {
     struct mcinfo_bank *mib;
-    uint64_t addr=0, misc = 0;
 
     if (!mi)
         return NULL;
@@ -170,7 +169,6 @@ static struct mcinfo_bank *mca_init_bank
     mib->common.size = sizeof (struct mcinfo_bank);
     mib->mc_bank = bank;
 
-    addr = misc = 0;
     if (mib->mc_status & MCi_STATUS_MISCV)
         mib->mc_misc = mca_rdmsr(MSR_IA32_MCx_MISC(bank));
 
@@ -281,7 +279,7 @@ mctelem_cookie_t mcheck_mca_logout(enum
     recover = (mc_recoverable_scan)? 1: 0;
 
     for (i = 0; i < 32 && i < nr_mce_banks; i++) {
-        struct mcinfo_bank *mib;  /* on stack */
+        struct mcinfo_bank __attribute__((__unused__)) *mib;  /* on stack */
 
         /* Skip bank if corresponding bit in bankmask is clear */
         if (!mcabanks_test(i, bankmask))
@@ -1221,7 +1219,7 @@ static void x86_mc_msrinject(void *data)
 {
     struct xen_mc_msrinject *mci = data;
     struct mcinfo_msr *msr;
-    struct cpuinfo_x86 *c;
+    struct cpuinfo_x86 __attribute__((__unused__)) *c;
     uint64_t hwcr = 0;
     int intpose;
     int i;
Index: xen-4.1.6-testing/xen/common/tmem.c
===================================================================
--- xen-4.1.6-testing.orig/xen/common/tmem.c
+++ xen-4.1.6-testing/xen/common/tmem.c
@@ -1355,7 +1355,8 @@ obj_unlock:
 static int tmem_evict(void)
 {
     client_t *client = tmh_client_from_current();
-    pgp_t *pgp = NULL, *pgp2, *pgp_del;
+    pgp_t *pgp = NULL, *pgp2;
+    pgp_t __attribute__((__unused__)) *pgp_del;
     obj_t *obj;
     pool_t *pool;
     int ret = 0;
@@ -1592,7 +1593,8 @@ static NOINLINE int do_tmem_put(pool_t *
               pagesize_t pfn_offset, pagesize_t len, tmem_cli_va_t clibuf)
 {
     obj_t *obj = NULL, *objfound = NULL, *objnew = NULL;
-    pgp_t *pgp = NULL, *pgpdel = NULL;
+    pgp_t *pgp = NULL;
+    pgp_t __attribute__((__unused__)) *pgpdel = NULL;
     client_t *client = pool->client;
     int ret = client->frozen ? -EFROZEN : -ENOMEM;
 
Index: xen-4.1.6-testing/xen/common/tmem_xen.c
===================================================================
--- xen-4.1.6-testing.orig/xen/common/tmem_xen.c
+++ xen-4.1.6-testing/xen/common/tmem_xen.c
@@ -191,7 +191,7 @@ EXPORT int tmh_copy_from_client(pfp_t *p
 EXPORT int tmh_compress_from_client(tmem_cli_mfn_t cmfn,
     void **out_va, size_t *out_len, tmem_cli_va_t clibuf)
 {
-    int ret = 0;
+    int __attribute__((__unused__)) ret = 0;
     unsigned char *dmem = this_cpu(dstmem);
     unsigned char *wmem = this_cpu(workmem);
     char *scratch = this_cpu(scratch_page);
@@ -267,7 +267,7 @@ EXPORT int tmh_decompress_to_client(tmem
     void *cli_va = NULL;
     char *scratch = this_cpu(scratch_page);
     size_t out_len = PAGE_SIZE;
-    int ret;
+    int __attribute__((__unused__)) ret;
 
     if ( guest_handle_is_null(clibuf) )
     {
@@ -400,15 +400,17 @@ static void tmh_persistent_pool_page_put
 EXPORT tmh_client_t *tmh_client_init(cli_id_t cli_id)
 {
     tmh_client_t *tmh;
+#ifndef __i386__
     char name[5];
     int i, shift;
+#endif
 
     if ( (tmh = xmalloc(tmh_client_t)) == NULL )
         return NULL;
+#ifndef __i386__
     for (i = 0, shift = 12; i < 4; shift -=4, i++)
         name[i] = (((unsigned short)cli_id >> shift) & 0xf) + '0';
     name[4] = '\0';
-#ifndef __i386__
     tmh->persistent_pool = xmem_pool_create(name, tmh_persistent_pool_page_get,
         tmh_persistent_pool_page_put, PAGE_SIZE, 0, PAGE_SIZE);
     if ( tmh->persistent_pool == NULL )
Index: xen-4.1.6-testing/xen/arch/x86/cpu/mcheck/vmce.c
===================================================================
--- xen-4.1.6-testing.orig/xen/arch/x86/cpu/mcheck/vmce.c
+++ xen-4.1.6-testing/xen/arch/x86/cpu/mcheck/vmce.c
@@ -591,7 +591,7 @@ int is_vmce_ready(struct mcinfo_bank *ba
  */
 int unmmap_broken_page(struct domain *d, mfn_t mfn, unsigned long gfn)
 {
-    mfn_t r_mfn;
+    mfn_t __attribute__((__unused__)) r_mfn;
     struct p2m_domain *p2m;
     p2m_type_t pt;
 
Index: xen-4.1.6-testing/xen/arch/x86/mm/shadow/multi.c
===================================================================
--- xen-4.1.6-testing.orig/xen/arch/x86/mm/shadow/multi.c
+++ xen-4.1.6-testing/xen/arch/x86/mm/shadow/multi.c
@@ -124,7 +124,7 @@ set_shadow_status(struct vcpu *v, mfn_t
 /* Put a shadow into the hash table */
 {
     struct domain *d = v->domain;
-    int res;
+    int __attribute__((__unused__)) res;
 
     SHADOW_PRINTK("d=%d, v=%d, gmfn=%05lx, type=%08x, smfn=%05lx\n",
                    d->domain_id, v->vcpu_id, mfn_x(gmfn),
@@ -4447,7 +4447,7 @@ sh_update_cr3(struct vcpu *v, int do_loc
 int sh_rm_write_access_from_sl1p(struct vcpu *v, mfn_t gmfn, 
                                  mfn_t smfn, unsigned long off)
 {
-    int r;
+    int __attribute__((__unused__)) r;
     shadow_l1e_t *sl1p, sl1e;
     struct page_info *sp;
 
Index: xen-4.1.6-testing/xen/arch/x86/domain_build.c
===================================================================
--- xen-4.1.6-testing.orig/xen/arch/x86/domain_build.c
+++ xen-4.1.6-testing/xen/arch/x86/domain_build.c
@@ -378,8 +378,7 @@ int __init construct_dom0(
         goto out;
 
     /* compatibility check */
-    compatible = 0;
-    compat32   = 0;
+    compatible = compat32 = 0;
     machine = elf_uval(&elf, elf.ehdr, e_machine);
     switch (CONFIG_PAGING_LEVELS) {
     case 3: /* x86_32p */
Index: xen-4.1.6-testing/xen/arch/x86/traps.c
===================================================================
--- xen-4.1.6-testing.orig/xen/arch/x86/traps.c
+++ xen-4.1.6-testing/xen/arch/x86/traps.c
@@ -1877,7 +1877,11 @@ static int emulate_privileged_op(struct
     struct vcpu *v = current;
     unsigned long *reg, eip = regs->eip;
     u8 opcode, modrm_reg = 0, modrm_rm = 0, rep_prefix = 0, lock = 0, rex = 0;
+#ifdef CONFIG_X86_64
     enum { lm_seg_none, lm_seg_fs, lm_seg_gs } lm_ovr = lm_seg_none;
+#else
+    enum { lm_seg_none, lm_seg_fs, lm_seg_gs } __attribute__((__unused__)) lm_ovr = lm_seg_none;
+#endif
     int rc;
     unsigned int port, i, data_sel, ar, data, bpmatch = 0;
     unsigned int op_bytes, op_default, ad_bytes, ad_default, opsize_prefix= 0;
