This is an automated email from the ASF dual-hosted git repository.

jonkeane pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 0b9f06c78c MINOR: [R] switch on `R_VERSION` (#43504)
0b9f06c78c is described below

commit 0b9f06c78ca549ee3a3aed91b58de740ed90f12e
Author: Jonathan Keane <[email protected]>
AuthorDate: Thu Aug 1 16:55:02 2024 -0500

    MINOR: [R] switch on `R_VERSION` (#43504)
    
    A follow on to #43243 `#ifdef function declaration` does not work, instead 
we must use the `#if (R_VERSION >= R_Version(4, 2, 0))` pattern to only include 
code for specific versions.
    
    Lead-authored-by: Jonathan Keane <[email protected]>
    Co-authored-by: Neal Richardson <[email protected]>
    Signed-off-by: Jonathan Keane <[email protected]>
---
 r/src/arrow_cpp11.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/r/src/arrow_cpp11.h b/r/src/arrow_cpp11.h
index 073b577d63..c4483ce531 100644
--- a/r/src/arrow_cpp11.h
+++ b/r/src/arrow_cpp11.h
@@ -389,7 +389,7 @@ SEXP to_r6(const std::shared_ptr<T>& ptr, const char* 
r6_class_name) {
 
 // R_existsVarInFrame doesn't exist before R 4.2, so we need to fall back to
 // Rf_findVarInFrame3 if it is not defined.
-#ifdef R_existsVarInFrame
+#if R_VERSION >= R_Version(4, 2, 0)
   if (!R_existsVarInFrame(arrow::r::ns::arrow, r6_class)) {
     cpp11::stop("No arrow R6 class named '%s'", r6_class_name);
   }

Reply via email to