diff --git a/c/CHANGELOG.rst b/c/CHANGELOG.rst index fa7b4da575..f8020afb87 100644 --- a/c/CHANGELOG.rst +++ b/c/CHANGELOG.rst @@ -12,6 +12,8 @@ - ``num_tracked_samples`` and ``num_samples`` in ``tsk_tree_t`` are now typed as ``tsk_size_t`` (:user:`benjeffery`, :issue:`1723`, :pr:`1727`) +- The previously deprecated option ``TSK_SAMPLE_COUNTS`` has been removed. (:user:`benjeffery`, :issue:`1744`, :pr:`1761`). + **Features** diff --git a/c/tests/test_core.c b/c/tests/test_core.c index f7f0a7f49d..a5ee35cec8 100644 --- a/c/tests/test_core.c +++ b/c/tests/test_core.c @@ -386,21 +386,6 @@ test_debug_stream(void) fclose(f); } -static void -test_warn_stream(void) -{ - FILE *f = fopen(_tmp_file_name, "w"); - CU_ASSERT_FATAL(tsk_get_warn_stream() == stderr); - CU_ASSERT_FATAL(tsk_get_warn_stream() == stderr); - - tsk_set_warn_stream(f); - CU_ASSERT_FATAL(tsk_get_warn_stream() == f); - tsk_set_warn_stream(stderr); - CU_ASSERT_FATAL(tsk_get_warn_stream() == stderr); - - fclose(f); -} - static int validate_avl_node(tsk_avl_node_int_t *node) { @@ -552,7 +537,6 @@ main(int argc, char **argv) { "test_malloc_zero", test_malloc_zero }, { "test_malloc_overflow", test_malloc_overflow }, { "test_debug_stream", test_debug_stream }, - { "test_warn_stream", test_warn_stream }, { "test_avl_empty", test_avl_empty }, { "test_avl_sequential", test_avl_sequential }, { "test_avl_interleaved", test_avl_interleaved }, diff --git a/c/tests/test_trees.c b/c/tests/test_trees.c index e9cc564b5c..fda9dc7838 100644 --- a/c/tests/test_trees.c +++ b/c/tests/test_trees.c @@ -6135,30 +6135,6 @@ test_zero_edges(void) tsk_treeseq_free(&tss); } -static void -test_sample_counts_deprecated(void) -{ - tsk_treeseq_t ts; - tsk_tree_t tree; - int ret; - FILE *f = fopen(_tmp_file_name, "w"); - - tsk_treeseq_from_text(&ts, 1, single_tree_ex_nodes, single_tree_ex_edges, NULL, NULL, - NULL, NULL, NULL, 0); - CU_ASSERT_EQUAL(tsk_treeseq_get_num_samples(&ts), 4); - - tsk_set_warn_stream(f); - ret = tsk_tree_init(&tree, &ts, TSK_SAMPLE_COUNTS); - tsk_set_warn_stream(stderr); - CU_ASSERT_EQUAL_FATAL(ret, 0); - - CU_ASSERT_FATAL(ftell(f) > 0); - - fclose(f); - tsk_tree_free(&tree); - tsk_treeseq_free(&ts); -} - static void test_tree_sequence_metadata(void) { @@ -6363,7 +6339,6 @@ main(int argc, char **argv) { "test_deduplicate_sites_multichar", test_deduplicate_sites_multichar }, { "test_empty_tree_sequence", test_empty_tree_sequence }, { "test_zero_edges", test_zero_edges }, - { "test_sample_counts_deprecated", test_sample_counts_deprecated }, { "test_tree_sequence_metadata", test_tree_sequence_metadata }, { NULL, NULL }, diff --git a/c/tskit/core.c b/c/tskit/core.c index f13efb2a48..8e5549702f 100644 --- a/c/tskit/core.c +++ b/c/tskit/core.c @@ -814,13 +814,12 @@ tsk_memcmp(const void *s1, const void *s2, tsk_size_t size) return memcmp(s1, s2, (size_t) size); } -/* We can't initialise the streams to their real default values because +/* We can't initialise the stream to its real default value because * of limitations on static initialisers. To work around this, we initialise - * them to NULL and then set the value to the required standard stream + * it to NULL and then set the value to the required standard stream * when called. */ FILE *_tsk_debug_stream = NULL; -FILE *_tsk_warn_stream = NULL; void tsk_set_debug_stream(FILE *f) @@ -837,21 +836,6 @@ tsk_get_debug_stream(void) return _tsk_debug_stream; } -void -tsk_set_warn_stream(FILE *f) -{ - _tsk_warn_stream = f; -} - -FILE * -tsk_get_warn_stream(void) -{ - if (_tsk_warn_stream == NULL) { - _tsk_warn_stream = stderr; - } - return _tsk_warn_stream; -} - /* AVL Tree implementation. This is based directly on Knuth's implementation * in TAOCP. See the python/tests/test_avl_tree.py for more information, * and equivalent code annotated with the original algorithm listing. diff --git a/c/tskit/core.h b/c/tskit/core.h index d04d031e38..158ffb959c 100644 --- a/c/tskit/core.h +++ b/c/tskit/core.h @@ -512,8 +512,6 @@ int tsk_memcmp(const void *s1, const void *s2, tsk_size_t size); /* Developer debug utilities. These are **not** threadsafe */ void tsk_set_debug_stream(FILE *f); FILE *tsk_get_debug_stream(void); -void tsk_set_warn_stream(FILE *f); -FILE *tsk_get_warn_stream(void); #ifdef __cplusplus } diff --git a/c/tskit/trees.c b/c/tskit/trees.c index 483fb8058c..5b199e1381 100644 --- a/c/tskit/trees.c +++ b/c/tskit/trees.c @@ -3220,12 +3220,6 @@ tsk_tree_init(tsk_tree_t *self, const tsk_treeseq_t *tree_sequence, tsk_flags_t ret = TSK_ERR_BAD_PARAM_VALUE; goto out; } - if (options & TSK_SAMPLE_COUNTS) { - fprintf(tsk_get_warn_stream(), - "TSK_SAMPLE_COUNTS is no longer supported. " - "Sample counts are tracked by default since 0.99.3, " - "Please use TSK_NO_SAMPLE_COUNTS to turn off sample counts."); - } num_nodes = tree_sequence->tables->nodes.num_rows; num_samples = tree_sequence->num_samples; self->num_nodes = num_nodes; diff --git a/c/tskit/trees.h b/c/tskit/trees.h index 7f95504bad..4dfd230e25 100644 --- a/c/tskit/trees.h +++ b/c/tskit/trees.h @@ -36,13 +36,7 @@ extern "C" { #include -/* The TSK_SAMPLE_COUNTS was removed in version 0.99.3, where - * the default is now to always count samples except when - * TSK_NO_SAMPLE_COUNTS is specified. This macro can be undefined - * at some point in the future and the option reused for something - * else. */ // clang-format off -#define TSK_SAMPLE_COUNTS (1 << 0) #define TSK_SAMPLE_LISTS (1 << 1) #define TSK_NO_SAMPLE_COUNTS (1 << 2)