Skip to content

Commit

Permalink
Addressed latest CRAN checks with _STRICT_R_HEADERS (2024-09-23)
Browse files Browse the repository at this point in the history
Compilation fails with _R_USE_STRICT_R_HEADERS_=true, which defines
STRICT_R_HEADERS to 1 which removes

- the legacy definition of PI (use POSIX's M_PI, available in R fer ever).
- the RS.h declarations for Calloc, Realloc, Free (use R_ forms i
  available since R 3.4.0).

The aim is to clean the namespace: in particular having a definition
for Free has conflicted with some packages' C++ code.

It is planned that STRICT_R_HEADERS=1 will become the default for 4.5.0,
for which it would be good if all CRAN packages compile/install ok with
the new default.

Your package is among the ones which need updating.  We would thus
really appreciate if you could provide a new version of your package as
soon as possible which checks ok with STRICT_R_HEADERS=1.

You can verify that your package checks ok with STRICT_R_HEADERS=1 via R
CMD check --as-cran using a current version of R-devel.

Please correct before 2024-10-21 to safely retain your package on CRAN.

Updated GitHub workflows
  • Loading branch information
Sebastian Luque committed Oct 12, 2024
1 parent c4eb56e commit 6cd2288
Show file tree
Hide file tree
Showing 9 changed files with 135 additions and 33 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
EXAMPLES.*
^TODO$
^.AppleDouble$
^.lintr$
^vignettes/auto$
^src/\.clang-format$
man-roxygen
4 changes: 2 additions & 2 deletions .github/workflows/build_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup pandoc
uses: r-lib/actions/setup-pandoc@v2
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:

- name: Upload check results
if: failure()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
95 changes: 95 additions & 0 deletions .github/workflows/rhub.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# R-hub's generic GitHub Actions workflow file. It's canonical location is at
# https://github.com/r-hub/actions/blob/v1/workflows/rhub.yaml
# You can update this file to a newer version using the rhub2 package:
#
# rhub::rhub_setup()
#
# It is unlikely that you need to modify this file manually.

name: R-hub
run-name: "${{ github.event.inputs.id }}: ${{ github.event.inputs.name || format('Manually run by {0}', github.triggering_actor) }}"

on:
workflow_dispatch:
inputs:
config:
description: 'A comma separated list of R-hub platforms to use.'
type: string
default: 'linux,windows,macos'
name:
description: 'Run name. You can leave this empty now.'
type: string
id:
description: 'Unique ID. You can leave this empty now.'
type: string

jobs:

setup:
runs-on: ubuntu-latest
outputs:
containers: ${{ steps.rhub-setup.outputs.containers }}
platforms: ${{ steps.rhub-setup.outputs.platforms }}

steps:
# NO NEED TO CHECKOUT HERE
- uses: r-hub/actions/setup@v1
with:
config: ${{ github.event.inputs.config }}
id: rhub-setup

linux-containers:
needs: setup
if: ${{ needs.setup.outputs.containers != '[]' }}
runs-on: ubuntu-latest
name: ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.containers) }}
container:
image: ${{ matrix.config.container }}

steps:
- uses: r-hub/actions/checkout@v1
- uses: r-hub/actions/platform-info@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/setup-deps@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/run-check@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}

other-platforms:
needs: setup
if: ${{ needs.setup.outputs.platforms != '[]' }}
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.platforms) }}

steps:
- uses: r-hub/actions/checkout@v1
- uses: r-hub/actions/setup-r@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
- uses: r-hub/actions/platform-info@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/setup-deps@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
- uses: r-hub/actions/run-check@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
11 changes: 8 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
Package: diveMove
Type: Package
Title: Dive Analysis and Calibration
Version: 1.6.2
Depends: R (>= 3.5.0), methods, stats4
Version: 1.6.4
Depends: R (>= 4.4.0), methods, stats4
Suggests: knitr, lattice, pander, rmarkdown, tinytest
Imports: geosphere, KernSmooth, plotly, quantreg, uniReg
Author: Sebastian P. Luque <spluque@gmail.com>
Authors@R: person(given = c("Sebastian", "P."),
family = "Luque",
role = c("aut", "cre"),
email = "spluque@gmail.com",
comment = c(ORCID = "0000-0002-9647-3691"))
Author: Sebastian P. Luque [aut, cre] (<https://orcid.org/0000-0002-9647-3691>)
Maintainer: Sebastian P. Luque <spluque@gmail.com>
Description: Utilities to represent, visualize, filter, analyse, and summarize
time-depth recorder (TDR) data. Miscellaneous functions for
Expand Down
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Changes in version 1.6.4:

o The package now depends on R >= 4.4.0.

Changes in version 1.6.0:

o Analyses for 2- and 3-process Poisson mixtures are now fully
Expand Down
11 changes: 5 additions & 6 deletions R/calibrate.R
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,13 @@
##' \code{\link{.detDive}}, \code{\link{plotTDR}}, and
##' \code{\link{plotZOC}} to visually assess ZOC procedure. See
##' \code{\link{diveModel}}, \code{\link{smooth.spline}},
##' \code{\link{unireg}} for dive models.
##' \code{\link[uniReg]{unireg}} for dive models.
##' @references
##'
##' Koellmann, C., Ickstadt, K. and Fried, R. (2014) Beyond unimodal
##' regression: modelling multimodality with piecewise unimodal, mixture or
##' additive regression. Technical Report 8.
##' \url{https://sfb876.tu-dortmund.de/FORSCHUNG/techreports.html}, SFB 876, TU
##' Dortmund
##' Koellmann, C., Ickstadt, K. and Fried, R. (2016) Beyond unimodal
##' regression: modelling multimodality with piecewise unimodal or
##' deconvolution models. Technical Report
##' \url{https://arxiv.org/abs/1606.01666}, Technische Universität Dortmund
##'
##' Luque, S.P. and Fried, R. (2011) Recursive filtering for zero offset
##' correction of diving depth time series. PLoS ONE 6:e15850
Expand Down
11 changes: 5 additions & 6 deletions man/calibrateDepth.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions man/labDive-internal.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@
\item{dive.model, smooth.par, knot.factor, descent.crit.q,
ascent.crit.q}{Passed from \code{calibrateDepth}.}

\item{sigmasq, g, ordpen}{default arguments for \code{\link{unireg}}, so
only relevant for \code{divemodel="unimodal"}.}
\item{sigmasq, g, ordpen}{default arguments for
\code{\link[uniReg]{unireg}}, so only relevant for
\code{divemodel="unimodal"}.}

\item{act}{factor with values to label.}

Expand Down
26 changes: 12 additions & 14 deletions src/run_quantile.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
int R_finite(double x) {
return ((x) == (x));
}
#define Calloc(b, t) (t *) calloc(b, sizeof(t))
#define Free free
#define PRINT(x) \
{ \
if ((x) == (x)) \
Expand Down Expand Up @@ -384,10 +382,10 @@ void run_quantile_lite(double *In, double *Out, const int *nIn,
}
} else { /* non-trivial case */
/* index will hold partially sorted index numbers of Save array */
idx = Calloc(m, int);
idx = R_Calloc(m, int);
/* stores all points of the current running window */
Win = Calloc(m, double);
prob = Calloc(nPrb, double);
Win = R_Calloc(m, double);
prob = R_Calloc(nPrb, double);
for (i = 0; i < m; i++) {
Win[i] = *(in++); /* initialize running window */
idx[i] = i; /* and its index */
Expand Down Expand Up @@ -417,9 +415,9 @@ void run_quantile_lite(double *In, double *Out, const int *nIn,
j = (j + 1) %
m; /* index goes from 0 to m-1, and back to 0 again */
}
Free(Win);
Free(idx);
Free(prob);
R_Free(Win);
R_Free(idx);
R_Free(prob);
}
}

Expand Down Expand Up @@ -447,10 +445,10 @@ void run_quantile(double *In, double *Out, const int *nIn, const int *nWin,
run_max(In, Out, nIn, nWin);
} else { /* non-trivial case */
/* index will hold partially sorted index numbers of Save array */
idx = Calloc(m, int);
idx = R_Calloc(m, int);
/* store all points of the current running window */
Win = Calloc(m, double);
prob = Calloc(nPrb, double);
Win = R_Calloc(m, double);
prob = R_Calloc(nPrb, double);
for (i = 0; i < m; i++) idx[i] = i; /* and its index */
for (i = 0; i < k2; i++) {
Win[i] = *(in++); /* initialize running window */
Expand Down Expand Up @@ -558,9 +556,9 @@ void run_quantile(double *In, double *Out, const int *nIn, const int *nWin,
/* index goes from 0 to m-1, and back to 0 again */
j = (j + 1) % m;
}
Free(Win);
Free(idx);
Free(prob);
R_Free(Win);
R_Free(idx);
R_Free(prob);
}
}

Expand Down

0 comments on commit 6cd2288

Please sign in to comment.