Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
2025-11-24 Dirk Eddelbuettel <edd@debian.org>

* inst/include/Rcpp/r/check_r_headers.h: Add RCPP_NO_R_HEADERS_CHECK
override to skip new check

2025-11-23 Dirk Eddelbuettel <edd@debian.org>

* inst/include/Rcpp/r/check_r_headers.h: New header to check if R.h
or related R headers were installed first
* inst/include/RcppCommon.h: Call new header as first thing

2025-11-04 Dirk Eddelbuettel <edd@debian.org>

* .github/workflows/macos.yaml (jobs): Roll macos-13 to macos-14
Expand Down
44 changes: 44 additions & 0 deletions inst/include/Rcpp/r/check_r_headers.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// check_r_headers.h: Rcpp R/C++ interface class library -- R header check
//
// Copyright (C) 2025 - current Dirk Eddelbuettel
//
// This file is part of Rcpp.
//
// Rcpp is free software: you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 2 of the License, or
// (at your option) any later version.
//
// Rcpp is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Rcpp. If not, see <http://www.gnu.org/licenses/>.

#ifndef RCPP__CHECK__R__HEADERS__H
#define RCPP__CHECK__R__HEADERS__H

// Allow an escape hatch
#if !defined(RCPP_NO_R_HEADERS_CHECK)

#if defined(R_R_H) && defined(USING_R)
#pragma message "R.h has been included before any Rcpp headers. This can lead to hard-to-debug errors, and is not necessary. See https://github.com/RcppCore/Rcpp/issues/1410"
#endif

#if defined(RINTERFACE_H_)
#pragma message "Rinterface.h has been included before any Rcpp headers. This can lead to hard-to-debug errors, and is not necessary. See https://github.com/RcppCore/Rcpp/issues/1410"
#endif

#if defined(R_INTERNALS_H_)
#pragma message "Rinternals.h has been included before any Rcpp headers. This can lead to hard-to-debug errors, and is not necessary. See https://github.com/RcppCore/Rcpp/issues/1410"
#endif

#if defined(R_DEFINES_H_)
#pragma message "Rdefines.h has been included before any Rcpp headers. This can lead to hard-to-debug errors, and is not necessary. See https://github.com/RcppCore/Rcpp/issues/1410"
#endif

#endif // escape hatch '!defined(RCPP_NO_R_HEADERS_CHECK)'

#endif // header guard
3 changes: 2 additions & 1 deletion inst/include/RcppCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//
// Copyright (C) 2008 - 2009 Dirk Eddelbuettel
// Copyright (C) 2009 - 2020 Dirk Eddelbuettel and Romain Francois
// Copyright (C) 2021 Dirk Eddelbuettel, Romain Francois and Iñaki Ucar
// Copyright (C) 2021 - 2025 Dirk Eddelbuettel, Romain Francois and Iñaki Ucar
//
// This file is part of Rcpp.
//
Expand All @@ -27,6 +27,7 @@
// #define RCPP_DEBUG_LEVEL 1
// #define RCPP_DEBUG_MODULE_LEVEL 1

#include <Rcpp/r/check_r_headers.h>
#include <Rcpp/r/headers.h>
#include <Rcpp/r/compat.h>

Expand Down