|
| 1 | +// sysmacros.h: Rcpp R/C++ interface class library -- avoid sysmacros pollution |
| 2 | +// |
| 3 | +// Copyright (C) 2015 Dirk Eddelbuettel, Romain Francois, and Kevin Ushey |
| 4 | +// |
| 5 | +// This file is part of Rcpp. |
| 6 | +// |
| 7 | +// Rcpp is free software: you can redistribute it and/or modify it |
| 8 | +// under the terms of the GNU General Public License as published by |
| 9 | +// the Free Software Foundation, either version 2 of the License, or |
| 10 | +// (at your option) any later version. |
| 11 | +// |
| 12 | +// Rcpp is distributed in the hope that it will be useful, but |
| 13 | +// WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | +// GNU General Public License for more details. |
| 16 | +// |
| 17 | +// You should have received a copy of the GNU General Public License |
| 18 | +// along with Rcpp. If not, see <http://www.gnu.org/Licenses/>. |
| 19 | + |
| 20 | +#ifndef RCPP__PLATFORM__SYSMACROS_H |
| 21 | +#define RCPP__PLATFORM__SYSMACROS_H |
| 22 | + |
| 23 | +// include <sys/sysmacros.h>, and then remove stupid |
| 24 | +// 'major', 'minor' and 'makedev' defines. this works |
| 25 | +// around Rinternals.h eventually including this header |
| 26 | +// and letting the macros leak through |
| 27 | +#if defined(__GNUC__) && !defined(__APPLE__) |
| 28 | + |
| 29 | +# ifdef major |
| 30 | +# define RCPP_HAS_MAJOR_MACRO |
| 31 | +# pragma push_macro("major") |
| 32 | +# endif |
| 33 | + |
| 34 | +# ifdef minor |
| 35 | +# define RCPP_HAS_MINOR_MACRO |
| 36 | +# pragma push_macro("minor") |
| 37 | +# endif |
| 38 | + |
| 39 | +# ifdef makedev |
| 40 | +# define RCPP_HAS_MAKEDEV_MACRO |
| 41 | +# pragma push_macro("makedev") |
| 42 | +# endif |
| 43 | + |
| 44 | +# include <sys/sysmacros.h> |
| 45 | + |
| 46 | +# undef major |
| 47 | +# undef minor |
| 48 | +# undef makedev |
| 49 | + |
| 50 | +# ifdef RCPP_HAS_MAJOR_MACRO |
| 51 | +# pragma pop_macro("major") |
| 52 | +# endif |
| 53 | + |
| 54 | +# ifdef RCPP_HAS_MINOR_MACRO |
| 55 | +# pragma pop_macro("minor") |
| 56 | +# endif |
| 57 | + |
| 58 | +# ifdef RCPP_HAS_MAKEDEV_MACRO |
| 59 | +# pragma pop_macro("makedev") |
| 60 | +# endif |
| 61 | + |
| 62 | +#endif |
| 63 | + |
| 64 | +#endif /* RCPP__PLATFORM__SYSMACROS_H */ |
0 commit comments