[education/rkward] /: Fix compilation with R 4.2.0

Thomas Friedrichsmeier null at kde.org
Sat Apr 2 10:18:46 BST 2022


Git commit fc6c45fb6517a6dc1696b329b029b57646c96fc8 by Thomas Friedrichsmeier.
Committed on 02/04/2022 at 09:18.
Pushed by tfry into branch 'master'.

Fix compilation with R 4.2.0

M  +1    -0    ChangeLog
M  +3    -2    rkward/rbackend/rkstructuregetter.cpp
M  +1    -1    rkward/rbackend/rkwarddevice/rkgraphicsdevice_stubs.cpp

https://invent.kde.org/education/rkward/commit/fc6c45fb6517a6dc1696b329b029b57646c96fc8

diff --git a/ChangeLog b/ChangeLog
index b7c7dc9b..950030fa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@ TODOS for autotests:
   - Check and update the standards files
   - Use options(warn=1), in order to get warnings into the test?
 
+- Fix compilation with the upcoming R 4.2.0
 - Support for switching color themes, including basic support for dark theme
 - Fix crash in dev.capture()
 - Fix plot window not showing when created attached
diff --git a/rkward/rbackend/rkstructuregetter.cpp b/rkward/rbackend/rkstructuregetter.cpp
index e569e395..da917a38 100644
--- a/rkward/rbackend/rkstructuregetter.cpp
+++ b/rkward/rbackend/rkstructuregetter.cpp
@@ -147,9 +147,10 @@ SEXP RKStructureGetter::resolvePromise (SEXP from) {
 			RK_DEBUG (RBACKEND, DL_DEBUG, "temporarily resolving unbound promise");
 
 			PROTECT (from);
-			SET_PRSEEN(from, 1);
+			//SET_PRSEEN(from, 1);  // NOTE: SET_PRSEEN was removed from Rinternals.h in R 4.2.0. Its only use is to prevent recursion, however.
+			                        //       Not setting it from here, only means, any recursion will be detected one level later.
 			ret = Rf_eval(PRCODE(from), PRENV(from));
-			SET_PRSEEN(from, 0);
+			//SET_PRSEEN(from, 0);
 			if (keep_evalled_promises) {
 				SET_PRVALUE(from, ret);
 				SET_PRENV(from, R_NilValue);
diff --git a/rkward/rbackend/rkwarddevice/rkgraphicsdevice_stubs.cpp b/rkward/rbackend/rkwarddevice/rkgraphicsdevice_stubs.cpp
index 20ceecb1..5890e2f0 100644
--- a/rkward/rbackend/rkwarddevice/rkgraphicsdevice_stubs.cpp
+++ b/rkward/rbackend/rkwarddevice/rkgraphicsdevice_stubs.cpp
@@ -838,7 +838,7 @@ SEXP RKD_SetMask (SEXP mask, SEXP ref, pDevDesc dev) {
 		RKGraphicsDataStreamWriteGuard wguard;
 		WRITE_HEADER(RKDEndRecordMask, dev);
 #if R_VERSION >= R_Version(4,2,0)
-		RKD_OUT_STREAM << (qint8) R_GE_maskType(mask) == R_GE_luminanceMask ? 1 : 0;
+		RKD_OUT_STREAM << (qint8) (R_GE_maskType(mask) == R_GE_luminanceMask ? 1 : 0);
 #else
 		RKD_OUT_STREAM << (qint8) 0;
 #endif


More information about the rkward-tracker mailing list