Skip to content

Commit a0c1213

Browse files
committed
work around macro leakage
1 parent cd0d344 commit a0c1213

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2015-01-15 Kevin Ushey <[email protected]>
2+
3+
* inst/include/RcppCommon.h: remove leaked macros
4+
'major', 'minor' and 'makedev' from sys/sysmacros.h
5+
16
2015-01-08 Dirk Eddelbuettel <[email protected]>
27

38
* inst/examples/OpenMP/GNUmakefile: Renamed from Makefile because it

inst/include/RcppCommon.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,32 @@
3030
#include <Rcpp/config.h>
3131
#include <Rcpp/macros/macros.h>
3232

33+
// include <sys/sysmacros.h>, and then remove stupid
34+
// 'major', 'minor' and 'makedev' defines. this works
35+
// around Rinternals.h eventually including this header
36+
// and letting the macros leak through
37+
#if defined(__GNUC__) && !defined(__clang__)
38+
39+
# ifdef major
40+
# warning Macro 'major' will be undefined! See https://bugzilla.redhat.com/show_bug.cgi?id=130601.
41+
# endif
42+
43+
# ifdef minor
44+
# warning Macro 'minor' will be undefined! See https://bugzilla.redhat.com/show_bug.cgi?id=130601.
45+
# endif
46+
47+
# ifdef makedev
48+
# warning Macro 'makedev' will be undefined! See https://bugzilla.redhat.com/show_bug.cgi?id=130601.
49+
# endif
50+
51+
# include <sys/sysmacros.h>
52+
53+
# undef major
54+
# undef minor
55+
# undef makedev
56+
57+
#endif
58+
3359
// include R headers, but set R_NO_REMAP and access everything via Rf_ prefixes
3460
#define MAXELTSIZE 8192
3561
#define R_NO_REMAP

0 commit comments

Comments
 (0)