Skip to content

Commit 58c22d2

Browse files
committed
Condition undoing of Rmath prefixes on R < 4.5.0
1 parent d5cfd78 commit 58c22d2

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: Rcpp
22
Title: Seamless R and C++ Integration
3-
Version: 1.0.13.6
4-
Date: 2024-11-25
3+
Version: 1.0.13.6.1
4+
Date: 2024-12-21
55
Authors@R: c(person("Dirk", "Eddelbuettel", role = c("aut", "cre"), email = "[email protected]",
66
comment = c(ORCID = "0000-0001-6419-907X")),
77
person("Romain", "Francois", role = "aut",

inst/NEWS.Rd

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@
99
\itemize{
1010
\item Support for user-defined databases has been removed (Kevin in
1111
\ghpr{1314} fixing \ghit{1313})
12-
\item The \code{SET_TYPEOF} function and macro is no longer used (Kevin in
13-
\ghpr{1315} fixing \ghit{1312})
12+
\item The \code{SET_TYPEOF} function and macro is no longer used (Kevin
13+
in \ghpr{1315} fixing \ghit{1312})
1414
\item An errorneous cast to \code{int} affecting large return object
1515
has been removed (Dirk in \ghpr{1335} fixing \ghpr{1334})
1616
\item Compilation on DragonFlyBSD is now supported (Gábor Csárdi in
1717
\ghpr{1338})
1818
\item Use read-only \code{VECTOR_PTR} and \code{STRING_PTR} only with
1919
with R 4.5.0 or later (Kevin in \ghpr{1342} fixing \ghit{1341})
20+
\item As R 4.5.0 or later prefix math functions, make undefine in Rcpp
21+
Sugar version dependent (Dirk in \ghpr{1352} fixing \ghit{1351})
2022
}
2123
\item Changes in Rcpp Attributes:
2224
\itemize{
@@ -30,6 +32,8 @@
3032
\item Authors@R is now used in DESCRIPTION as mandated by CRAN, the
3133
\code{Rcpp.package.skeleton()} function also creates it (Dirk in
3234
\ghpr{1325} and \ghpr{1327})
35+
\item A single datetime format test has been adjusted to match a change
36+
in R-devel (Dirk in \ghpr{1348} fixing \ghit{1347})
3337
}
3438
\item Changes in Rcpp Documentation:
3539
\itemize{

inst/include/Rcpp/sugar/undoRmath.h

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
2-
//
31
// undoRmath.h: Rcpp R/C++ interface class library -- undo the macros set by Rmath.h
42
//
5-
// Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois
3+
// Copyright (C) 2010 - 2024 Dirk Eddelbuettel and Romain Francois
64
//
75
// This file is part of Rcpp.
86
//
@@ -22,7 +20,17 @@
2220
#ifndef RCPP_SUGAR_UNDORMATH_H
2321
#define RCPP_SUGAR_UNDORMATH_H
2422

25-
// undo some of the mess of Rmath
23+
// Reverse-depends checks found rare cases where R_Version would not evaluate
24+
// So here we, if needed, we first undefine ...
25+
#ifdef R_Version
26+
#undef R_Version
27+
#endif
28+
// ... and then repeat the definition from Rversion.h
29+
#define R_Version(v,p,s) (((v) * 65536) + ((p) * 256) + (s))
30+
31+
// Undo some of the definitions in Rmath -- but only prior to R 4.5.0
32+
#if R_VERSION < R_Version(4,5,0)
33+
2634
#undef sign
2735
#undef trunc
2836
#undef rround
@@ -163,5 +171,6 @@
163171
#undef tetragamma
164172
#undef trigamma
165173

174+
#endif
166175

167176
#endif

0 commit comments

Comments
 (0)