[Rcpp-commits] r3993 - in pkg/Rcpp: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Nov 18 17:49:09 CET 2012


Author: jjallaire
Date: 2012-11-18 17:49:08 +0100 (Sun, 18 Nov 2012)
New Revision: 3993

Modified:
   pkg/Rcpp/ChangeLog
   pkg/Rcpp/R/Attributes.R
   pkg/Rcpp/TODO
   pkg/Rcpp/man/sourceCpp.Rd
Log:
print warning if no export attributes are found in source file

Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog	2012-11-18 16:39:01 UTC (rev 3992)
+++ pkg/Rcpp/ChangeLog	2012-11-18 16:49:08 UTC (rev 3993)
@@ -1,10 +1,12 @@
 2012-11-18  JJ Allaire <jj at rstudio.org>
 
-        * R/Attributes.R: sourceCpp embedded R code
+        * R/Attributes.R: sourceCpp embedded R code; print warning if 
+        no export attributes are found in source file
         * src/AttributesParser.h: sourceCpp embedded R code
         * src/AttributesParser.cpp: sourceCpp embedded R code
         * src/Attributes.cpp: sourceCpp embedded R code; include <Rcpp.h>
         above generated modules
+        * man/sourceCpp.Rd: documentation updates
 
 2012-11-18  Romain Francois <romain at r-enthusiasts.com>
 

Modified: pkg/Rcpp/R/Attributes.R
===================================================================
--- pkg/Rcpp/R/Attributes.R	2012-11-18 16:39:01 UTC (rev 3992)
+++ pkg/Rcpp/R/Attributes.R	2012-11-18 16:49:08 UTC (rev 3993)
@@ -138,6 +138,8 @@
         dll <- dyn.load(context$dynlibPath)
         populate(Module(context$moduleName, PACKAGE = dll, mustStart = TRUE), 
                  env)
+    } else if (getOption("rcpp.warnNoExports", default=TRUE)) {
+        warning("No Rcpp::export attributes found in source")
     }
     
     # source the embeddedR

Modified: pkg/Rcpp/TODO
===================================================================
--- pkg/Rcpp/TODO	2012-11-18 16:39:01 UTC (rev 3992)
+++ pkg/Rcpp/TODO	2012-11-18 16:49:08 UTC (rev 3993)
@@ -152,8 +152,6 @@
 
     o   Add docstring parameter to Rcpp::export attribute
 
-    o   Emit warning if sourceCpp finds no exports (control via option)
-
 Testing
 
     o	all r* functions : rnorm, etc ...

Modified: pkg/Rcpp/man/sourceCpp.Rd
===================================================================
--- pkg/Rcpp/man/sourceCpp.Rd	2012-11-18 16:39:01 UTC (rev 3992)
+++ pkg/Rcpp/man/sourceCpp.Rd	2012-11-18 16:49:08 UTC (rev 3993)
@@ -61,6 +61,8 @@
     The \code{sourceCpp} function is designed for compiling a standalone source file whose only dependencies are R packages. If you are compiling more than one source file or have external dependencies then you should create an R package rather than using \code{sourceCpp}. Note that the \code{\link[=exportAttribute]{Rcpp::export}} attribute can also be used within packages via the \code{\link{compileAttributes}} function.
     
     If you are sourcing a C++ file from within the \code{src} directory of a package then the package's \code{LinkingTo} dependencies, \code{inst/include}, and \code{src} directories are automatically included in the compilation.
+    
+    If no \code{Rcpp::export} attributes are found within the source file then a warning is printed to the console. You can disable this warning by setting the \code{rcpp.warnNoExports} option to \code{FALSE}.
 
 }
 



More information about the Rcpp-commits mailing list