Skip to content

Commit

Permalink
Fix compilation warnings for -O3 -Wall -Werror
Browse files Browse the repository at this point in the history
  • Loading branch information
narategithub authored and tom95858 committed Nov 25, 2019
1 parent fec73e1 commit e7530cc
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 11 deletions.
2 changes: 1 addition & 1 deletion ldms/src/core/ldms_xprt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1763,7 +1763,7 @@ static void __handle_update_data(ldms_t x, struct ldms_context *ctxt,
struct ldms_set *set = s->set;
int n;
struct ldms_data_hdr *data, *prev_data;
int flags, upd_curr_idx;
int flags = 0, upd_curr_idx;

assert(ctxt->update.cb);
rc = LDMS_UPD_ERROR(ev->status);
Expand Down
1 change: 1 addition & 0 deletions ldms/src/ldmsd/ldmsctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1954,6 +1954,7 @@ int main(int argc, char *argv[])
}

do {
cnt = 0;
#ifdef HAVE_LIBREADLINE
#ifndef HAVE_READLINE_HISTORY
if (linebuf != NULL) {
Expand Down
6 changes: 3 additions & 3 deletions ldms/src/ldmsd/ldmsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ static int start_task(ldmsd_task_t task)
static void task_cb_fn(ovis_event_t ev)
{
ldmsd_task_t task = ev->param.ctxt;
enum ldmsd_task_state next_state;
enum ldmsd_task_state next_state = 0;

pthread_mutex_lock(&task->lock);
if (task->os) {
Expand Down Expand Up @@ -1503,7 +1503,7 @@ int main(int argc, char *argv[])
char *lval = NULL;
char *rval = NULL;
char *plug_name = NULL;
const char *port;
const char *port = NULL;
int list_plugins = 0;
int ret;
int sample_interval = 2000000;
Expand Down Expand Up @@ -1958,7 +1958,7 @@ int main(int argc, char *argv[])
ldms = listen_on_ldms_xprt(xprt_str, port_str);
free(dup_arg);
if (!ldms) {
cleanup(ret, "Error setting up ldms transport");
cleanup(errno, "Error setting up ldms transport");
}
break;
}
Expand Down
4 changes: 3 additions & 1 deletion ldms/src/ldmsd/ldmsd_request_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -589,8 +589,10 @@ struct ldmsd_req_array *ldmsd_parse_config_str(const char *cfg, uint32_t msg_no,
ctxt.msglog = msglog;
ctxt.av = av;
ctxt.request = calloc(1, ctxt.request_sz);
if (!ctxt.request)
if (!ctxt.request) {
rc = ENOMEM;
goto err;
}

ctxt.request->marker = LDMSD_RECORD_MARKER;
ctxt.request->type = LDMSD_REQ_TYPE_CONFIG_CMD;
Expand Down
4 changes: 2 additions & 2 deletions ldms/src/ldmsd/ldmsd_updtr.c
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ void __prdcr_set_update_sched(ldmsd_prdcr_set_t prd_set,
int ldmsd_updtr_tasks_update(ldmsd_updtr_t updtr, ldmsd_prdcr_set_t prd_set)
{
ldmsd_updtr_task_t task;
int rc;
int rc = 0;

if (!updtr->is_auto_task) {
/*
Expand Down Expand Up @@ -920,7 +920,7 @@ ldmsd_updtr_new_with_auth(const char *name, char *interval_str, char *offset_str
uid_t uid, gid_t gid, int perm)
{
struct ldmsd_updtr *updtr;
long interval_us, offset_us;
long interval_us = UPDTR_TREE_MGMT_TASK_INTRVL, offset_us = LDMSD_UPDT_HINT_OFFSET_NONE;
updtr = (struct ldmsd_updtr *)
ldmsd_cfgobj_new_with_auth(name, LDMSD_CFGOBJ_UPDTR,
sizeof *updtr, ldmsd_updtr___del,
Expand Down
9 changes: 6 additions & 3 deletions ldms/src/sampler/examples/array_example/all_example.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ static int create_metric_set(base_data_t base)

schema = base_schema_new(base);
if (!schema){
rc = errno;
msglog(LDMSD_LERROR,
"%s: The schema '%s' could not be created, errno=%d.\n",
__FILE__, base->schema_name, errno);
Expand Down Expand Up @@ -158,17 +159,19 @@ static int create_metric_set(base_data_t base)
}
static int config(struct ldmsd_plugin *self, struct attr_value_list *kwl, struct attr_value_list *avl)
{

int rc;
if (set) {
msglog(LDMSD_LERROR, "all_example: Set already created.\n");
return EINVAL;
}

base = base_config(avl, SAMP, SAMP, msglog);
if (!base)
if (!base) {
rc = errno;
goto err;
}

int rc = create_metric_set(base);
rc = create_metric_set(base);
if (rc) {
msglog(LDMSD_LERROR, SAMP ": failed to create a metric set.\n");
goto err;
Expand Down
4 changes: 3 additions & 1 deletion ldms/src/sampler/examples/synthetic/synthetic.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,10 @@ static int config(struct ldmsd_plugin *self, struct attr_value_list *kwl, struct
compid = strtoull(value, NULL, 0);

base = base_config(avl, SAMP, SAMP, msglog);
if (!base)
if (!base) {
rc = errno;
goto err;
}

rc = create_metric_set(base);
if (rc) {
Expand Down
6 changes: 6 additions & 0 deletions ldms/src/sampler/papi/papi_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ int papi_process_config_data(job_data_t job, char *buf, size_t buflen, ldmsd_msg
if (!p) {
msglog(LDMSD_LERROR,
"papi_sampler: Parser could not be created.\n");
rc = ENOMEM;
goto out;
}

Expand All @@ -83,24 +84,28 @@ int papi_process_config_data(job_data_t job, char *buf, size_t buflen, ldmsd_msg
msglog(LDMSD_LERROR,
"papi_sampler: The configuration file is missing the "
"'schema' attribute.\n");
rc = ENOENT;
goto out;
}
events_attr = json_attr_find(e, "events");
if (!events_attr) {
msglog(LDMSD_LERROR,
"papi_sampler: The configuration file is missing the "
"'events' attribute.\n");
rc = ENOENT;
goto out;
}
if (JSON_STRING_VALUE != json_entity_type(json_attr_value(schema_attr))) {
msglog(LDMSD_LERROR,
"papi_sampler: The 'schema' attribute must be a string.\n");
rc = EINVAL;
goto out;
}
events_list = json_attr_value(events_attr);
if (JSON_LIST_VALUE != json_entity_type(events_list)) {
msglog(LDMSD_LERROR,
"papi_sampler: The 'events' attribute must be a list.\n");
rc = EINVAL;
goto out;
}

Expand All @@ -109,6 +114,7 @@ int papi_process_config_data(job_data_t job, char *buf, size_t buflen, ldmsd_msg
if (!job->schema_name) {
msglog(LDMSD_LERROR,
"papi_sampler: Error duplicating schema name string.\n");
rc = ENOMEM;
goto out;
}

Expand Down
1 change: 1 addition & 0 deletions ldms/src/sampler/procdiskstats.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ static int create_metric_set(base_data_t base, struct attr_value_list *avl){

schema = base_schema_new(base);
if (!schema) {
rc = errno;
msglog(LDMSD_LERROR,
SAMP ": The schema '%s' could not be created, errno=%d.\n",
base->schema_name, errno);
Expand Down
1 change: 1 addition & 0 deletions ldms/src/sampler/spank/slurm_notifier.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ static void event_cb(ldms_t x, ldms_xprt_event_t e, void *cb_arg)
event = "error";
break;
default:
event = "INVALID_EVENT";
DEBUG2("Received invalid event type\n");
}
pthread_mutex_unlock(&client->wait_lock);
Expand Down
4 changes: 4 additions & 0 deletions lib/src/ovis_event/ovis_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,8 @@ int ovis_event_term_check(ovis_scheduler_t m)
case OVIS_EVENT_MANAGER_TERM:
rc = EINTR;
break;
default:
rc = EINVAL;
}
pthread_mutex_unlock(&m->mutex);
return rc;
Expand Down Expand Up @@ -720,6 +722,8 @@ int ovis_scheduler_term(ovis_scheduler_t m)
case OVIS_EVENT_MANAGER_TERM:
rc = EINVAL;
break;
default:
rc = EINVAL;
}
pthread_mutex_unlock(&m->mutex);
return rc;
Expand Down

0 comments on commit e7530cc

Please sign in to comment.