Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Commit d0cf550

Browse files
authored
Fix AppleClang warnings (#792)
Based on -Wall and AppleClang 13.1.6.
1 parent e25cb3c commit d0cf550

File tree

14 files changed

+48
-58
lines changed

14 files changed

+48
-58
lines changed

coreneuron/io/nrn2core_data_init.cpp

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
# =============================================================================
3-
# Copyright (c) 2016 - 2021 Blue Brain Project/EPFL
3+
# Copyright (c) 2016 - 2022 Blue Brain Project/EPFL
44
#
55
# See top-level LICENSE file for details.
66
# =============================================================================.
@@ -135,16 +135,14 @@ NrnCoreTransferEvents* (*nrn2core_transfer_tqueue_)(int tid);
135135
static std::unordered_map<int, int> type2movable;
136136
static void setup_type2semantics() {
137137
if (type2movable.empty()) {
138-
for (auto& mf: corenrn.get_memb_funcs()) {
139-
size_t n_memb_func = (int) (corenrn.get_memb_funcs().size());
140-
for (int type = 0; type < n_memb_func; ++type) {
141-
int* ds = corenrn.get_memb_func((size_t) type).dparam_semantics;
142-
if (ds) {
143-
int dparam_size = corenrn.get_prop_dparam_size()[type];
144-
for (int psz = 0; psz < dparam_size; ++psz) {
145-
if (ds[psz] == -4) { // netsend semantics
146-
type2movable[type] = psz;
147-
}
138+
std::size_t const n_memb_func{corenrn.get_memb_funcs().size()};
139+
for (std::size_t type = 0; type < n_memb_func; ++type) {
140+
int* ds{corenrn.get_memb_func(type).dparam_semantics};
141+
if (ds) {
142+
int dparam_size = corenrn.get_prop_dparam_size()[type];
143+
for (int psz = 0; psz < dparam_size; ++psz) {
144+
if (ds[psz] == -4) { // netsend semantics
145+
type2movable[type] = psz;
148146
}
149147
}
150148
}
@@ -154,9 +152,7 @@ static void setup_type2semantics() {
154152

155153
/** Copy each thread's queue from NEURON **/
156154
static void nrn2core_tqueue() {
157-
if (type2movable.empty()) {
158-
setup_type2semantics(); // need type2movable for SelfEvent.
159-
}
155+
setup_type2semantics(); // need type2movable for SelfEvent.
160156
for (int tid = 0; tid < nrn_nthread; ++tid) { // should be parallel
161157
NrnCoreTransferEvents* ncte = (*nrn2core_transfer_tqueue_)(tid);
162158
if (ncte) {
@@ -336,7 +332,6 @@ void watch_activate_clear() {
336332
// zero all the WATCH slots.
337333
Memb_list* ml = tml->ml;
338334
int type = tml->index;
339-
int* semantics = corenrn.get_memb_func(type).dparam_semantics;
340335
int dparam_size = corenrn.get_prop_dparam_size()[type];
341336
// which slots are WATCH
342337
int first, last;

coreneuron/io/nrn_checkpoint.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
# =============================================================================
3-
# Copyright (c) 2016 - 2021 Blue Brain Project/EPFL
3+
# Copyright (c) 2016 - 2022 Blue Brain Project/EPFL
44
#
55
# See top-level LICENSE file for details.
66
# =============================================================================.
@@ -11,7 +11,7 @@
1111
#include "coreneuron/io/phase2.hpp"
1212

1313
namespace coreneuron {
14-
class NrnThread;
14+
struct NrnThread;
1515
class FileHandler;
1616

1717
class CheckPoints {

coreneuron/io/nrn_setup.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
# =============================================================================
3-
# Copyright (c) 2016 - 2021 Blue Brain Project/EPFL
3+
# Copyright (c) 2016 - 2022 Blue Brain Project/EPFL
44
#
55
# See top-level LICENSE file for details.
66
# =============================================================================.
@@ -21,7 +21,7 @@ void read_phase1(NrnThread& nt, UserParams& userParams);
2121
void read_phase2(NrnThread& nt, UserParams& userParams);
2222
void read_phase3(NrnThread& nt, UserParams& userParams);
2323
void read_phasegap(NrnThread& nt, UserParams& userParams);
24-
static void setup_ThreadData(NrnThread& nt);
24+
void setup_ThreadData(NrnThread& nt);
2525

2626
void nrn_setup(const char* filesdat,
2727
bool is_mapping_needed,

coreneuron/io/phase2.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
# =============================================================================
3-
# Copyright (c) 2016 - 2021 Blue Brain Project/EPFL
3+
# Copyright (c) 2016 - 2022 Blue Brain Project/EPFL
44
#
55
# See top-level LICENSE file for details.
66
# =============================================================================
@@ -587,7 +587,6 @@ void Phase2::fill_before_after_lists(NrnThread& nt, const std::vector<Memb_func>
587587
for (auto tml = nt.tml; tml; tml = tml->next) {
588588
if (before_after_map[tml->index]) {
589589
int mtype = tml->index;
590-
Memb_list* ml = tml->ml;
591590
for (auto bam = before_after_map[mtype]; bam && bam->type == mtype;
592591
bam = bam->next) {
593592
auto tbl = (NrnThreadBAList*) emalloc(sizeof(NrnThreadBAList));
@@ -692,7 +691,6 @@ void Phase2::pdata_relocation(const NrnThread& nt, const std::vector<Memb_func>&
692691
size_t iptype = 0;
693692
for (int iml = 0; iml < cnt; ++iml) {
694693
for (int i = 0; i < szdp; ++i) {
695-
int s = semantics[i];
696694
if (semantics[i] == -5) { // POINTER
697695
int* pd = pdata + nrn_i_layout(iml, cnt, i, szdp, layout);
698696
int ix = *pd; // relative to elem0

coreneuron/io/phase2.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
# =============================================================================
3-
# Copyright (c) 2016 - 2021 Blue Brain Project/EPFL
3+
# Copyright (c) 2016 - 2022 Blue Brain Project/EPFL
44
#
55
# See top-level LICENSE file for details.
66
# =============================================================================
@@ -19,7 +19,7 @@ struct NrnThread;
1919
struct NrnThreadMembList;
2020
struct Memb_func;
2121
struct Memb_list;
22-
class NrnThreadChkpnt;
22+
struct NrnThreadChkpnt;
2323

2424
class Phase2 {
2525
public:

coreneuron/io/reports/nrnreport.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
# =============================================================================
3-
# Copyright (c) 2016 - 2021 Blue Brain Project/EPFL
3+
# Copyright (c) 2016 - 2022 Blue Brain Project/EPFL
44
#
55
# See top-level LICENSE file for details.
66
# =============================================================================
@@ -52,6 +52,7 @@ void nrn_flush_reports(double t) {
5252
*/
5353
void setup_report_engine(double dt_report, double mindelay) {
5454
int min_steps_to_record = static_cast<int>(std::round(mindelay / dt_report));
55+
static_cast<void>(min_steps_to_record);
5556
#ifdef ENABLE_BIN_REPORTS
5657
records_set_min_steps_to_record(min_steps_to_record);
5758
records_setup_communicator();

coreneuron/network/multisend.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
# =============================================================================
3-
# Copyright (c) 2016 - 2021 Blue Brain Project/EPFL
3+
# Copyright (c) 2016 - 2022 Blue Brain Project/EPFL
44
#
55
# See top-level LICENSE file for details.
66
# =============================================================================
@@ -15,7 +15,7 @@ extern int n_multisend_interval;
1515
extern bool use_phase2_;
1616

1717
class PreSyn;
18-
class NrnThread;
18+
struct NrnThread;
1919

2020
void nrn_multisend_send(PreSyn*, double t, NrnThread*);
2121
void nrn_multisend_receive(NrnThread*); // must be thread 0

coreneuron/network/partrans.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
# =============================================================================
3-
# Copyright (c) 2016 - 2021 Blue Brain Project/EPFL
3+
# Copyright (c) 2016 - 2022 Blue Brain Project/EPFL
44
#
55
# See top-level LICENSE file for details.
66
# =============================================================================
@@ -82,6 +82,7 @@ void nrnmpi_v_transfer() {
8282
outsrc_buf_[outsrc_indices[i]] = src_gather[src_gather_indices[i]];
8383
}
8484
}
85+
static_cast<void>(compute_gpu);
8586

8687
// transfer
8788
int n_insrc_buf = insrcdspl_[nrnmpi_numprocs];
@@ -133,6 +134,7 @@ void nrn_partrans::copy_gap_indices_to_device() {
133134
// Ensure index vectors, src_gather, and insrc_buf_ are on the gpu.
134135
if (insrcdspl_) {
135136
int n_insrc_buf = insrcdspl_[nrnmpi_numprocs];
137+
static_cast<void>(n_insrc_buf);
136138
nrn_pragma_acc(enter data create(insrc_buf_[:n_insrc_buf]))
137139
// clang-format off
138140
nrn_pragma_omp(target enter data map(alloc: insrc_buf_[:n_insrc_buf]))
@@ -151,6 +153,8 @@ void nrn_partrans::copy_gap_indices_to_device() {
151153

152154
size_t n_src_gather = ttd.src_gather.size();
153155
const double* src_gather = ttd.src_gather.data();
156+
static_cast<void>(n_src_gather);
157+
static_cast<void>(src_gather);
154158
nrn_pragma_acc(enter data create(src_gather[:n_src_gather]))
155159
nrn_pragma_omp(target enter data map(alloc: src_gather[:n_src_gather]))
156160
}

coreneuron/permute/cellorder1.cpp

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
# =============================================================================
3-
# Copyright (c) 2016 - 2021 Blue Brain Project/EPFL
3+
# Copyright (c) 2016 - 2022 Blue Brain Project/EPFL
44
#
55
# See top-level LICENSE file for details.
66
# =============================================================================
@@ -100,23 +100,6 @@ using TNI = std::pair<TNode*, int>;
100100
using HashCnt = std::map<size_t, std::pair<TNode*, int>>;
101101
using TNIVec = std::vector<TNI>;
102102

103-
static char* stree(TNode* nd) {
104-
char s[1000];
105-
106-
if (nd->treesize > 100) {
107-
return strdup("");
108-
}
109-
s[0] = '(';
110-
s[1] = '\0';
111-
for (const auto& child: nd->children) { // need sorted by child hash
112-
char* sr = stree(child);
113-
strcat(s, sr);
114-
free(sr);
115-
}
116-
strcat(s, ")");
117-
return strdup(s);
118-
}
119-
120103
/*
121104
assess the quality of the ordering. The measure is the size of a contiguous
122105
list of nodes whose parents have the same order. How many contiguous lists
@@ -209,6 +192,8 @@ static void quality(VecTNode& nodevec, size_t max = 32) {
209192
}
210193
}
211194
}
195+
static_cast<void>(nrace1);
196+
static_cast<void>(nrace2);
212197
#if CORENRN_DEBUG
213198
printf("nrace = %ld (parent in same group of %ld nodes)\n", nrace1, max);
214199
printf("nrace = %ld (parent used more than once by same group of %ld nodes)\n", nrace2, max);
@@ -375,6 +360,7 @@ int* node_order(int ncell,
375360
ntopol += 1;
376361
}
377362
}
363+
static_cast<void>(ntopol);
378364
#ifdef DEBUG
379365
printf("%d distinct tree topologies\n", ntopol);
380366
#endif

coreneuron/sim/fadvance_core.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
# =============================================================================
3-
# Copyright (c) 2016 - 2021 Blue Brain Project/EPFL
3+
# Copyright (c) 2016 - 2022 Blue Brain Project/EPFL
44
#
55
# See top-level LICENSE file for details.
66
# =============================================================================.
@@ -315,6 +315,7 @@ void nrncore2nrn_send_values(NrnThread* nth) {
315315
// https://github.com/BlueBrain/CoreNeuron/issues/611
316316
for (int i = 0; i < tr->n_trajec; ++i) {
317317
double* gather_i = tr->gather[i];
318+
static_cast<void>(gather_i);
318319
nrn_pragma_acc(update self(gather_i [0:1]) if (nth->compute_gpu)
319320
async(nth->stream_id))
320321
nrn_pragma_omp(target update from(gather_i [0:1]) if (nth->compute_gpu))

0 commit comments

Comments
 (0)