[PATCH] esx: Fix gcc 4.6 warning about initialized but unused variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a speculative patch as I don't have gcc 4.6 at hand to test it.

Matthias
From ed18b790a1e0248f35f48d464f45c17b4f4d0cee Mon Sep 17 00:00:00 2001
From: Matthias Bolte <matthias.bolte@xxxxxxxxxxxxxx>
Date: Thu, 14 Apr 2011 19:14:38 +0200
Subject: [PATCH] esx: Fix gcc 4.6 warning about initialized but unused variables

This warnings come from partly generated code. Therefore, the best
solution is to mark them as potentially being unused using the
ATTRIBUTE_UNUSED macro. This is suggested by the gcc documentation.

Reported by Christophe Fergeau
---
 src/esx/esx_vi.c       |    2 +-
 src/esx/esx_vi_types.c |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index 9d5768d..951f537 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -60,7 +60,7 @@
     void                                                                      \
     esxVI_##_type##_Free(esxVI_##_type **ptrptr)                              \
     {                                                                         \
-        esxVI_##_type *item = NULL;                                           \
+        esxVI_##_type *item ATTRIBUTE_UNUSED;                                 \
                                                                               \
         if (ptrptr == NULL || *ptrptr == NULL) {                              \
             return;                                                           \
diff --git a/src/esx/esx_vi_types.c b/src/esx/esx_vi_types.c
index 29a3c39..d264583 100644
--- a/src/esx/esx_vi_types.c
+++ b/src/esx/esx_vi_types.c
@@ -58,7 +58,7 @@
     void                                                                      \
     esxVI_##_type##_Free(esxVI_##_type **ptrptr)                              \
     {                                                                         \
-        esxVI_##_type *item = NULL;                                           \
+        esxVI_##_type *item ATTRIBUTE_UNUSED;                                 \
                                                                               \
         if (ptrptr == NULL || *ptrptr == NULL) {                              \
             return;                                                           \
@@ -189,7 +189,7 @@
     esxVI_##_type##_Cast##_dest_extra##FromAnyType(esxVI_AnyType *anyType,    \
                                                    _dest_type **ptrptr)       \
     {                                                                         \
-        _dest_type *item;                                                     \
+        _dest_type *item ATTRIBUTE_UNUSED;                                    \
                                                                               \
         if (anyType == NULL || ptrptr == NULL || *ptrptr != NULL) {           \
             ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",                        \
-- 
1.7.0.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]