Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7988986

Browse filesBrowse files
committed
undef TRUE/FALSE macros as needed
1 parent 7fcf9da commit 7988986
Copy full SHA for 7988986

File tree

4 files changed

+48
-1
lines changed
Filter options

4 files changed

+48
-1
lines changed

‎DESCRIPTION

Copy file name to clipboardExpand all lines: DESCRIPTION
+1-1Lines changed: 1 addition & 1 deletion
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

Copy file name to clipboardExpand all lines: inst/include/RcppParallel.h
+10Lines changed: 10 additions & 0 deletions
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

Copy file name to clipboard
+31Lines changed: 31 additions & 0 deletions
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+
int hush_no_export_warning() {
30+
return 1;
31+
}

‎inst/tests/runit.truefalse_macros.R

Copy file name to clipboard
+6Lines changed: 6 additions & 0 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.