Skip to content

Conversation

@eddelbuettel
Copy link
Member

This addresses #1410 and adds a message if R.h (or one of three other headers) is seen before Rcpp.h is included.

Checklist

  • Code compiles correctly
  • R CMD check still passes all tests
  • Preferably, new tests were added which fail without the change
  • Document the changes by file in ChangeLog

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a compile-time check to detect when R headers (R.h, Rinterface.h, Rinternals.h, or Rdefines.h) are included before Rcpp headers, which can cause hard-to-debug errors. The check emits a pragma message directing users to issue #1410 for more information, and provides an escape hatch via the RCPP_NO_R_HEADERS_CHECK macro.

  • New header file check_r_headers.h that detects pre-included R headers
  • Integration of the check into RcppCommon.h as the first include
  • Copyright year updates for 2025

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
inst/include/Rcpp/r/check_r_headers.h New header file that checks for R headers included before Rcpp and emits pragma messages when detected
inst/include/RcppCommon.h Includes the new check_r_headers.h file and updates copyright year to 2025
ChangeLog Documents the addition of the new header check feature and the RCPP_NO_R_HEADERS_CHECK escape hatch

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@Enchufa2 Enchufa2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good robot. :) LGTM!

@eddelbuettel
Copy link
Member Author

Yes, as uncool it is to admit it, I now turn them on all the time. It is especially good at the nitpicky stuff.

@eddelbuettel
Copy link
Member Author

Ok, having waited the polite 24 hours for veto or comment (hi @kevinushey we know you're busy so no worries) I will now fold this in.

@eddelbuettel eddelbuettel merged commit 747fc0d into master Nov 25, 2025
26 of 28 checks passed
@eddelbuettel eddelbuettel deleted the feature/message_if_R_h_included branch November 25, 2025 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants