@@ -29,7 +29,7 @@ namespace TreeDist {
2929
3030 void check_ntip (const double n) {
3131 if (n > static_cast <double >(std::numeric_limits<int16>::max ())) {
32- Rf_error (" This many tips are not (yet) supported." ); // not Rcpp::stop: ARM safety
32+ Rcpp::stop (" This many tips are not (yet) supported." );
3333 }
3434 }
3535
@@ -602,14 +602,11 @@ inline List shared_phylo (const RawMatrix &x, const RawMatrix &y,
602602 _[" matching" ] = final_matching);
603603}
604604
605- // Input validation: Rf_error (longjmp) instead of Rcpp::stop (C++ exception)
606- // for ARM compatibility. R callers should validate before reaching C++.
607-
608605// [[Rcpp::export]]
609606List cpp_robinson_foulds_distance (const RawMatrix &x, const RawMatrix &y,
610607 const IntegerVector &nTip) {
611608 if (x.cols () != y.cols ()) {
612- Rf_error (" Input splits must address same number of tips." );
609+ Rcpp::stop (" Input splits must address same number of tips." );
613610 }
614611 return robinson_foulds_distance (x, y, static_cast <int32>(nTip[0 ]));
615612}
@@ -618,7 +615,7 @@ List cpp_robinson_foulds_distance(const RawMatrix &x, const RawMatrix &y,
618615List cpp_robinson_foulds_info (const RawMatrix &x, const RawMatrix &y,
619616 const IntegerVector &nTip) {
620617 if (x.cols () != y.cols ()) {
621- Rf_error (" Input splits must address same number of tips." );
618+ Rcpp::stop (" Input splits must address same number of tips." );
622619 }
623620 const int32 n_tip = static_cast <int32>(nTip[0 ]);
624621 TreeDist::check_ntip (n_tip);
@@ -629,7 +626,7 @@ List cpp_robinson_foulds_info(const RawMatrix &x, const RawMatrix &y,
629626List cpp_matching_split_distance (const RawMatrix &x, const RawMatrix &y,
630627 const IntegerVector &nTip) {
631628 if (x.cols () != y.cols ()) {
632- Rf_error (" Input splits must address same number of tips." );
629+ Rcpp::stop (" Input splits must address same number of tips." );
633630 }
634631 const int32 n_tip = static_cast <int32>(nTip[0 ]);
635632 TreeDist::check_ntip (n_tip);
@@ -641,7 +638,7 @@ List cpp_jaccard_similarity(const RawMatrix &x, const RawMatrix &y,
641638 const IntegerVector &nTip, const NumericVector &k,
642639 const LogicalVector &allowConflict) {
643640 if (x.cols () != y.cols ()) {
644- Rf_error (" Input splits must address same number of tips." );
641+ Rcpp::stop (" Input splits must address same number of tips." );
645642 }
646643 const int32 n_tip = static_cast <int32>(nTip[0 ]);
647644 TreeDist::check_ntip (n_tip);
@@ -652,7 +649,7 @@ List cpp_jaccard_similarity(const RawMatrix &x, const RawMatrix &y,
652649List cpp_msi_distance (const RawMatrix &x, const RawMatrix &y,
653650 const IntegerVector &nTip) {
654651 if (x.cols () != y.cols ()) {
655- Rf_error (" Input splits must address same number of tips." );
652+ Rcpp::stop (" Input splits must address same number of tips." );
656653 }
657654 const int32 n_tip = static_cast <int32>(nTip[0 ]);
658655 TreeDist::check_ntip (n_tip);
@@ -663,7 +660,7 @@ List cpp_msi_distance(const RawMatrix &x, const RawMatrix &y,
663660List cpp_mutual_clustering (const RawMatrix &x, const RawMatrix &y,
664661 const IntegerVector &nTip) {
665662 if (x.cols () != y.cols ()) {
666- Rf_error (" Input splits must address same number of tips." );
663+ Rcpp::stop (" Input splits must address same number of tips." );
667664 }
668665 const int32 n_tip = static_cast <int32>(nTip[0 ]);
669666 TreeDist::check_ntip (n_tip);
@@ -674,7 +671,7 @@ List cpp_mutual_clustering(const RawMatrix &x, const RawMatrix &y,
674671List cpp_shared_phylo (const RawMatrix &x, const RawMatrix &y,
675672 const IntegerVector &nTip) {
676673 if (x.cols () != y.cols ()) {
677- Rf_error (" Input splits must address same number of tips." );
674+ Rcpp::stop (" Input splits must address same number of tips." );
678675 }
679676 const int32 n_tip = static_cast <int32>(nTip[0 ]);
680677 TreeDist::check_ntip (n_tip);
0 commit comments