diff options
author | Dmitry Antipov <dmantipov@yandex.ru> | 2020-04-29 10:47:31 +0300 |
---|---|---|
committer | Amar Tumballi <amar@kadalu.io> | 2020-05-01 04:26:36 +0000 |
commit | 11ea746d0813e9599c2c8d0c36fcd7be5d25ac65 (patch) | |
tree | 9c14811a696b6a09b4720998cda5f496e3187e86 /xlators/cluster/ec/src/ec-combine.c | |
parent | b0f41bc56d3867dc4cf2125d8ae87ddff2593229 (diff) |
cluster/ec: Fix varargs warning reported with clang-10
Found with clang-10 -Wvarargs:
xlators/cluster/ec/src/ec-combine.c:360:20: warning: passing an object that undergoes
default argument promotion to 'va_start' has undefined behavior [-Wvarargs]
va_start(args, global);
^
xlators/cluster/ec/src/ec-combine.c:348:34: note: parameter of type 'bool' is declared here
gf_boolean_t global, ...)
According to The C11 Standard, 7.16.1.4p4:
If the parameter parmN is declared with the register storage class, with a function
or array type, or with a type that is not compatible with the type that results after
application of the default argument promotions, the behavior is undefined.
Fixes: #1207
Change-Id: I527527845b2d574000d736c278be87cf19504761
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Diffstat (limited to 'xlators/cluster/ec/src/ec-combine.c')
-rw-r--r-- | xlators/cluster/ec/src/ec-combine.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/xlators/cluster/ec/src/ec-combine.c b/xlators/cluster/ec/src/ec-combine.c index 9d712b359a0..703a30e2485 100644 --- a/xlators/cluster/ec/src/ec-combine.c +++ b/xlators/cluster/ec/src/ec-combine.c @@ -343,9 +343,8 @@ out: } static int32_t -ec_dict_data_concat(const char *fmt, ec_cbk_data_t *cbk, int32_t which, - char *key, char *new_key, const char *def, - gf_boolean_t global, ...) +ec_dict_data_concat(ec_cbk_data_t *cbk, int32_t which, char *key, char *new_key, + const char *def, gf_boolean_t global, const char *fmt, ...) { ec_t *ec = cbk->fop->xl->private; data_t *data[ec->nodes]; @@ -357,7 +356,7 @@ ec_dict_data_concat(const char *fmt, ec_cbk_data_t *cbk, int32_t which, ec_dict_list(data, cbk, which, key, global); - va_start(args, global); + va_start(args, fmt); err = ec_concat_prepare(cbk->fop->xl, &pre, &sep, &post, fmt, args); va_end(args); @@ -730,14 +729,14 @@ ec_dict_data_combine(dict_t *dict, char *key, data_t *value, void *arg) if ((strcmp(key, GF_XATTR_PATHINFO_KEY) == 0) || (strcmp(key, GF_XATTR_USER_PATHINFO_KEY) == 0)) { - return ec_dict_data_concat("(<EC:%s> { })", data->cbk, data->which, key, - NULL, NULL, _gf_false, + return ec_dict_data_concat(data->cbk, data->which, key, NULL, NULL, + _gf_false, _gf_false, "(<EC:%s> { })", data->cbk->fop->xl->name); } if (strncmp(key, GF_XATTR_CLRLK_CMD, SLEN(GF_XATTR_CLRLK_CMD)) == 0) { - return ec_dict_data_concat("{\n}", data->cbk, data->which, key, NULL, - NULL, _gf_false); + return ec_dict_data_concat(data->cbk, data->which, key, NULL, NULL, + _gf_false, "{\n}"); } if (strncmp(key, GF_XATTR_LOCKINFO_KEY, SLEN(GF_XATTR_LOCKINFO_KEY)) == 0) { @@ -767,9 +766,9 @@ ec_dict_data_combine(dict_t *dict, char *key, data_t *value, void *arg) if (XATTR_IS_NODE_UUID(key)) { if (data->cbk->fop->int32) { /* List of node uuid is requested */ - return ec_dict_data_concat("{ }", data->cbk, data->which, key, + return ec_dict_data_concat(data->cbk, data->which, key, GF_XATTR_LIST_NODE_UUIDS_KEY, UUID0_STR, - _gf_true); + _gf_true, "{ }"); } else { return ec_dict_data_uuid(data->cbk, data->which, key); } |