Skip to content

Commit 5aa08f8

Browse files
authored
Merge pull request #211 from traversc/master
undef TRUE and FALSE macros
2 parents 7fcf9da + 35b66ca commit 5aa08f8

File tree

5 files changed

+59
-2
lines changed

5 files changed

+59
-2
lines changed

.github/workflows/R-CMD-check.yaml

+11-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,17 @@ name: R-CMD-check
1010

1111
jobs:
1212
R-CMD-check:
13-
runs-on: ubuntu-latest
13+
runs-on: ${{ matrix.config.os }}
14+
15+
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
16+
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
config:
21+
- {os: macOS-latest, r: 'release'}
22+
- {os: ubuntu-latest, r: 'release'}
23+
- {os: windows-latest, r: 'release'}
1424
env:
1525
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
1626
R_KEEP_PKG_SOURCE: yes

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: RcppParallel
22
Type: Package
33
Title: Parallel Programming Tools for 'Rcpp'
4-
Version: 5.1.7-9000
4+
Version: 5.1.7-9001
55
Authors@R: c(
66
person("JJ", "Allaire", role = c("aut"), email = "jj@rstudio.com"),
77
person("Romain", "Francois", role = c("aut", "cph")),

inst/include/RcppParallel.h

+10
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,14 @@ inline void parallelReduce(std::size_t begin,
6969

7070
} // end namespace RcppParallel
7171

72+
// TRUE and FALSE macros that may come with system headers on some systems
73+
// But conflict with R.h (R_ext/Boolean.h)
74+
// TRUE and FALSE macros should be undef in RcppParallel.h
75+
#ifdef TRUE
76+
#undef TRUE
77+
#endif
78+
#ifdef FALSE
79+
#undef FALSE
80+
#endif
81+
7282
#endif// __RCPP_PARALLEL__

inst/tests/cpp/truefalse_macros.cpp

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
* @title Test for TRUE and FALSE macros
3+
* @author Travers Ching
4+
* @license GPL (>= 2)
5+
*/
6+
7+
// TRUE and FALSE macros that may come with system headers on some systems
8+
// But conflict with R.h (R_ext/Boolean.h)
9+
// TRUE and FALSE macros should be undef in RcppParallel.h
10+
11+
#include<Rcpp.h>
12+
#include<RcppParallel.h>
13+
14+
// [[Rcpp::depends(RcppParallel)]]
15+
16+
#ifndef TRUE
17+
static_assert(true, "Macro TRUE does not exist");
18+
#else
19+
static_assert(false, "Macro TRUE exists");
20+
#endif
21+
22+
#ifndef FALSE
23+
static_assert(true, "Macro FALSE does not exist");
24+
#else
25+
static_assert(false, "Macro FALSE exists");
26+
#endif
27+
28+
// [[Rcpp::export]]
29+
inthush_no_export_warning() {
30+
return1;
31+
}

inst/tests/runit.truefalse_macros.R

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
library(Rcpp)
3+
library(RUnit)
4+
5+
sourceCpp(system.file("tests/cpp/truefalse_macros.cpp", package="RcppParallel"))
6+

0 commit comments

Comments
 (0)
close