From 6e9d791285e38347f31d6e35a08c72f7ee6e0d96 Mon Sep 17 00:00:00 2001 From: Dirk Eddelbuettel Date: Wed, 1 Jan 2020 15:02:31 -0600 Subject: [PATCH 1/3] more nocov --- ChangeLog | 4 ++++ inst/include/Rcpp/module/Module.h | 15 +++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index d9768db5b..22ddfd3be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2020-01-01 Dirk Eddelbuettel + + * inst/include/Rcpp/module/Module.h: A few more #nocov tags + 2019-12-31 Dirk Eddelbuettel * DESCRIPTION (Version, Date): Roll minor version diff --git a/inst/include/Rcpp/module/Module.h b/inst/include/Rcpp/module/Module.h index 46e0e8c57..742d73030 100644 --- a/inst/include/Rcpp/module/Module.h +++ b/inst/include/Rcpp/module/Module.h @@ -1,8 +1,7 @@ -// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // Module.h: Rcpp R/C++ interface class library -- Rcpp modules // -// Copyright (C) 2012 - 2013 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2012 - 2019 Dirk Eddelbuettel and Romain Francois // // This file is part of Rcpp. // @@ -51,7 +50,7 @@ namespace Rcpp { * @param args an array of R objects to use as arguments for the function * @param nargs number of arguments */ - inline SEXP invoke( const std::string& name_, SEXP* args, int nargs){ + inline SEXP invoke( const std::string& name_, SEXP* args, int nargs){ // #nocov start MAP::iterator it = functions.find( name_ ); if( it == functions.end() ){ throw std::range_error( "no such function" ) ; @@ -81,7 +80,7 @@ namespace Rcpp { } x.names() = names ; return x ; - } + } // #nocov end /** * vector of names of the functions @@ -117,7 +116,7 @@ namespace Rcpp { /** * completion information */ - CharacterVector complete(){ + CharacterVector complete(){ // #nocov start size_t nf = functions.size() ; size_t nc = classes.size() ; size_t n = nf + nc ; @@ -139,7 +138,7 @@ namespace Rcpp { res[i] = cit->first ; } return res ; - } + } // #nocov end /** * Returns a list that contains: @@ -199,13 +198,13 @@ namespace Rcpp { classes.insert( CLASS_PAIR( name_ , cptr ) ) ; } - inline bool has_function( const std::string& m){ + inline bool has_function( const std::string& m){ // #nocov start return functions.find(m) != functions.end() ; } inline bool has_class( const std::string& m){ return classes.find(m) != classes.end() ; - } + } // #nocov end CppClass get_class( const std::string& cl ) ; From da2ad341e4d1f80f8fe70341db6785194bc421c2 Mon Sep 17 00:00:00 2001 From: Dirk Eddelbuettel Date: Wed, 1 Jan 2020 15:20:33 -0600 Subject: [PATCH 2/3] more nocov --- ChangeLog | 3 ++- inst/include/Rcpp/XPtr.h | 19 +++++++++---------- inst/include/Rcpp/module/Module.h | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 22ddfd3be..45364dac3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 2020-01-01 Dirk Eddelbuettel - * inst/include/Rcpp/module/Module.h: A few more #nocov tags + * inst/include/Rcpp/module/Module.h: A few more #nocov tags + * inst/include/Rcpp/XPtr.h: Idem 2019-12-31 Dirk Eddelbuettel diff --git a/inst/include/Rcpp/XPtr.h b/inst/include/Rcpp/XPtr.h index cebebc5ff..a06d18368 100644 --- a/inst/include/Rcpp/XPtr.h +++ b/inst/include/Rcpp/XPtr.h @@ -1,8 +1,7 @@ -// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // XPtr.h: Rcpp R/C++ interface class library -- smart external pointers // -// Copyright (C) 2009 - 2017 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2009 - 2020 Dirk Eddelbuettel and Romain Francois // // This file is part of Rcpp. // @@ -27,7 +26,7 @@ namespace Rcpp { template -void standard_delete_finalizer(T* obj) { +void standard_delete_finalizer(T* obj) { // #nocov start delete obj; } @@ -46,7 +45,7 @@ void finalizer_wrapper(SEXP p) { R_ClearExternalPtr(p); Finalizer(ptr); -} +} // #nocov end template < typename T, @@ -102,7 +101,7 @@ class XPtr : RCPP_DEBUG_2("XPtr(T* p = <%p>, bool set_delete_finalizer = %s, SEXP tag = R_NilValue, SEXP prot = R_NilValue)", p, (set_delete_finalizer ? "true" : "false")) Storage::set__(R_MakeExternalPtr((void*)p , tag, prot)); if (set_delete_finalizer) { - setDeleteFinalizer(); + setDeleteFinalizer(); // #nocov } } @@ -142,7 +141,7 @@ class XPtr : inline T* checked_get() const { T* ptr = get(); if (ptr == NULL) - throw ::Rcpp::exception("external pointer is not valid"); + throw ::Rcpp::exception("external pointer is not valid"); // #nocov return ptr; } @@ -162,10 +161,10 @@ class XPtr : return checked_get(); } - void setDeleteFinalizer() { + void setDeleteFinalizer() { // #nocov start R_RegisterCFinalizerEx(Storage::get__(), finalizer_wrapper, (Rboolean) finalizeOnExit); - } + } // #nocov end /** * Release the external pointer (if any) immediately. This will cause @@ -197,8 +196,8 @@ class XPtr : private: inline void checked_set(SEXP x) { if (TYPEOF(x) != EXTPTRSXP) { - const char* fmt = "Expecting an external pointer: [type=%s]."; - throw ::Rcpp::not_compatible(fmt, Rf_type2char(TYPEOF(x))); + const char* fmt = "Expecting an external pointer: [type=%s]."; // #nocov + throw ::Rcpp::not_compatible(fmt, Rf_type2char(TYPEOF(x))); // #nocov } Storage::set__(x); } diff --git a/inst/include/Rcpp/module/Module.h b/inst/include/Rcpp/module/Module.h index 742d73030..43edc20e0 100644 --- a/inst/include/Rcpp/module/Module.h +++ b/inst/include/Rcpp/module/Module.h @@ -1,7 +1,7 @@ // // Module.h: Rcpp R/C++ interface class library -- Rcpp modules // -// Copyright (C) 2012 - 2019 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2012 - 2020 Dirk Eddelbuettel and Romain Francois // // This file is part of Rcpp. // From a368b398b3c5c0cfc45704cb042a5bcbc29549b3 Mon Sep 17 00:00:00 2001 From: Dirk Eddelbuettel Date: Wed, 1 Jan 2020 15:34:29 -0600 Subject: [PATCH 3/3] more nocov --- ChangeLog | 1 + inst/include/Rcpp/vector/Vector.h | 19 +++++++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 45364dac3..89a4edf64 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ * inst/include/Rcpp/module/Module.h: A few more #nocov tags * inst/include/Rcpp/XPtr.h: Idem + * inst/include/Rcpp/vector/Vector.h: Idem 2019-12-31 Dirk Eddelbuettel diff --git a/inst/include/Rcpp/vector/Vector.h b/inst/include/Rcpp/vector/Vector.h index f91b6c651..0f3905e8c 100644 --- a/inst/include/Rcpp/vector/Vector.h +++ b/inst/include/Rcpp/vector/Vector.h @@ -1,8 +1,7 @@ -// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- // // Vector.h: Rcpp R/C++ interface class library -- vectors // -// Copyright (C) 2010 - 2018 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2010 - 2020 Dirk Eddelbuettel and Romain Francois // // This file is part of Rcpp. // @@ -301,12 +300,12 @@ class Vector : * one dimensional offset doing bounds checking to ensure * it is valid */ - R_xlen_t offset(const R_xlen_t& i) const { + R_xlen_t offset(const R_xlen_t& i) const { // #nocov start if(i < 0 || i >= ::Rf_xlength(Storage::get__()) ) { const char* fmt = "Index out of bounds: [index=%i; extent=%i]."; throw index_out_of_bounds(fmt, i, ::Rf_xlength(Storage::get__()) ) ; } - return i ; + return i ; // #nocov end } R_xlen_t offset(const std::string& name) const { @@ -352,9 +351,9 @@ class Vector : inline Proxy at( const size_t& i) { return cache.ref( offset(i) ) ; } - inline const_Proxy at( const size_t& i) const { + inline const_Proxy at( const size_t& i) const { // #nocov start return cache.ref( offset(i) ) ; - } + } // #nocov end inline Proxy operator()( const size_t& i, const size_t& j) { return cache.ref( offset(i,j) ) ; @@ -632,7 +631,7 @@ class Vector : iterator this_end(end()); if( Rf_isNull(names) ){ for( ; it < this_end; ++it, ++target_it ){ - *target_it = *it ; + *target_it = *it ; // #nocov start } } else { Shield newnames( ::Rf_allocVector( STRSXP, n + 1) ) ; @@ -642,7 +641,7 @@ class Vector : SET_STRING_ELT( newnames, i, STRING_ELT(names, i ) ) ; } SET_STRING_ELT( newnames, i, Rf_mkChar("") ) ; - target.attr("names") = newnames ; + target.attr("names") = newnames ; // #nocov end } *target_it = object_sexp; Storage::set__( target.get__() ) ; @@ -685,8 +684,8 @@ class Vector : int i=0; if( Rf_isNull(names) ){ for( ; it < this_end; ++it, ++target_it,i++ ){ - *target_it = *it ; - SET_STRING_ELT( newnames, i , R_BlankString ); + *target_it = *it ; // #nocov + SET_STRING_ELT( newnames, i , R_BlankString ); // #nocov } } else { for( ; it < this_end; ++it, ++target_it, i++ ){