Skip to content

Commit

Permalink
Reduce warnings parallel (#3153)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Cornu authored Oct 30, 2024
1 parent 0b8c2af commit d26ea08
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 20 deletions.
4 changes: 1 addition & 3 deletions src/parallel/bbs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,6 @@ void BBSImpl::execute(int id) { // assumes a "_todo" message in receive buffer
++etaskcnt;
double st, et;
int userid;
char* s;
int i;
int save_id = working_id_;
int save_n = n_;
working_id_ = id;
Expand Down Expand Up @@ -359,7 +357,7 @@ bool BBSImpl::working(int& id, double& x, int& userid) {
}
if (id != 0) {
userid = upkint();
int wid = upkint();
/* int wid = */ upkint();
rtype = upkint();
if (rtype == 0) {
x = upkdouble();
Expand Down
4 changes: 0 additions & 4 deletions src/parallel/bbsclimpi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ bool BBSClient::look(const char* key) {
}

void BBSClient::take(const char* key) { // blocking
int bufid;
get(key, TAKE);
upkbegin();
}
Expand Down Expand Up @@ -300,9 +299,6 @@ void BBSClient::done() {
}

void BBSClient::start() {
char* client = 0;
int tid;
int n;
if (started_) {
return;
}
Expand Down
6 changes: 1 addition & 5 deletions src/parallel/bbslsrv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ int MessageValue::upkint(int* i) {
}

int MessageValue::upkdouble(double* d) {
const auto& mi = args_.front();
if (const auto* val = std::get_if<double>(args_.data() + index_)) {
*d = *val;
++index_;
Expand All @@ -136,7 +135,6 @@ int MessageValue::upkdouble(double* d) {
}

int MessageValue::upkvec(int n, double* d) {
const auto& mi = args_.front();
if (const auto* val = std::get_if<std::vector<double>>(args_.data() + index_)) {
for (std::size_t i = 0; i < n; ++i) {
d[i] = val->at(i);
Expand All @@ -148,7 +146,6 @@ int MessageValue::upkvec(int n, double* d) {
}

int MessageValue::upkstr(char* s) {
const auto& mi = args_.front();
if (const auto* val = std::get_if<std::string>(args_.data() + index_)) {
for (std::size_t i = 0; i < val->size(); ++i) {
s[i] = val->at(i);
Expand All @@ -161,7 +158,6 @@ int MessageValue::upkstr(char* s) {
}

int MessageValue::upkpickle(std::vector<char>& s) {
const auto& mi = args_.front();
if (const auto* val = std::get_if<std::vector<char>>(args_.data() + index_)) {
s = *val;
++index_;
Expand Down Expand Up @@ -225,7 +221,7 @@ bool BBSLocalServer::look(const char* key, MessageValue** val) {
}

void BBSLocalServer::post(const char* key, MessageValue* val) {
MessageList::iterator m = messages_->emplace(newstr(key), val);
messages_->emplace(newstr(key), val);
Resource::ref(val);
#if debug
printf("srvr_post |%s|\n", key);
Expand Down
2 changes: 1 addition & 1 deletion src/parallel/bbssrv2mpi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ void BBSDirectServer::post(const char* key, bbsmpibuf* send) {
if (take_pending(key, &cid)) {
nrnmpi_bbssend(cid, TAKE, send);
} else {
MessageList::iterator m = messages_->emplace(newstr(key), send);
messages_->emplace(newstr(key), send);
nrnmpi_ref(send);
}
}
Expand Down
12 changes: 5 additions & 7 deletions src/parallel/ocbbs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,6 @@ static double multisplit(void* v) {
Section* sec = NULL;
int sid = -1;
int backbone_style = 2;
int reducedtree_host = 0;
if (ifarg(1)) {
nrn_seg_or_x_arg(1, &sec, &x);
sid = (int) chkarg(2, 0, (double) (0x7fffffff));
Expand Down Expand Up @@ -1424,11 +1423,10 @@ void BBSImpl::return_args(int id) {
// perhaps it would be better to do this directly
// and avoid the meaningless create and delete.
// but then they all would have to know this format
int i;
char* s;
// printf("BBSImpl::return_args(%d):\n", id);
i = upkint(); // userid
int wid = upkint();
upkint(); // userid
/* int wid = */ upkint();
int style = upkint();
// printf("message userid=%d style=%d\n", i, style);
switch (style) {
Expand All @@ -1439,19 +1437,19 @@ void BBSImpl::return_args(int id) {
break;
case 2: // obj first
s = upkstr(); // template name
i = upkint(); // instance index
upkint(); // instance index

Check warning on line 1440 in src/parallel/ocbbs.cpp

View check run for this annotation

Codecov / codecov/patch

src/parallel/ocbbs.cpp#L1440

Added line #L1440 was not covered by tests
// printf("object %s[%d]\n", s, i);
delete[] s;
// fall through
case 1:
s = upkstr(); // fname
i = upkint(); // arg manifest
upkint(); // arg manifest

Check warning on line 1446 in src/parallel/ocbbs.cpp

View check run for this annotation

Codecov / codecov/patch

src/parallel/ocbbs.cpp#L1446

Added line #L1446 was not covered by tests
// printf("fname=|%s| manifest=%o\n", s, i);
delete[] s;
break;
case 3:
auto pickle = upkpickle(); // pickled callable
i = upkint(); // arg manifest
upkint(); // arg manifest
break;
}
// now only args are left and ready to unpack.
Expand Down

0 comments on commit d26ea08

Please sign in to comment.