[Rcpp-commits] r2924 - in pkg/Rcpp: . inst inst/include/Rcpp

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Mar 11 02:33:29 CET 2011


Author: edd
Date: 2011-03-11 02:33:27 +0100 (Fri, 11 Mar 2011)
New Revision: 2924

Modified:
   pkg/Rcpp/ChangeLog
   pkg/Rcpp/DESCRIPTION
   pkg/Rcpp/inst/NEWS
   pkg/Rcpp/inst/include/Rcpp/grow.h
Log:
added another small patch by Murray concerning C++ conformance as discovered by clang/llvm


Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog	2011-03-10 18:54:12 UTC (rev 2923)
+++ pkg/Rcpp/ChangeLog	2011-03-11 01:33:27 UTC (rev 2924)
@@ -1,3 +1,10 @@
+2011-03-10  Dirk Eddelbuettel  <edd at debian.org>
+
+	* inst/include/Rcpp/grow.h: Applied another patch kindly supplied by
+	Murray which fixes another clang/llvm and C++ conformance issue by
+	re-ordering declarations as unqualified names must be declared before
+	they are used, even when used within templates.
+
 2011-02-28  Dirk Eddelbuettel  <edd at debian.org>
 
 	* inst/doc/Makefile: Call R and Rscript relative to R_HOME/bin

Modified: pkg/Rcpp/DESCRIPTION
===================================================================
--- pkg/Rcpp/DESCRIPTION	2011-03-10 18:54:12 UTC (rev 2923)
+++ pkg/Rcpp/DESCRIPTION	2011-03-11 01:33:27 UTC (rev 2924)
@@ -1,6 +1,6 @@
 Package: Rcpp
 Title: Seamless R and C++ Integration
-Version: 0.9.2
+Version: 0.9.2.1
 Date: $Date$
 Author: Dirk Eddelbuettel and Romain Francois, 
  with contributions by Douglas Bates and John Chambers

Modified: pkg/Rcpp/inst/NEWS
===================================================================
--- pkg/Rcpp/inst/NEWS	2011-03-10 18:54:12 UTC (rev 2923)
+++ pkg/Rcpp/inst/NEWS	2011-03-11 01:33:27 UTC (rev 2924)
@@ -2,6 +2,10 @@
 
     o   inst/doc/Makefile now respects $R_HOME environment variable
 
+    o   inst/include/Rcpp/grow.h: C++ conformance issue found by clang/llvm
+        addressed by re-ordering declarations as unqualified names must be
+        declared before they are used, even when used within templates
+
 0.9.2   2011-02-23
 
     o   The unitTest runit.Module.client.package.R is now skipped on older OS

Modified: pkg/Rcpp/inst/include/Rcpp/grow.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/grow.h	2011-03-10 18:54:12 UTC (rev 2923)
+++ pkg/Rcpp/inst/include/Rcpp/grow.h	2011-03-11 01:33:27 UTC (rev 2924)
@@ -25,62 +25,61 @@
 #include <RcppCommon.h>
 #include <Rcpp/Named.h>
 
-namespace Rcpp{
+namespace Rcpp {
 
-inline SEXP pairlist() { return R_NilValue ; }
+    inline SEXP pairlist() { return R_NilValue ; }
 
-#ifdef HAS_VARIADIC_TEMPLATES
+    namespace internal {
 
-/* end of the recursion, wrap first to make the CAR and use 
-   R_NilValue as the CDR of the list */
-template<typename T>
-SEXP pairlist( const T& first){
-	return grow(first, R_NilValue ) ; 
-}
+	template <typename T>
+	SEXP grow__dispatch( ::Rcpp::traits::false_type, const T& head, SEXP tail ){
+	    SEXP x = PROTECT( wrap( head ) ) ;
+	    SEXP res = PROTECT( Rf_cons( x, tail ) ) ;
+	    UNPROTECT(2) ;
+	    return res ;
+	}
 
-template<typename T, typename... Args>
-SEXP pairlist( const T& first, const Args&... args ){
-	return grow(first, pairlist(args...) ) ;
-}
-#else
+	template <typename T>
+	SEXP grow__dispatch( ::Rcpp::traits::true_type, const T& head, SEXP tail ){
+	    SEXP y = PROTECT( wrap( head.object) ) ;
+	    SEXP x = PROTECT( Rf_cons( y , tail) ) ;
+	    SEXP headNameSym = ::Rf_install( head.name.c_str() ); // cannot be gc()ed once in symbol table
+	    SET_TAG( x, headNameSym ); 
+	    UNPROTECT(2); 
+	    return x; 	
+	}
 
-#include <Rcpp/generated/grow__pairlist.h>
+    } // namespace internal
 
-#endif
-	
-namespace internal{
 
-template <typename T>
-SEXP grow__dispatch( ::Rcpp::traits::false_type, const T& head, SEXP tail ){
-	SEXP x = PROTECT( wrap( head ) ) ;
-    SEXP res = PROTECT( Rf_cons( x, tail ) ) ;
-    UNPROTECT(2) ;
-    return res ;
-}
+    /**
+     * grows a pairlist. First wrap the head into a SEXP, then 
+     * grow the tail pairlist
+     */
+    template <typename T>
+    SEXP grow(const T& head, SEXP tail) {
+	return internal::grow__dispatch( typename traits::is_named<T>::type(), head, tail );
+    }
 
-template <typename T>
-SEXP grow__dispatch( ::Rcpp::traits::true_type, const T& head, SEXP tail ){
-	SEXP y = PROTECT( wrap( head.object) ) ;
-	SEXP x = PROTECT( Rf_cons( y , tail) ) ;
-	SEXP headNameSym = ::Rf_install( head.name.c_str() ); // cannot be gc()ed once in symbol table
-	SET_TAG( x, headNameSym ); 
-	UNPROTECT(2); 
-	return x; 	
-}
+#ifdef HAS_VARIADIC_TEMPLATES
 
-} // namespace internal
+    /* end of the recursion, wrap first to make the CAR and use R_NilValue as the CDR of the list */
+    template<typename T>
+    SEXP pairlist( const T& first){
+	return grow(first, R_NilValue ); 
+    }
 
+    template<typename T, typename... Args>
+    SEXP pairlist( const T& first, const Args&... args ){
+	return grow(first, pairlist(args...) );
+    }
 
-/**
- * grows a pairlist. First wrap the head into a SEXP, then 
- * grow the tail pairlist
- */
-template <typename T>
-SEXP grow(const T& head, SEXP tail){
-	return internal::grow__dispatch( typename traits::is_named<T>::type(), head, tail ) ;
-}
+#else
 
+#include <Rcpp/generated/grow__pairlist.h>
 
+#endif
+
 } // namespace Rcpp
 
 #endif



More information about the Rcpp-commits mailing list