[R-pkg-devel] libc++ and abort function usage

2025-04-04 Thread Reed A. Cartwright
I have updated my package, rbedrock [1-2], to remove a bundled
library's calls to abort() and stderr when compiled with -DNDEBUG
(which is the default). This has mostly worked; however, I have
uncovered that libc++ contains inline functions that call abort() if
exceptions are disabled.

My bundled library is a C++ library and is compiled with exceptions
turned off. I use its C-level interface in my package, so its C++ code
is mostly hidden from my package. When compiled on a platform with
libc++, libc++ introduces abort calls into the compiled package. This
is causing `R CMD check` to warn about abort() usage on those
platforms.

I am wondering what people on this list think I should do?

Should I enable exceptions in the bundled library and keep using the
C-level interface? (It doesn't throw any exceptions itself, but std
library calls might.)

If there is any other strategy that I should try, please let me know.

Thanks,
Reed

[1] https://github.com/reedacartwright/rbedrock
[2] https://cran.r-project.org/package=rbedrock
[3] 
https://github.com/llvm/llvm-project/blob/release/12.x/libcxx/include/any#L107-L116

--
Reed A. Cartwright, PhD
Associate Professor of Life Sciences
TEACh Representative - Evolution and Computational Courses
School of Life Sciences and The Biodesign Institute
Arizona State University
==
Address: The Biodesign Institute, PO Box 876401, Tempe, AZ 85287-6401 USA
Packages: The Biodesign Institute, 1001 S. McAllister Ave, Tempe, AZ
85287-6401 USA
Office: Biodesign B-220C, 1-480-965-9949
Website: http://cartwrig.ht/

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] New API in R-devel & minimum version of R

2025-04-04 Thread Michael Chirico
data.table is doing the same in a number of places, Ivan even went so far
as to pin down a specific SVN commit for those as well:

#if R_VERSION < R_Version(4, 5, 0) || R_SVN_REVISION < 86702
#  define isDataFrame(x) isFrame(x) // #6180
#endif

https://github.com/Rdatatable/data.table/blob/0909048017d35f8b8a910c74549650f5de5a74a9/src/data.table.h#L21-L23

Sneaking onto my soapbox to complain that it really seems incorrect that R
CMD check started complaining about these issues before the API-compliant
functions were included in an R release. I was really surprised to see
these functions were not included in the most recent past release, for
example.

Anyway, 4.5.0 is due for release in a few weeks so this will become moot
momentarily.

On Wed, Mar 19, 2025 at 8:19 AM Ben Bolker  wrote:

>FWIW  Rcpp handles this (for CLOENV) with an ifdef:
>
>  #if (defined(R_VERSION) && R_VERSION >= R_Version(4,5,0))
>  return R_ClosureEnv(fun);
>  #else
>  return CLOENV(fun);
>  #endif
>
>
> https://github.com/RcppCore/Rcpp/blob/257e1977cd6e251d0a3d691050ad43fa29cf9666/inst/include/Rcpp/Function.h#L102-L106
>
> On 3/19/25 11:08, Josiah Parry wrote:
> > I'm trying to work through some new WARNINGs that I am experiencing
> *only* in
> > R-devel.
> >
> >   Found non-API calls to R: ‘BODY’, ‘CLOENV’, ‘ENCLOS’, ‘FORMALS’
> >
> > Take FORMALS, for example. IIUC, we should now be using R_ClosureFormals
> > instead. However, my understanding is that this is available only in R
> 4.5
> > main trunk.
> >
> > If migrating to the R_ClosureFormals, should the minimum version of R for
> > the package be recorded in the DESCRIPTION as R >= 4.5?
> >
> > Additionally, I'm somewhat at a loss for how to pass CRAN checks for
> > R-release and R-devel while using only R_ClosureFormals to adhere to
> > R-devel WARNING.
> >
> > Should old versions have an upper bound on the supported R version as
> well
> > as a lower one e.g. Depends may have R >=4.1.0 <4.5.0?
> >
> > Thanks in advance for your advice / insight!
> >
> > - Josiah
> >
> >   [[alternative HTML version deleted]]
> >
> > __
> > R-package-devel@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-package-devel
>
> --
> Dr. Benjamin Bolker
> Professor, Mathematics & Statistics and Biology, McMaster University
> Director, School of Computational Science and Engineering
> * E-mail is sent at my convenience; I don't expect replies outside of
> working hours.
>
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel