Rcpp Version 1.0.0
headers.h
Go to the documentation of this file.
1 // headers.h: Rcpp R/C++ interface class library -- R headers
2 //
3 // Copyright (C) 2008 - 2009 Dirk Eddelbuettel
4 // Copyright (C) 2009 - 2013 Dirk Eddelbuettel and Romain Francois
5 //
6 // This file is part of Rcpp.
7 //
8 // Rcpp is free software: you can redistribute it and/or modify it
9 // under the terms of the GNU General Public License as published by
10 // the Free Software Foundation, either version 2 of the License, or
11 // (at your option) any later version.
12 //
13 // Rcpp is distributed in the hope that it will be useful, but
14 // WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
20 
21 #ifndef RCPP__R__HEADERS__H
22 #define RCPP__R__HEADERS__H
23 
24 // include R headers, but set R_NO_REMAP and access everything via Rf_ prefixes
25 #define MAXELTSIZE 8192
26 #define R_NO_REMAP
27 
28 // until September 2019, define RCPP_NO_STRICT_R_HEADERS for transition
29 #ifndef RCPP_NO_STRICT_R_HEADERS
30 # define RCPP_NO_STRICT_R_HEADERS
31 #endif
32 // define strict headers for R to not clash on ERROR, MESSGAGE, etc
33 #ifndef RCPP_NO_STRICT_R_HEADERS
34 # ifndef STRICT_R_HEADERS
35 # define STRICT_R_HEADERS
36 # endif
37 #endif
38 
39 // prevent some macro pollution when including R headers
40 // in particular, on Linux, gcc 'leaks' the 'major',
41 // 'minor' and 'makedev' macros on Linux; we prevent
42 // letting those leak in after including any R headers
43 
44 #ifdef major
45 # define RCPP_HAS_MAJOR_MACRO
46 # pragma push_macro("major")
47 #endif
48 
49 #ifdef minor
50 # define RCPP_HAS_MINOR_MACRO
51 # pragma push_macro("minor")
52 #endif
53 
54 #ifdef makedev
55 # define RCPP_HAS_MAKEDEV_MACRO
56 # pragma push_macro("makedev")
57 #endif
58 
59 #include <Rcpp/platform/compiler.h>
60 #include <Rcpp/config.h>
61 #include <Rcpp/macros/macros.h>
62 
63 #include <R.h>
64 #include <Rinternals.h>
65 #include <R_ext/Complex.h>
66 #include <R_ext/Parse.h>
67 #include <R_ext/Rdynload.h>
68 #include <Rversion.h>
69 
70 /* Ensure NORET defined (normally provided by R headers with R >= 3.2.0) */
71 #ifndef NORET
72 # if defined(__GNUC__) && __GNUC__ >= 3
73 # define NORET __attribute__((noreturn))
74 # else
75 # define NORET
76 # endif
77 #endif
78 
79 #undef major
80 #undef minor
81 #undef makedev
82 
83 #ifdef RCPP_HAS_MAJOR_MACRO
84 # pragma pop_macro("major")
85 #endif
86 
87 #ifdef RCPP_HAS_MINOR_MACRO
88 # pragma pop_macro("minor")
89 #endif
90 
91 #ifdef RCPP_HAS_MAKEDEV_MACRO
92 # pragma pop_macro("makedev")
93 #endif
94 
95 #if (defined(RCPP_USE_UNWIND_PROTECT) && defined(R_VERSION) && R_VERSION >= R_Version(3, 5, 0))
96 # define RCPP_USING_UNWIND_PROTECT
97 #endif
98 
99 #endif /* RCPP__R__HEADERS__H */