core: fixes for gcc's '-pedantic' flag build
* warnings on 'void *' arguments * warnings on empty initializations * warnings on empty array (array[0]) Change-Id: Iae440f54cbd59580eb69f3ecaed5a9926c0edf95 BUG: 875913 Signed-off-by: Avra Sengupta <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/4219 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
This commit is contained in:
parent
6e18e3bd81
commit
777d395fea
@ -101,13 +101,10 @@ fini (xlator_t *this)
|
||||
}
|
||||
|
||||
|
||||
struct xlator_dumpops dumpops = {
|
||||
};
|
||||
struct xlator_dumpops dumpops;
|
||||
|
||||
|
||||
struct xlator_fops fops = {
|
||||
};
|
||||
struct xlator_fops fops;
|
||||
|
||||
|
||||
struct xlator_cbks cbks = {
|
||||
};
|
||||
struct xlator_cbks cbks;
|
||||
|
@ -556,7 +556,7 @@ struct fuse_dirent {
|
||||
__u64 off;
|
||||
__u32 namelen;
|
||||
__u32 type;
|
||||
char name[0];
|
||||
char name[];
|
||||
};
|
||||
|
||||
#define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
|
||||
|
@ -1,10 +1,10 @@
|
||||
#ifdef THREAD_UNSAFE_BASENAME
|
||||
/*
|
||||
* borrowed from glibc-2.12.1/string/basename.c
|
||||
* borrowed from glibc-2.12.1/string/basename.c
|
||||
* Modified to return "." for NULL or "", as required for SUSv2.
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef THREAD_UNSAFE_BASENAME
|
||||
|
||||
/* Return the name-within-directory of a file name.
|
||||
Copyright (C) 1996,97,98,2002 Free Software Foundation, Inc.
|
||||
|
@ -1,4 +1,3 @@
|
||||
#ifdef THREAD_UNSAFE_DIRNAME
|
||||
/*
|
||||
* Borrowed from glibc-2.12.1/string/memrchr.c
|
||||
* Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
|
||||
@ -7,6 +6,7 @@
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef THREAD_UNSAFE_DIRNAME
|
||||
|
||||
/* memrchr -- find the last occurrence of a byte in a memory block
|
||||
Copyright (C) 1991, 93, 96, 97, 99, 2000 Free Software Foundation, Inc.
|
||||
|
@ -45,7 +45,7 @@ struct _gf_dirent_t {
|
||||
struct iatt d_stat;
|
||||
dict_t *dict;
|
||||
inode_t *inode;
|
||||
char d_name[0];
|
||||
char d_name[];
|
||||
};
|
||||
|
||||
#define DT_ISDIR(mode) (mode == DT_DIR)
|
||||
|
@ -26,87 +26,87 @@ gf_set_fop_from_fn_pointer (call_frame_t *frame, struct xlator_fops *fops, void
|
||||
{
|
||||
glusterfs_fop_t fop = -1;
|
||||
|
||||
if (fops->stat == fn)
|
||||
if (fops->stat == *(fop_stat_t *)fn)
|
||||
fop = GF_FOP_STAT;
|
||||
else if (fops->readlink == fn)
|
||||
else if (fops->readlink == *(fop_readlink_t *)fn)
|
||||
fop = GF_FOP_READLINK;
|
||||
else if (fops->mknod == fn)
|
||||
else if (fops->mknod == *(fop_mknod_t *)fn)
|
||||
fop = GF_FOP_MKNOD;
|
||||
else if (fops->mkdir == fn)
|
||||
else if (fops->mkdir == *(fop_mkdir_t *)fn)
|
||||
fop = GF_FOP_MKDIR;
|
||||
else if (fops->unlink == fn)
|
||||
else if (fops->unlink == *(fop_unlink_t *)fn)
|
||||
fop = GF_FOP_UNLINK;
|
||||
else if (fops->rmdir == fn)
|
||||
else if (fops->rmdir == *(fop_rmdir_t *)fn)
|
||||
fop = GF_FOP_RMDIR;
|
||||
else if (fops->symlink == fn)
|
||||
else if (fops->symlink == *(fop_symlink_t *)fn)
|
||||
fop = GF_FOP_SYMLINK;
|
||||
else if (fops->rename == fn)
|
||||
else if (fops->rename == *(fop_rename_t *)fn)
|
||||
fop = GF_FOP_RENAME;
|
||||
else if (fops->link == fn)
|
||||
else if (fops->link == *(fop_link_t *)fn)
|
||||
fop = GF_FOP_LINK;
|
||||
else if (fops->truncate == fn)
|
||||
else if (fops->truncate == *(fop_truncate_t *)fn)
|
||||
fop = GF_FOP_TRUNCATE;
|
||||
else if (fops->open == fn)
|
||||
else if (fops->open == *(fop_open_t *)fn)
|
||||
fop = GF_FOP_OPEN;
|
||||
else if (fops->readv == fn)
|
||||
else if (fops->readv == *(fop_readv_t *)fn)
|
||||
fop = GF_FOP_READ;
|
||||
else if (fops->writev == fn)
|
||||
else if (fops->writev == *(fop_writev_t *)fn)
|
||||
fop = GF_FOP_WRITE;
|
||||
else if (fops->statfs == fn)
|
||||
else if (fops->statfs == *(fop_statfs_t *)fn)
|
||||
fop = GF_FOP_STATFS;
|
||||
else if (fops->flush == fn)
|
||||
else if (fops->flush == *(fop_flush_t *)fn)
|
||||
fop = GF_FOP_FLUSH;
|
||||
else if (fops->fsync == fn)
|
||||
else if (fops->fsync == *(fop_fsync_t *)fn)
|
||||
fop = GF_FOP_FSYNC;
|
||||
else if (fops->setxattr == fn)
|
||||
else if (fops->setxattr == *(fop_setxattr_t *)fn)
|
||||
fop = GF_FOP_SETXATTR;
|
||||
else if (fops->getxattr == fn)
|
||||
else if (fops->getxattr == *(fop_getxattr_t *)fn)
|
||||
fop = GF_FOP_GETXATTR;
|
||||
else if (fops->removexattr == fn)
|
||||
else if (fops->removexattr == *(fop_removexattr_t *)fn)
|
||||
fop = GF_FOP_REMOVEXATTR;
|
||||
else if (fops->opendir == fn)
|
||||
else if (fops->opendir == *(fop_opendir_t *)fn)
|
||||
fop = GF_FOP_OPENDIR;
|
||||
else if (fops->fsyncdir == fn)
|
||||
else if (fops->fsyncdir == *(fop_fsyncdir_t *)fn)
|
||||
fop = GF_FOP_FSYNCDIR;
|
||||
else if (fops->access == fn)
|
||||
else if (fops->access == *(fop_access_t *)fn)
|
||||
fop = GF_FOP_ACCESS;
|
||||
else if (fops->create == fn)
|
||||
else if (fops->create == *(fop_create_t *)fn)
|
||||
fop = GF_FOP_CREATE;
|
||||
else if (fops->ftruncate == fn)
|
||||
else if (fops->ftruncate == *(fop_ftruncate_t *)fn)
|
||||
fop = GF_FOP_FTRUNCATE;
|
||||
else if (fops->fstat == fn)
|
||||
else if (fops->fstat == *(fop_fstat_t *)fn)
|
||||
fop = GF_FOP_FSTAT;
|
||||
else if (fops->lk == fn)
|
||||
else if (fops->lk == *(fop_lk_t *)fn)
|
||||
fop = GF_FOP_LK;
|
||||
else if (fops->lookup == fn)
|
||||
else if (fops->lookup == *(fop_lookup_t *)fn)
|
||||
fop = GF_FOP_LOOKUP;
|
||||
else if (fops->readdir == fn)
|
||||
else if (fops->readdir == *(fop_readdir_t *)fn)
|
||||
fop = GF_FOP_READDIR;
|
||||
else if (fops->inodelk == fn)
|
||||
else if (fops->inodelk == *(fop_inodelk_t *)fn)
|
||||
fop = GF_FOP_INODELK;
|
||||
else if (fops->finodelk == fn)
|
||||
else if (fops->finodelk == *(fop_finodelk_t *)fn)
|
||||
fop = GF_FOP_FINODELK;
|
||||
else if (fops->entrylk == fn)
|
||||
else if (fops->entrylk == *(fop_entrylk_t *)fn)
|
||||
fop = GF_FOP_ENTRYLK;
|
||||
else if (fops->fentrylk == fn)
|
||||
else if (fops->fentrylk == *(fop_fentrylk_t *)fn)
|
||||
fop = GF_FOP_FENTRYLK;
|
||||
else if (fops->xattrop == fn)
|
||||
else if (fops->xattrop == *(fop_xattrop_t *)fn)
|
||||
fop = GF_FOP_XATTROP;
|
||||
else if (fops->fxattrop == fn)
|
||||
else if (fops->fxattrop == *(fop_fxattrop_t *)fn)
|
||||
fop = GF_FOP_FXATTROP;
|
||||
else if (fops->fgetxattr == fn)
|
||||
else if (fops->fgetxattr == *(fop_fgetxattr_t *)fn)
|
||||
fop = GF_FOP_FGETXATTR;
|
||||
else if (fops->fsetxattr == fn)
|
||||
else if (fops->fsetxattr == *(fop_fsetxattr_t *)fn)
|
||||
fop = GF_FOP_FSETXATTR;
|
||||
else if (fops->rchecksum == fn)
|
||||
else if (fops->rchecksum == *(fop_rchecksum_t *)fn)
|
||||
fop = GF_FOP_RCHECKSUM;
|
||||
else if (fops->setattr == fn)
|
||||
else if (fops->setattr == *(fop_setattr_t *)fn)
|
||||
fop = GF_FOP_SETATTR;
|
||||
else if (fops->fsetattr == fn)
|
||||
else if (fops->fsetattr == *(fop_fsetattr_t *)fn)
|
||||
fop = GF_FOP_FSETATTR;
|
||||
else if (fops->readdirp == fn)
|
||||
else if (fops->readdirp == *(fop_readdirp_t *)fn)
|
||||
fop = GF_FOP_READDIRP;
|
||||
else if (fops->getspec == fn)
|
||||
else if (fops->getspec == *(fop_getspec_t *)fn)
|
||||
fop = GF_FOP_GETSPEC;
|
||||
else
|
||||
fop = -1;
|
||||
|
@ -220,7 +220,7 @@ synctask_new (struct syncenv *env, synctask_fn_t fn, synctask_cbk_t cbk,
|
||||
newtask->ctx.uc_stack.ss_sp = newtask->stack;
|
||||
newtask->ctx.uc_stack.ss_size = env->stacksize;
|
||||
|
||||
makecontext (&newtask->ctx, (void *) synctask_wrap, 2, newtask);
|
||||
makecontext (&newtask->ctx, (void (*)(void)) synctask_wrap, 2, newtask);
|
||||
|
||||
newtask->state = SYNCTASK_INIT;
|
||||
|
||||
|
@ -218,19 +218,19 @@ xlator_dynload (xlator_t *xl)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!(xl->init = dlsym (handle, "init"))) {
|
||||
if (!(*VOID(&xl->init) = dlsym (handle, "init"))) {
|
||||
gf_log ("xlator", GF_LOG_WARNING, "dlsym(init) on %s",
|
||||
dlerror ());
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!(xl->fini = dlsym (handle, "fini"))) {
|
||||
if (!(*VOID(&(xl->fini)) = dlsym (handle, "fini"))) {
|
||||
gf_log ("xlator", GF_LOG_WARNING, "dlsym(fini) on %s",
|
||||
dlerror ());
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!(xl->notify = dlsym (handle, "notify"))) {
|
||||
if (!(*VOID(&(xl->notify)) = dlsym (handle, "notify"))) {
|
||||
gf_log ("xlator", GF_LOG_TRACE,
|
||||
"dlsym(notify) on %s -- neglecting", dlerror ());
|
||||
}
|
||||
@ -240,13 +240,13 @@ xlator_dynload (xlator_t *xl)
|
||||
"dlsym(dumpops) on %s -- neglecting", dlerror ());
|
||||
}
|
||||
|
||||
if (!(xl->mem_acct_init = dlsym (handle, "mem_acct_init"))) {
|
||||
if (!(*VOID(&(xl->mem_acct_init)) = dlsym (handle, "mem_acct_init"))) {
|
||||
gf_log (xl->name, GF_LOG_TRACE,
|
||||
"dlsym(mem_acct_init) on %s -- neglecting",
|
||||
dlerror ());
|
||||
}
|
||||
|
||||
if (!(xl->reconfigure = dlsym (handle, "reconfigure"))) {
|
||||
if (!(*VOID(&(xl->reconfigure)) = dlsym (handle, "reconfigure"))) {
|
||||
gf_log ("xlator", GF_LOG_TRACE,
|
||||
"dlsym(reconfigure) on %s -- neglecting",
|
||||
dlerror());
|
||||
|
@ -444,7 +444,7 @@ rpc_clnt_reconnect (void *trans_ptr)
|
||||
int
|
||||
rpc_clnt_fill_request_info (struct rpc_clnt *clnt, rpc_request_info_t *info)
|
||||
{
|
||||
struct saved_frame saved_frame = {{}, 0};
|
||||
struct saved_frame saved_frame;
|
||||
int ret = -1;
|
||||
|
||||
pthread_mutex_lock (&clnt->conn.lock);
|
||||
|
@ -266,21 +266,21 @@ rpc_transport_load (glusterfs_ctx_t *ctx, dict_t *options, char *trans_name)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
trans->init = dlsym (handle, "init");
|
||||
*VOID(&(trans->init)) = dlsym (handle, "init");
|
||||
if (trans->init == NULL) {
|
||||
gf_log ("rpc-transport", GF_LOG_ERROR,
|
||||
"dlsym (gf_rpc_transport_init) on %s", dlerror ());
|
||||
goto fail;
|
||||
}
|
||||
|
||||
trans->fini = dlsym (handle, "fini");
|
||||
*VOID(&(trans->fini)) = dlsym (handle, "fini");
|
||||
if (trans->fini == NULL) {
|
||||
gf_log ("rpc-transport", GF_LOG_ERROR,
|
||||
"dlsym (gf_rpc_transport_fini) on %s", dlerror ());
|
||||
goto fail;
|
||||
}
|
||||
|
||||
trans->reconfigure = dlsym (handle, "reconfigure");
|
||||
*VOID(&(trans->reconfigure)) = dlsym (handle, "reconfigure");
|
||||
if (trans->fini == NULL) {
|
||||
gf_log ("rpc-transport", GF_LOG_DEBUG,
|
||||
"dlsym (gf_rpc_transport_reconfigure) on %s", dlerror());
|
||||
|
@ -53,7 +53,7 @@ struct dht_layout {
|
||||
uint32_t start;
|
||||
uint32_t stop;
|
||||
xlator_t *xlator;
|
||||
} list[0];
|
||||
} list[];
|
||||
};
|
||||
typedef struct dht_layout dht_layout_t;
|
||||
|
||||
|
@ -2131,8 +2131,7 @@ struct xlator_dumpops dumpops = {
|
||||
.priv = error_gen_priv_dump,
|
||||
};
|
||||
|
||||
struct xlator_fops cbks = {
|
||||
};
|
||||
struct xlator_fops cbks;
|
||||
|
||||
struct xlator_fops fops = {
|
||||
.lookup = error_gen_lookup,
|
||||
|
@ -186,8 +186,7 @@ struct xlator_fops fops = {
|
||||
.writev = rot13_writev
|
||||
};
|
||||
|
||||
struct xlator_cbks cbks = {
|
||||
};
|
||||
struct xlator_cbks cbks;
|
||||
|
||||
struct volume_options options[] = {
|
||||
{ .key = {"encrypt-write"},
|
||||
|
@ -1183,8 +1183,7 @@ struct xlator_fops fops = {
|
||||
.unlink = index_unlink
|
||||
};
|
||||
|
||||
struct xlator_dumpops dumpops = {
|
||||
};
|
||||
struct xlator_dumpops dumpops;
|
||||
|
||||
struct xlator_cbks cbks = {
|
||||
.forget = index_forget,
|
||||
|
@ -230,8 +230,7 @@ struct xlator_fops fops = {
|
||||
.fsetxattr = maccomp_fsetxattr,
|
||||
};
|
||||
|
||||
struct xlator_cbks cbks = {
|
||||
};
|
||||
struct xlator_cbks cbks;
|
||||
|
||||
struct volume_options options[] = {
|
||||
{ .key = {NULL} },
|
||||
|
@ -2599,12 +2599,10 @@ struct xlator_fops fops = {
|
||||
|
||||
};
|
||||
|
||||
struct xlator_dumpops dumpops = {
|
||||
};
|
||||
struct xlator_dumpops dumpops;
|
||||
|
||||
|
||||
struct xlator_cbks cbks = {
|
||||
};
|
||||
struct xlator_cbks cbks;
|
||||
|
||||
|
||||
struct volume_options options[] = {
|
||||
|
@ -81,8 +81,7 @@ struct xlator_fops fops = {
|
||||
.lk = ro_lk,
|
||||
};
|
||||
|
||||
struct xlator_cbks cbks = {
|
||||
};
|
||||
struct xlator_cbks cbks;
|
||||
|
||||
struct volume_options options[] = {
|
||||
{ .key = {NULL} },
|
||||
|
@ -1211,11 +1211,9 @@ notify (xlator_t *this, int32_t event, void *data, ...)
|
||||
}
|
||||
|
||||
|
||||
struct xlator_fops fops = {
|
||||
};
|
||||
struct xlator_fops fops;
|
||||
|
||||
struct xlator_cbks cbks = {
|
||||
};
|
||||
struct xlator_cbks cbks;
|
||||
|
||||
struct xlator_dumpops dumpops = {
|
||||
.priv = glusterd_priv,
|
||||
|
@ -4706,8 +4706,7 @@ static fuse_handler_t *fuse_std_ops[FUSE_OP_HIGH] = {
|
||||
};
|
||||
|
||||
|
||||
static fuse_handler_t *fuse_dump_ops[FUSE_OP_HIGH] = {
|
||||
};
|
||||
static fuse_handler_t *fuse_dump_ops[FUSE_OP_HIGH];
|
||||
|
||||
|
||||
static void
|
||||
@ -4735,7 +4734,7 @@ fuse_dumper (xlator_t *this, fuse_in_header_t *finh, void *msg)
|
||||
"failed to dump fuse message (R): %s",
|
||||
strerror (errno));
|
||||
|
||||
return priv->fuse_ops0[finh->opcode] (this, finh, msg);
|
||||
priv->fuse_ops0[finh->opcode] (this, finh, msg);
|
||||
}
|
||||
|
||||
|
||||
@ -5065,8 +5064,7 @@ fini (xlator_t *this_xl)
|
||||
kill (getpid (), SIGTERM);
|
||||
}
|
||||
|
||||
struct xlator_fops fops = {
|
||||
};
|
||||
struct xlator_fops fops;
|
||||
|
||||
struct xlator_cbks cbks = {
|
||||
.invalidate = fuse_invalidate,
|
||||
|
@ -120,7 +120,7 @@ nfs_fop_local_wipe (xlator_t *xl, struct nfs_fop_local *l);
|
||||
nflocal = nfs_fop_local_init (nf); \
|
||||
if (nflocal) { \
|
||||
nflocal->proglocal = plocal; \
|
||||
nflocal->progcbk = pcbk; \
|
||||
nflocal->progcbk = *VOID(&pcbk); \
|
||||
nflocal->nfsx = nf; \
|
||||
if (fram) \
|
||||
((call_frame_t *)fram)->local = nflocal;\
|
||||
|
@ -36,7 +36,7 @@
|
||||
do { \
|
||||
nflocal = fram->local; \
|
||||
fram->local = nflocal->proglocal; \
|
||||
pcbk = nflocal->progcbk; \
|
||||
*VOID(&pcbk) = nflocal->progcbk; \
|
||||
nfs_fop_local_wipe (nflocal->nfsx, nflocal); \
|
||||
} while (0) \
|
||||
|
||||
|
@ -1004,7 +1004,7 @@ struct xlator_cbks cbks = {
|
||||
.forget = nfs_forget,
|
||||
};
|
||||
|
||||
struct xlator_fops fops = { };
|
||||
struct xlator_fops fops;
|
||||
|
||||
struct xlator_dumpops dumpops = {
|
||||
.priv = nfs_priv,
|
||||
|
@ -2738,8 +2738,7 @@ struct xlator_fops fops = {
|
||||
.rchecksum = iot_rchecksum,
|
||||
};
|
||||
|
||||
struct xlator_cbks cbks = {
|
||||
};
|
||||
struct xlator_cbks cbks;
|
||||
|
||||
struct volume_options options[] = {
|
||||
{ .key = {"thread-count"},
|
||||
|
@ -65,7 +65,11 @@ static struct mdc_key {
|
||||
.load = 0,
|
||||
.check = 1,
|
||||
},
|
||||
{},
|
||||
{
|
||||
.name = NULL,
|
||||
.load = 0,
|
||||
.check = 0,
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -1220,11 +1220,9 @@ notify (xlator_t *this, int32_t event, void *data, ...)
|
||||
}
|
||||
|
||||
|
||||
struct xlator_fops fops = {
|
||||
};
|
||||
struct xlator_fops fops;
|
||||
|
||||
struct xlator_cbks cbks = {
|
||||
};
|
||||
struct xlator_cbks cbks;
|
||||
|
||||
struct xlator_dumpops dumpops = {
|
||||
.priv = server_priv,
|
||||
|
@ -27,7 +27,7 @@ struct posix_acl_xattr_entry {
|
||||
|
||||
struct posix_acl_xattr_header {
|
||||
uint32_t version;
|
||||
struct posix_acl_xattr_entry entries[0];
|
||||
struct posix_acl_xattr_entry entries[];
|
||||
};
|
||||
|
||||
struct posix_acl *posix_acl_from_xattr (xlator_t *this, const char *buf, int size);
|
||||
|
@ -43,7 +43,7 @@ struct posix_ace {
|
||||
struct posix_acl {
|
||||
int refcnt;
|
||||
int count;
|
||||
struct posix_ace entries[0];
|
||||
struct posix_ace entries[];
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user