Skip to content

Commit

Permalink
Allow some inline functions to be hidden frome use in packages.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.r-project.org/R/trunk@86628 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information
luke committed May 26, 2024
1 parent 07cf822 commit ff8acde
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/include/Rinlinedfuns.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#ifdef COMPILING_R
/* defined only in inlined.c: this emits standalone code there */
# define INLINE_FUN
# define HIDDEN attribute_hidden
#else
/* This section is normally only used for versions of gcc which do not
support C99 semantics. __GNUC_STDC_INLINE__ is defined if
Expand All @@ -58,6 +59,7 @@
# else
# define INLINE_FUN extern R_INLINE
# endif
# define HIDDEN
#endif /* ifdef COMPILING_R */

#if C99_INLINE_SEMANTICS
Expand Down Expand Up @@ -322,11 +324,11 @@ INLINE_FUN int *LOGICAL0(SEXP x) {
CHECK_STDVEC_LGL(x);
return (int *) STDVEC_DATAPTR(x);
}
INLINE_FUN Rboolean SCALAR_LVAL(SEXP x) {
HIDDEN INLINE_FUN Rboolean SCALAR_LVAL(SEXP x) {
CHECK_SCALAR_LGL(x);
return LOGICAL0(x)[0];
}
INLINE_FUN void SET_SCALAR_LVAL(SEXP x, Rboolean v) {
HIDDEN INLINE_FUN void SET_SCALAR_LVAL(SEXP x, Rboolean v) {
CHECK_SCALAR_LGL(x);
LOGICAL0(x)[0] = v;
}
Expand All @@ -335,11 +337,11 @@ INLINE_FUN int *INTEGER0(SEXP x) {
CHECK_STDVEC_INT(x);
return (int *) STDVEC_DATAPTR(x);
}
INLINE_FUN int SCALAR_IVAL(SEXP x) {
HIDDEN INLINE_FUN int SCALAR_IVAL(SEXP x) {
CHECK_SCALAR_INT(x);
return INTEGER0(x)[0];
}
INLINE_FUN void SET_SCALAR_IVAL(SEXP x, int v) {
HIDDEN INLINE_FUN void SET_SCALAR_IVAL(SEXP x, int v) {
CHECK_SCALAR_INT(x);
INTEGER0(x)[0] = v;
}
Expand All @@ -348,11 +350,11 @@ INLINE_FUN double *REAL0(SEXP x) {
CHECK_STDVEC_REAL(x);
return (double *) STDVEC_DATAPTR(x);
}
INLINE_FUN double SCALAR_DVAL(SEXP x) {
HIDDEN INLINE_FUN double SCALAR_DVAL(SEXP x) {
CHECK_SCALAR_REAL(x);
return REAL0(x)[0];
}
INLINE_FUN void SET_SCALAR_DVAL(SEXP x, double v) {
HIDDEN INLINE_FUN void SET_SCALAR_DVAL(SEXP x, double v) {
CHECK_SCALAR_REAL(x);
REAL0(x)[0] = v;
}
Expand All @@ -361,11 +363,11 @@ INLINE_FUN Rcomplex *COMPLEX0(SEXP x) {
CHECK_STDVEC_CPLX(x);
return (Rcomplex *) STDVEC_DATAPTR(x);
}
INLINE_FUN Rcomplex SCALAR_CVAL(SEXP x) {
HIDDEN INLINE_FUN Rcomplex SCALAR_CVAL(SEXP x) {
CHECK_SCALAR_CPLX(x);
return COMPLEX0(x)[0];
}
INLINE_FUN void SET_SCALAR_CVAL(SEXP x, Rcomplex v) {
HIDDEN INLINE_FUN void SET_SCALAR_CVAL(SEXP x, Rcomplex v) {
CHECK_SCALAR_CPLX(x);
COMPLEX0(x)[0] = v;
}
Expand All @@ -374,11 +376,11 @@ INLINE_FUN Rbyte *RAW0(SEXP x) {
CHECK_STDVEC_RAW(x);
return (Rbyte *) STDVEC_DATAPTR(x);
}
INLINE_FUN Rbyte SCALAR_BVAL(SEXP x) {
HIDDEN INLINE_FUN Rbyte SCALAR_BVAL(SEXP x) {
CHECK_SCALAR_RAW(x);
return RAW0(x)[0];
}
INLINE_FUN void SET_SCALAR_BVAL(SEXP x, Rbyte v) {
HIDDEN INLINE_FUN void SET_SCALAR_BVAL(SEXP x, Rbyte v) {
CHECK_SCALAR_RAW(x);
RAW0(x)[0] = v;
}
Expand Down Expand Up @@ -754,7 +756,7 @@ INLINE_FUN SEXP lang6(SEXP s, SEXP t, SEXP u, SEXP v, SEXP w, SEXP x)

/* Check to see if the arrays "x" and "y" have the identical extents */

INLINE_FUN Rboolean conformable(SEXP x, SEXP y)
HIDDEN INLINE_FUN Rboolean conformable(SEXP x, SEXP y)
{
int i, n;
PROTECT(x = getAttrib(x, R_DimSymbol));
Expand Down Expand Up @@ -797,7 +799,7 @@ INLINE_FUN Rboolean isValidStringF(SEXP x)
return isValidString(x) && CHAR(STRING_ELT(x, 0))[0];
}

INLINE_FUN Rboolean isUserBinop(SEXP s)
HIDDEN INLINE_FUN Rboolean isUserBinop(SEXP s)
{
if (TYPEOF(s) == SYMSXP) {
const char *str = CHAR(PRINTNAME(s));
Expand Down Expand Up @@ -1101,7 +1103,7 @@ INLINE_FUN SEXP mkString(const char *s)
}

/* index of a given C string in (translated) R string vector */
INLINE_FUN int
HIDDEN INLINE_FUN int
stringPositionTr(SEXP string, const char *translatedElement) {

int slen = LENGTH(string);
Expand All @@ -1119,7 +1121,7 @@ stringPositionTr(SEXP string, const char *translatedElement) {
}

/* duplicate RHS value of complex assignment if necessary to prevent cycles */
INLINE_FUN SEXP R_FixupRHS(SEXP x, SEXP y)
HIDDEN INLINE_FUN SEXP R_FixupRHS(SEXP x, SEXP y)
{
if( y != R_NilValue && MAYBE_REFERENCED(y) ) {
if (R_cycle_detected(x, y)) {
Expand Down

0 comments on commit ff8acde

Please sign in to comment.