From 7988986ded247823413af39ac7bec0afbd6c04ca Mon Sep 17 00:00:00 2001 From: Travers <traversc@gmail.com> Date: Tue, 27 Feb 2024 18:06:48 -0800 Subject: [PATCH 1/2] undef TRUE/FALSE macros as needed --- DESCRIPTION | 2 +- inst/include/RcppParallel.h | 10 ++++++++++ inst/tests/cpp/truefalse_macros.cpp | 31 +++++++++++++++++++++++++++++ inst/tests/runit.truefalse_macros.R | 6 ++++++ 4 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 inst/tests/cpp/truefalse_macros.cpp create mode 100644 inst/tests/runit.truefalse_macros.R diff --git a/DESCRIPTION b/DESCRIPTION index ec443b779..dab24b8e6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: RcppParallel Type: Package Title: Parallel Programming Tools for 'Rcpp' -Version: 5.1.7-9000 +Version: 5.1.7-9001 Authors@R: c( person("JJ", "Allaire", role = c("aut"), email = "jj@rstudio.com"), person("Romain", "Francois", role = c("aut", "cph")), diff --git a/inst/include/RcppParallel.h b/inst/include/RcppParallel.h index f78a5db43..637c16d4b 100644 --- a/inst/include/RcppParallel.h +++ b/inst/include/RcppParallel.h @@ -69,4 +69,14 @@ inline void parallelReduce(std::size_t begin, } // end namespace RcppParallel +// TRUE and FALSE macros that may come with system headers on some systems +// But conflict with R.h (R_ext/Boolean.h) +// TRUE and FALSE macros should be undef in RcppParallel.h +#ifdef TRUE + #undef TRUE +#endif +#ifdef FALSE + #undef FALSE +#endif + #endif // __RCPP_PARALLEL__ diff --git a/inst/tests/cpp/truefalse_macros.cpp b/inst/tests/cpp/truefalse_macros.cpp new file mode 100644 index 000000000..412c88399 --- /dev/null +++ b/inst/tests/cpp/truefalse_macros.cpp @@ -0,0 +1,31 @@ +/** + * @title Test for TRUE and FALSE macros + * @author Travers Ching + * @license GPL (>= 2) + */ + +// TRUE and FALSE macros that may come with system headers on some systems +// But conflict with R.h (R_ext/Boolean.h) +// TRUE and FALSE macros should be undef in RcppParallel.h + +#include <Rcpp.h> +#include <RcppParallel.h> + +// [[Rcpp::depends(RcppParallel)]] + +#ifndef TRUE +static_assert(true, "Macro TRUE does not exist"); +#else +static_assert(false, "Macro TRUE exists"); +#endif + +#ifndef FALSE +static_assert(true, "Macro FALSE does not exist"); +#else +static_assert(false, "Macro FALSE exists"); +#endif + +// [[Rcpp::export]] +int hush_no_export_warning() { + return 1; +} \ No newline at end of file diff --git a/inst/tests/runit.truefalse_macros.R b/inst/tests/runit.truefalse_macros.R new file mode 100644 index 000000000..8e403e364 --- /dev/null +++ b/inst/tests/runit.truefalse_macros.R @@ -0,0 +1,6 @@ + +library(Rcpp) +library(RUnit) + +sourceCpp(system.file("tests/cpp/truefalse_macros.cpp", package = "RcppParallel")) + From 35b66caf66b2e61f0288cc03668edfe94bb6d292 Mon Sep 17 00:00:00 2001 From: Travers <traversc@gmail.com> Date: Tue, 27 Feb 2024 18:18:35 -0800 Subject: [PATCH 2/2] add mac and windows to github actions --- .github/workflows/R-CMD-check.yaml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index f4b17a4b6..897585d50 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -10,7 +10,17 @@ name: R-CMD-check jobs: R-CMD-check: - runs-on: ubuntu-latest + runs-on: ${{ matrix.config.os }} + + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) + + strategy: + fail-fast: false + matrix: + config: + - {os: macOS-latest, r: 'release'} + - {os: ubuntu-latest, r: 'release'} + - {os: windows-latest, r: 'release'} env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} R_KEEP_PKG_SOURCE: yes