Skip to content

Update Attributes.R (closes #1017) #1016

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 9, 2019
Merged

Update Attributes.R (closes #1017) #1016

merged 1 commit into from
Nov 9, 2019

Conversation

tjmckinley
Copy link
Contributor

When passing multiple "depends" arguments to "cppFunction" e.g.

cppFunction(code, depends = c("package1", "package2"))

this was producing code with scaffolding:

// [[Rcpp:depends(package1)]]
// [[Rcpp:depends(package2)]]
#include <package1.h>
#include <Rcpp.h>

rather than

// [[Rcpp:depends(package1, package2)]]
#include <package1.h>
#include <package2.h>
#include <Rcpp.h>

Corrected parsing of multiple "depends" statements in "cppFunction".
Copy link
Contributor

@coatless coatless left a comment

Choose a reason for hiding this comment

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

Good catch! LGTM.

@tjmckinley
Copy link
Contributor Author

No worries. Thanks to all for producing such a useful package!

@coatless
Copy link
Contributor

coatless commented Nov 9, 2019

@tjmckinley while you're at it... Mind fixing the code for plugins as well? c.f.

Rcpp/R/Attributes.R

Lines 258 to 259 in 975361f

plugins <- paste(plugins, sep=", ") # #nocov start
pluginsAttrib <- paste("// [[Rcpp::plugins(", plugins, ")]]", sep="")

@eddelbuettel
Copy link
Member

@tjmckinley Thank you. Please also consider reading Contributing before sending PRs.

What is the motivation for the PR? What it fixes is not a defect but an aesthetic preference. Which would change something used as it currently is and was by lots of people. We generally don't do that without good reason.

@tjmckinley
Copy link
Contributor Author

My apologies @eddelbuettel. I will log an issue now with a reprex.

@tjmckinley
Copy link
Contributor Author

Hi @eddelbuettel. I've logged an issue (#1017) with a reprex. It's not purely aesthetic in this case since the code won't compile for the example since the header file for RcppArmadillo is not found. For example, running a function of the form

cppFunction(code, depends = c("package1", "package2"))

produces code with scaffolding:

// [[Rcpp:depends(package1)]]
// [[Rcpp:depends(package2)]]
#include <package1.h>
#include <Rcpp.h>

with no #include <package2.h>. This is caused simply by the cppFunction() code not parsing the depends argument correctly.

Many thanks,

TJ

@tjmckinley
Copy link
Contributor Author

By the way, many thanks @eddelbuettel, @coatless for producing this fantastic package. I can't do without it! Apologies also if I take a while to reply. I'm in Japan and hence the time difference causes a lag in response time.

@tjmckinley
Copy link
Contributor Author

@tjmckinley while you're at it... Mind fixing the code for plugins as well? c.f.

Rcpp/R/Attributes.R

Lines 258 to 259 in 975361f

plugins <- paste(plugins, sep=", ") # #nocov start
pluginsAttrib <- paste("// [[Rcpp::plugins(", plugins, ")]]", sep="")

Yes @coatless. Happy to do this if you and @eddelbuettel think this is an issue.

@jjallaire
Copy link
Member

LGTM as well.

@eddelbuettel eddelbuettel changed the title Update Attributes.R Update Attributes.R (closes #1017) Nov 9, 2019
@eddelbuettel
Copy link
Member

Looks good to me too after a closer look; merging.

@eddelbuettel eddelbuettel merged commit bbd7365 into RcppCore:master Nov 9, 2019
@tjmckinley tjmckinley mentioned this pull request Nov 9, 2019
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.

4 participants