summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Darcy <jdarcy@redhat.com>2011-09-08 11:07:10 -0400
committerVijay Bellur <vijay@gluster.com>2011-09-29 11:52:30 -0700
commitabb4cbeea35c40d69f18aba599f58d7e2dc5fdaf (patch)
tree847cee5ae0b35354ce6544a401242a0c432806ae
parentb43596fb4cdb84ae8b5665537914fe72517b8722 (diff)
Second round of warning suppression.
Used a #pragma to kill ~170 in rpcgen code. Added GF_UNUSED to deal with a few more from macros elsewhere. The remainder are function return values (mostly context and dict calls) that really should be checked. Those would be harder to fix without real understanding of the code where they occur, so they remain as reminders. (Patchset 2: deal with older gcc that doesn't handle #pragma GCC diagnostic) (Patchset 3: fix include paths in generated files) (Patchset 4: keep up with trunk, squash 9 new warnings) (Patchset 5: six more, all in AFR) Change-Id: I29760c8c81be4d7e6489312c5d0e92cc24814b7b BUG: 2550 Reviewed-on: http://review.gluster.com/378 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
-rwxr-xr-xextras/generate-xdr-files.sh6
-rw-r--r--libglusterfs/src/glusterfs.h7
-rw-r--r--rpc/xdr/src/cli1-xdr.c6
-rw-r--r--rpc/xdr/src/cli1-xdr.h6
-rw-r--r--rpc/xdr/src/glusterd1-xdr.c6
-rw-r--r--rpc/xdr/src/glusterd1-xdr.h6
-rw-r--r--rpc/xdr/src/glusterfs3-xdr.c6
-rw-r--r--rpc/xdr/src/glusterfs3-xdr.h6
-rw-r--r--rpc/xdr/src/portmap-xdr.c6
-rw-r--r--rpc/xdr/src/portmap-xdr.h6
-rw-r--r--xlators/cluster/afr/src/afr-lk-common.c2
-rw-r--r--xlators/cluster/afr/src/afr-open.c16
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-common.c2
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-entry.c8
-rw-r--r--xlators/cluster/afr/src/afr-self-heald.c4
-rw-r--r--xlators/cluster/afr/src/afr-transaction.c3
-rw-r--r--xlators/cluster/afr/src/afr.c2
-rw-r--r--xlators/cluster/afr/src/pump.c12
-rw-r--r--xlators/cluster/dht/src/dht-common.c2
-rw-r--r--xlators/cluster/dht/src/nufa.c2
-rw-r--r--xlators/features/quota/src/quota.c8
21 files changed, 75 insertions, 47 deletions
diff --git a/extras/generate-xdr-files.sh b/extras/generate-xdr-files.sh
index 004e09877..d1c2f1368 100755
--- a/extras/generate-xdr-files.sh
+++ b/extras/generate-xdr-files.sh
@@ -43,6 +43,12 @@ append_licence_header ()
#include "xdr-common.h"
#include "compat.h"
+#if defined(__GNUC__)
+#if __GNUC__ >= 4
+#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
+#endif
+#endif
+
EOF
cat $src_file >> $dst_file;
diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h
index 57a542bb3..c5c0a6261 100644
--- a/libglusterfs/src/glusterfs.h
+++ b/libglusterfs/src/glusterfs.h
@@ -381,6 +381,13 @@ typedef enum {
extern char *glusterfs_strevent (glusterfs_event_t ev);
#define GF_MUST_CHECK __attribute__((warn_unused_result))
+/*
+ * Some macros (e.g. ALLOC_OR_GOTO) set variables in function scope, but the
+ * calling function might not only declare the variable to keep the macro happy
+ * and not use it otherwise. In such cases, the following can be used to
+ * suppress the "set but not used" warning that would otherwise occur.
+ */
+#define GF_UNUSED __attribute__((unused))
int glusterfs_graph_prepare (glusterfs_graph_t *graph, glusterfs_ctx_t *ctx);
int glusterfs_graph_destroy (glusterfs_graph_t *graph);
diff --git a/rpc/xdr/src/cli1-xdr.c b/rpc/xdr/src/cli1-xdr.c
index 8e2adc51c..5885000cd 100644
--- a/rpc/xdr/src/cli1-xdr.c
+++ b/rpc/xdr/src/cli1-xdr.c
@@ -20,6 +20,12 @@
#include "xdr-common.h"
#include "compat.h"
+#if defined(__GNUC__)
+#if __GNUC__ >= 4
+#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
+#endif
+#endif
+
/*
* Please do not edit this file.
* It was generated using rpcgen.
diff --git a/rpc/xdr/src/cli1-xdr.h b/rpc/xdr/src/cli1-xdr.h
index 56a5f4802..32f624faf 100644
--- a/rpc/xdr/src/cli1-xdr.h
+++ b/rpc/xdr/src/cli1-xdr.h
@@ -20,6 +20,12 @@
#include "xdr-common.h"
#include "compat.h"
+#if defined(__GNUC__)
+#if __GNUC__ >= 4
+#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
+#endif
+#endif
+
/*
* Please do not edit this file.
* It was generated using rpcgen.
diff --git a/rpc/xdr/src/glusterd1-xdr.c b/rpc/xdr/src/glusterd1-xdr.c
index 0602d08a9..a5438d23e 100644
--- a/rpc/xdr/src/glusterd1-xdr.c
+++ b/rpc/xdr/src/glusterd1-xdr.c
@@ -20,6 +20,12 @@
#include "xdr-common.h"
#include "compat.h"
+#if defined(__GNUC__)
+#if __GNUC__ >= 4
+#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
+#endif
+#endif
+
/*
* Please do not edit this file.
* It was generated using rpcgen.
diff --git a/rpc/xdr/src/glusterd1-xdr.h b/rpc/xdr/src/glusterd1-xdr.h
index eecdd3e04..14c41baff 100644
--- a/rpc/xdr/src/glusterd1-xdr.h
+++ b/rpc/xdr/src/glusterd1-xdr.h
@@ -20,6 +20,12 @@
#include "xdr-common.h"
#include "compat.h"
+#if defined(__GNUC__)
+#if __GNUC__ >= 4
+#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
+#endif
+#endif
+
/*
* Please do not edit this file.
* It was generated using rpcgen.
diff --git a/rpc/xdr/src/glusterfs3-xdr.c b/rpc/xdr/src/glusterfs3-xdr.c
index ced80de62..64e504f46 100644
--- a/rpc/xdr/src/glusterfs3-xdr.c
+++ b/rpc/xdr/src/glusterfs3-xdr.c
@@ -20,6 +20,12 @@
#include "xdr-common.h"
#include "compat.h"
+#if defined(__GNUC__)
+#if __GNUC__ >= 4
+#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
+#endif
+#endif
+
/*
* Please do not edit this file.
* It was generated using rpcgen.
diff --git a/rpc/xdr/src/glusterfs3-xdr.h b/rpc/xdr/src/glusterfs3-xdr.h
index e1a62821a..0c8af17d2 100644
--- a/rpc/xdr/src/glusterfs3-xdr.h
+++ b/rpc/xdr/src/glusterfs3-xdr.h
@@ -20,6 +20,12 @@
#include "xdr-common.h"
#include "compat.h"
+#if defined(__GNUC__)
+#if __GNUC__ >= 4
+#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
+#endif
+#endif
+
/*
* Please do not edit this file.
* It was generated using rpcgen.
diff --git a/rpc/xdr/src/portmap-xdr.c b/rpc/xdr/src/portmap-xdr.c
index 0ef580d80..7033213c0 100644
--- a/rpc/xdr/src/portmap-xdr.c
+++ b/rpc/xdr/src/portmap-xdr.c
@@ -20,6 +20,12 @@
#include "xdr-common.h"
#include "compat.h"
+#if defined(__GNUC__)
+#if __GNUC__ >= 4
+#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
+#endif
+#endif
+
/*
* Please do not edit this file.
* It was generated using rpcgen.
diff --git a/rpc/xdr/src/portmap-xdr.h b/rpc/xdr/src/portmap-xdr.h
index 2096ef5d8..2686da287 100644
--- a/rpc/xdr/src/portmap-xdr.h
+++ b/rpc/xdr/src/portmap-xdr.h
@@ -20,6 +20,12 @@
#include "xdr-common.h"
#include "compat.h"
+#if defined(__GNUC__)
+#if __GNUC__ >= 4
+#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
+#endif
+#endif
+
/*
* Please do not edit this file.
* It was generated using rpcgen.
diff --git a/xlators/cluster/afr/src/afr-lk-common.c b/xlators/cluster/afr/src/afr-lk-common.c
index ba468dcdc..1828ddde7 100644
--- a/xlators/cluster/afr/src/afr-lk-common.c
+++ b/xlators/cluster/afr/src/afr-lk-common.c
@@ -588,7 +588,6 @@ afr_unlock_inodelk (call_frame_t *frame, xlator_t *this)
afr_private_t *priv = NULL;
struct gf_flock flock = {0,};
struct gf_flock full_flock = {0,};
- struct gf_flock *flock_use = &flock;
int call_count = 0;
int i = 0;
int piggyback = 0;
@@ -636,7 +635,6 @@ afr_unlock_inodelk (call_frame_t *frame, xlator_t *this)
}
piggyback = 0;
- flock_use = &full_flock;
LOCK (&local->fd->lock);
{
diff --git a/xlators/cluster/afr/src/afr-open.c b/xlators/cluster/afr/src/afr-open.c
index 4b328e184..4075c2724 100644
--- a/xlators/cluster/afr/src/afr-open.c
+++ b/xlators/cluster/afr/src/afr-open.c
@@ -92,14 +92,12 @@ afr_perform_data_self_heal (call_frame_t *frame, xlator_t *this)
{
afr_local_t *local = NULL;
afr_self_heal_t *sh = NULL;
- afr_private_t *priv = NULL;
inode_t *inode = NULL;
int st_child = -1;
char reason[64] = {0};
local = frame->local;
sh = &local->self_heal;
- priv = this->private;
inode = local->fd->inode;
if (!IA_ISREG (inode->ia_type))
@@ -392,13 +390,13 @@ int
afr_fix_open (call_frame_t *frame, xlator_t *this, afr_fd_ctx_t *fd_ctx,
int need_open_count, int *need_open)
{
- afr_local_t *local = NULL;
- afr_private_t *priv = NULL;
- int i = 0;
- call_frame_t *open_frame = NULL;
- afr_local_t *open_local = NULL;
- int ret = -1;
- int32_t op_errno = 0;
+ afr_local_t *local = NULL;
+ afr_private_t *priv = NULL;
+ int i = 0;
+ call_frame_t *open_frame = NULL;
+ afr_local_t *open_local = NULL;
+ int ret = -1;
+ GF_UNUSED int32_t op_errno = 0;
GF_ASSERT (fd_ctx);
GF_ASSERT (need_open_count > 0);
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c
index d1456d936..6dd17c1b8 100644
--- a/xlators/cluster/afr/src/afr-self-heal-common.c
+++ b/xlators/cluster/afr/src/afr-self-heal-common.c
@@ -1087,7 +1087,6 @@ afr_impunge_frame_create (call_frame_t *frame, xlator_t *this,
{
afr_local_t *local = NULL;
afr_local_t *impunge_local = NULL;
- afr_self_heal_t *sh = NULL;
afr_self_heal_t *impunge_sh = NULL;
int32_t op_errno = 0;
afr_private_t *priv = NULL;
@@ -1104,7 +1103,6 @@ afr_impunge_frame_create (call_frame_t *frame, xlator_t *this,
ALLOC_OR_GOTO (impunge_local, afr_local_t, out);
local = frame->local;
- sh = &local->self_heal;
new_frame->local = impunge_local;
impunge_sh = &impunge_local->self_heal;
impunge_sh->sh_frame = frame;
diff --git a/xlators/cluster/afr/src/afr-self-heal-entry.c b/xlators/cluster/afr/src/afr-self-heal-entry.c
index af41c480e..0481d915d 100644
--- a/xlators/cluster/afr/src/afr-self-heal-entry.c
+++ b/xlators/cluster/afr/src/afr-self-heal-entry.c
@@ -897,9 +897,7 @@ afr_sh_entry_call_impunge_done (call_frame_t *impunge_frame, xlator_t *this,
afr_self_heal_t *impunge_sh = NULL;
call_frame_t *frame = NULL;
int32_t impunge_ret_child = 0;
- afr_private_t *priv = NULL;
- priv = this->private;
AFR_INIT_SH_FRAME_VALS (impunge_frame, impunge_local, impunge_sh,
frame, local, sh);
@@ -918,12 +916,10 @@ afr_sh_entry_impunge_setattr_cbk (call_frame_t *impunge_frame, void *cookie,
int call_count = 0;
afr_private_t *priv = NULL;
afr_local_t *impunge_local = NULL;
- afr_self_heal_t *impunge_sh = NULL;
int child_index = 0;
priv = this->private;
impunge_local = impunge_frame->local;
- impunge_sh = &impunge_local->self_heal;
child_index = (long) cookie;
if (op_ret == 0) {
@@ -1247,11 +1243,9 @@ afr_sh_entry_impunge_symlink (call_frame_t *impunge_frame, xlator_t *this,
dict_t *dict = NULL;
struct iatt *buf = NULL;
int ret = 0;
- afr_self_heal_t *impunge_sh = NULL;
priv = this->private;
impunge_local = impunge_frame->local;
- impunge_sh = &impunge_local->self_heal;
buf = &impunge_local->cont.symlink.buf;
@@ -1734,7 +1728,6 @@ int
afr_sh_entry_impunge_entry (call_frame_t *frame, xlator_t *this,
gf_dirent_t *entry)
{
- afr_private_t *priv = NULL;
afr_local_t *local = NULL;
afr_self_heal_t *sh = NULL;
int ret = -1;
@@ -1745,7 +1738,6 @@ afr_sh_entry_impunge_entry (call_frame_t *frame, xlator_t *this,
int op_ret = -1;
mode_t entry_mode = 0;
- priv = this->private;
local = frame->local;
sh = &local->self_heal;
diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c
index 30450d97c..dd0dd86da 100644
--- a/xlators/cluster/afr/src/afr-self-heald.c
+++ b/xlators/cluster/afr/src/afr-self-heald.c
@@ -115,11 +115,8 @@ _perform_self_heal (xlator_t *this, loc_t *parentloc, gf_dirent_t *entries,
struct iatt parent = {0};;
int ret = 0;
loc_t entry_loc = {0};
- afr_private_t *priv = NULL;
dict_t *xattr_req = NULL;
- priv = this->private;
-
xattr_req = dict_new ();
if (!xattr_req) {
ret = -1;
@@ -525,3 +522,4 @@ afr_set_root_gfid (dict_t *dict)
return ret;
}
+
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
index 8ec634fd4..d3960dcff 100644
--- a/xlators/cluster/afr/src/afr-transaction.c
+++ b/xlators/cluster/afr/src/afr-transaction.c
@@ -336,15 +336,12 @@ afr_changelog_post_op_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
afr_internal_lock_t *int_lock = NULL;
afr_private_t *priv = NULL;
afr_local_t *local = NULL;
- int child_index = 0;
int call_count = -1;
priv = this->private;
local = frame->local;
int_lock = &local->internal_lock;
- child_index = (long) cookie;
-
LOCK (&frame->lock);
{
call_count = --local->call_count;
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c
index 8bb94e205..30da3fc72 100644
--- a/xlators/cluster/afr/src/afr.c
+++ b/xlators/cluster/afr/src/afr.c
@@ -178,7 +178,7 @@ init (xlator_t *this)
xlator_list_t * trav = NULL;
int i = 0;
int ret = -1;
- int op_errno = 0;
+ GF_UNUSED int op_errno = 0;
xlator_t * read_subvol = NULL;
xlator_t * fav_child = NULL;
diff --git a/xlators/cluster/afr/src/pump.c b/xlators/cluster/afr/src/pump.c
index 63c89b3c7..dbf86b0a2 100644
--- a/xlators/cluster/afr/src/pump.c
+++ b/xlators/cluster/afr/src/pump.c
@@ -249,13 +249,11 @@ static int
pump_update_resume_state (xlator_t *this, const char *path)
{
afr_private_t *priv = NULL;
- pump_private_t *pump_priv = NULL;
pump_state_t state;
const char *resume_path = NULL;
priv = this->private;
- pump_priv = priv->pump_private;
state = pump_get_state ();
@@ -284,14 +282,10 @@ pump_update_resume_state (xlator_t *this, const char *path)
static gf_boolean_t
is_pump_traversal_allowed (xlator_t *this, const char *path)
{
- afr_private_t *priv = NULL;
-
pump_state_t state;
const char *resume_path = NULL;
gf_boolean_t ret = _gf_true;
- priv = this->private;
-
state = pump_get_state ();
if (state == PUMP_STATE_RESUME) {
@@ -472,12 +466,8 @@ out:
static int
pump_update_resume_path (xlator_t *this)
{
- afr_private_t *priv = NULL;
-
const char *resume_path = NULL;
- priv = this->private;
-
resume_path = pump_get_resume_path (this);
if (resume_path) {
@@ -2386,7 +2376,7 @@ init (xlator_t *this)
xlator_list_t * trav = NULL;
int i = 0;
int ret = -1;
- int op_errno = 0;
+ GF_UNUSED int op_errno = 0;
int source_child = 0;
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 671a9b209..6cf1d0c85 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -1031,7 +1031,6 @@ dht_lookup (call_frame_t *frame, xlator_t *this,
{
xlator_t *subvol = NULL;
xlator_t *hashed_subvol = NULL;
- xlator_t *cached_subvol = NULL;
dht_local_t *local = NULL;
dht_conf_t *conf = NULL;
int ret = -1;
@@ -1083,7 +1082,6 @@ dht_lookup (call_frame_t *frame, xlator_t *this,
}
- cached_subvol = local->cached_subvol;
if (!hashed_subvol)
hashed_subvol = dht_subvol_get_hashed (this, loc);
local->hashed_subvol = hashed_subvol;
diff --git a/xlators/cluster/dht/src/nufa.c b/xlators/cluster/dht/src/nufa.c
index 9dcf224d1..2f196951a 100644
--- a/xlators/cluster/dht/src/nufa.c
+++ b/xlators/cluster/dht/src/nufa.c
@@ -150,7 +150,6 @@ nufa_lookup (call_frame_t *frame, xlator_t *this,
loc_t *loc, dict_t *xattr_req)
{
xlator_t *hashed_subvol = NULL;
- xlator_t *cached_subvol = NULL;
xlator_t *subvol = NULL;
dht_local_t *local = NULL;
dht_conf_t *conf = NULL;
@@ -182,7 +181,6 @@ nufa_lookup (call_frame_t *frame, xlator_t *this,
}
hashed_subvol = dht_subvol_get_hashed (this, &local->loc);
- cached_subvol = local->cached_subvol;
local->hashed_subvol = hashed_subvol;
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c
index ba691e389..c15d59f54 100644
--- a/xlators/features/quota/src/quota.c
+++ b/xlators/features/quota/src/quota.c
@@ -144,8 +144,8 @@ out:
quota_local_t *
quota_local_new ()
{
- quota_local_t *local = NULL;
- int32_t ret = 0;
+ quota_local_t *local = NULL;
+ GF_UNUSED int32_t ret = 0;
QUOTA_LOCAL_ALLOC_OR_GOTO (local, quota_local_t, err);
err:
@@ -156,8 +156,8 @@ err:
quota_dentry_t *
__quota_dentry_new (quota_inode_ctx_t *ctx, char *name, ino_t par)
{
- quota_dentry_t *dentry = NULL;
- int32_t ret = 0;
+ quota_dentry_t *dentry = NULL;
+ GF_UNUSED int32_t ret = 0;
QUOTA_ALLOC_OR_GOTO (dentry, quota_dentry_t, err);