diff --git a/src/build_postorder.h b/src/build_postorder.h index d4e8bc651..d36ced70a 100644 --- a/src/build_postorder.h +++ b/src/build_postorder.h @@ -132,7 +132,7 @@ void random_tree(int *parent_of, int *left, int *right, const int *n_tip) { extern SEXP RANDOM_TREE(SEXP ntip) { const int n_tip = INTEGER(ntip)[0]; if (n_tip < 2) { - Rf_error("n_tip must be at least two"); + (Rf_error)("n_tip must be at least two"); } SEXP RESULT = PROTECT(allocVector(VECSXP, 3)), PARENT_OF = PROTECT(allocVector(INTSXP, n_tip + n_tip - 1)), @@ -155,7 +155,7 @@ extern SEXP RANDOM_TREE(SEXP ntip) { extern SEXP RANDOM_TREE_SCORE(SEXP ntip, SEXP MorphyHandl) { const int n_tip = INTEGER(ntip)[0]; if (n_tip < 2) { - Rf_error("n_tip must be at least two"); + (Rf_error)("n_tip must be at least two"); } Morphy handl = R_ExternalPtrAddr(MorphyHandl); SEXP RESULT = PROTECT(allocVector(INTSXP, 1)); diff --git a/src/rearrange.cpp b/src/rearrange.cpp index 186521e9d..57020e8ed 100644 --- a/src/rearrange.cpp +++ b/src/rearrange.cpp @@ -337,13 +337,13 @@ List all_spr (const IntegerMatrix edge, // So we test for these exceptions in R. // # nocov begin if (n_edge < 5) { - Rf_error("No SPR rearrangements possible on a tree with < 5 edges"); + Rcpp::stop("No SPR rearrangements possible on a tree with < 5 edges"); } if (edge(0, 0) != root_node) { - Rf_error("edge[1,] must connect root to leaf. Try Preorder(root(tree))."); + Rcpp::stop("edge[1,] must connect root to leaf. Try Preorder(root(tree))."); } if (edge(1, 0) != root_node) { - Rf_error("edge[2,] must connect root to leaf. Try Preorder(root(tree))."); + Rcpp::stop("edge[2,] must connect root to leaf. Try Preorder(root(tree))."); } // # nocov end