Skip to content

Commit c9339b7

Browse files
committed
fix the mechanics of a couple of warnings
1 parent 1bd5585 commit c9339b7

3 files changed

Lines changed: 9 additions & 10 deletions

File tree

core/chromosome.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2124,14 +2124,12 @@ void Chromosome::ZeroMutationRunExperimentClock(void)
21242124
{
21252125
// Clocks should only get logged in the interval within which they are used; if there are leftover counts
21262126
// at this point, somebody is logging counts that are not getting used in the total. Warn once.
2127-
static bool beenHere = false;
2128-
2129-
if (!beenHere)
2127+
if (!community_.warned_experiment_run_clocks_)
21302128
{
21312129
THREAD_SAFETY_IN_ANY_PARALLEL("Chromosome::PrepareForCycle(): usage of statics");
21322130

21332131
std::cerr << "WARNING: mutation run experiment clocks were logged outside of the measurement interval!" << std::endl;
2134-
beenHere = true;
2132+
community_.warned_experiment_run_clocks_ = true;
21352133
}
21362134

21372135
x_total_gen_clocks_ = 0;

core/community.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ class Community : public EidosDictionaryUnretained
151151
bool warned_no_max_distance_ = false;
152152
bool warned_readFromVCF_mutIDs_unused_ = false;
153153
bool warned_no_ancestry_read_ = false;
154+
bool warned_experiment_run_clocks_ = false;
155+
bool warned_spatial_map_color_deprecated_ = false;
156+
bool warned_spatial_map_image_deprecated_ = false;
154157

155158
// these ivars are set around callbacks so we know what type of callback we're in, to prevent illegal operations during callbacks
156159
// to make them easier to find, such checks should always be marked with a comment: // TIMING RESTRICTION

core/subpopulation.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12253,12 +12253,11 @@ EidosValue_SP Subpopulation::ExecuteMethod_spatialMapColor(EidosGlobalStringID p
1225312253

1225412254
if (map_iter != spatial_maps_.end())
1225512255
{
12256-
static bool beenHere = false;
1225712256
SpatialMap *map = map_iter->second;
1225812257

12259-
if (!beenHere && !gEidosSuppressWarnings) {
12258+
if (!community_.warned_spatial_map_color_deprecated_ && !gEidosSuppressWarnings) {
1226012259
SLIM_ERRSTREAM << "#WARNING (Subpopulation::ExecuteMethod_spatialMapColor): spatialMapColor() has been deprecated; use the SpatialMap method mapColor() instead." << std::endl;
12261-
beenHere = true;
12260+
community_.warned_spatial_map_color_deprecated_ = true;
1226212261
}
1226312262

1226412263
// call out to SpatialMap::ExecuteMethod_mapValue() to do the work
@@ -12286,12 +12285,11 @@ EidosValue_SP Subpopulation::ExecuteMethod_spatialMapImage(EidosGlobalStringID p
1228612285

1228712286
if (map_iter != spatial_maps_.end())
1228812287
{
12289-
static bool beenHere = false;
1229012288
SpatialMap *map = map_iter->second;
1229112289

12292-
if (!beenHere && !gEidosSuppressWarnings) {
12290+
if (!community_.warned_spatial_map_image_deprecated_ && !gEidosSuppressWarnings) {
1229312291
SLIM_ERRSTREAM << "#WARNING (Subpopulation::ExecuteMethod_spatialMapImage): spatialMapImage() has been deprecated; use the SpatialMap method mapImage() instead." << std::endl;
12294-
beenHere = true;
12292+
community_.warned_spatial_map_image_deprecated_ = true;
1229512293
}
1229612294

1229712295
// call out to SpatialMap::ExecuteMethod_mapValue() to do the work

0 commit comments

Comments
 (0)