From 777d395feaa082a69e32d985bbc1cca3d3dad077 Mon Sep 17 00:00:00 2001 From: Avra Sengupta Date: Wed, 21 Nov 2012 14:07:05 +0530 Subject: 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 Reviewed-on: http://review.gluster.org/4219 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/cluster/dht/src/dht-common.h | 2 +- xlators/debug/error-gen/src/error-gen.c | 3 +-- xlators/encryption/rot-13/src/rot-13.c | 3 +-- xlators/features/index/src/index.c | 3 +-- xlators/features/mac-compat/src/mac-compat.c | 3 +-- xlators/features/quiesce/src/quiesce.c | 6 ++---- xlators/features/read-only/src/worm.c | 3 +-- xlators/mgmt/glusterd/src/glusterd.c | 6 ++---- xlators/mount/fuse/src/fuse-bridge.c | 8 +++----- xlators/nfs/server/src/nfs-fops.h | 2 +- xlators/nfs/server/src/nfs-inodes.c | 2 +- xlators/nfs/server/src/nfs.c | 2 +- xlators/performance/io-threads/src/io-threads.c | 3 +-- xlators/performance/md-cache/src/md-cache.c | 6 +++++- xlators/protocol/server/src/server.c | 6 ++---- xlators/system/posix-acl/src/posix-acl-xattr.h | 2 +- xlators/system/posix-acl/src/posix-acl.h | 2 +- 17 files changed, 26 insertions(+), 36 deletions(-) (limited to 'xlators') diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h index 83ec345d645..764b37ac4a0 100644 --- a/xlators/cluster/dht/src/dht-common.h +++ b/xlators/cluster/dht/src/dht-common.h @@ -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; diff --git a/xlators/debug/error-gen/src/error-gen.c b/xlators/debug/error-gen/src/error-gen.c index 2194a90ee1f..6bdb041959c 100644 --- a/xlators/debug/error-gen/src/error-gen.c +++ b/xlators/debug/error-gen/src/error-gen.c @@ -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, diff --git a/xlators/encryption/rot-13/src/rot-13.c b/xlators/encryption/rot-13/src/rot-13.c index c475e5cb585..b9ac29a72e1 100644 --- a/xlators/encryption/rot-13/src/rot-13.c +++ b/xlators/encryption/rot-13/src/rot-13.c @@ -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"}, diff --git a/xlators/features/index/src/index.c b/xlators/features/index/src/index.c index d061c410331..3245076ecef 100644 --- a/xlators/features/index/src/index.c +++ b/xlators/features/index/src/index.c @@ -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, diff --git a/xlators/features/mac-compat/src/mac-compat.c b/xlators/features/mac-compat/src/mac-compat.c index b50afe99980..7cb550ad581 100644 --- a/xlators/features/mac-compat/src/mac-compat.c +++ b/xlators/features/mac-compat/src/mac-compat.c @@ -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} }, diff --git a/xlators/features/quiesce/src/quiesce.c b/xlators/features/quiesce/src/quiesce.c index 527a48b3e76..73eb919477b 100644 --- a/xlators/features/quiesce/src/quiesce.c +++ b/xlators/features/quiesce/src/quiesce.c @@ -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[] = { diff --git a/xlators/features/read-only/src/worm.c b/xlators/features/read-only/src/worm.c index 34e7d664376..16c3eb3daed 100644 --- a/xlators/features/read-only/src/worm.c +++ b/xlators/features/read-only/src/worm.c @@ -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} }, diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c index 014f1d55a5e..644c837aca4 100644 --- a/xlators/mgmt/glusterd/src/glusterd.c +++ b/xlators/mgmt/glusterd/src/glusterd.c @@ -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, diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index 214923decaa..875abbe1db1 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -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, diff --git a/xlators/nfs/server/src/nfs-fops.h b/xlators/nfs/server/src/nfs-fops.h index 3ada863de38..d846e14de5b 100644 --- a/xlators/nfs/server/src/nfs-fops.h +++ b/xlators/nfs/server/src/nfs-fops.h @@ -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;\ diff --git a/xlators/nfs/server/src/nfs-inodes.c b/xlators/nfs/server/src/nfs-inodes.c index c9bf3720689..a68f8b227a4 100644 --- a/xlators/nfs/server/src/nfs-inodes.c +++ b/xlators/nfs/server/src/nfs-inodes.c @@ -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) \ diff --git a/xlators/nfs/server/src/nfs.c b/xlators/nfs/server/src/nfs.c index 8e40698d369..466393e34b1 100644 --- a/xlators/nfs/server/src/nfs.c +++ b/xlators/nfs/server/src/nfs.c @@ -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, diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c index dbf1929e897..ccbd4119483 100644 --- a/xlators/performance/io-threads/src/io-threads.c +++ b/xlators/performance/io-threads/src/io-threads.c @@ -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"}, diff --git a/xlators/performance/md-cache/src/md-cache.c b/xlators/performance/md-cache/src/md-cache.c index 237acab9f18..9ccd655383a 100644 --- a/xlators/performance/md-cache/src/md-cache.c +++ b/xlators/performance/md-cache/src/md-cache.c @@ -65,7 +65,11 @@ static struct mdc_key { .load = 0, .check = 1, }, - {}, + { + .name = NULL, + .load = 0, + .check = 0, + } }; diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c index d2bc4876c5b..cdf421ddda6 100644 --- a/xlators/protocol/server/src/server.c +++ b/xlators/protocol/server/src/server.c @@ -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, diff --git a/xlators/system/posix-acl/src/posix-acl-xattr.h b/xlators/system/posix-acl/src/posix-acl-xattr.h index 9035d87613b..c4e90f5f9c8 100644 --- a/xlators/system/posix-acl/src/posix-acl-xattr.h +++ b/xlators/system/posix-acl/src/posix-acl-xattr.h @@ -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); diff --git a/xlators/system/posix-acl/src/posix-acl.h b/xlators/system/posix-acl/src/posix-acl.h index 0c2b647aa84..6ac2c6a8433 100644 --- a/xlators/system/posix-acl/src/posix-acl.h +++ b/xlators/system/posix-acl/src/posix-acl.h @@ -43,7 +43,7 @@ struct posix_ace { struct posix_acl { int refcnt; int count; - struct posix_ace entries[0]; + struct posix_ace entries[]; }; -- cgit