Skip to content

Commit 89afe0d

Browse files
authored
Merge pull request #1042 from RcppCore/feature/more_nocov
Feature/more nocov
2 parents b806285 + a368b39 commit 89afe0d

File tree

4 files changed

+31
-28
lines changed

4 files changed

+31
-28
lines changed

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2020-01-01 Dirk Eddelbuettel <[email protected]>
2+
3+
* inst/include/Rcpp/module/Module.h: A few more #nocov tags
4+
* inst/include/Rcpp/XPtr.h: Idem
5+
* inst/include/Rcpp/vector/Vector.h: Idem
6+
17
2019-12-31 Dirk Eddelbuettel <[email protected]>
28

39
* DESCRIPTION (Version, Date): Roll minor version

inst/include/Rcpp/XPtr.h

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
21
//
32
// XPtr.h: Rcpp R/C++ interface class library -- smart external pointers
43
//
5-
// Copyright (C) 2009 - 2017 Dirk Eddelbuettel and Romain Francois
4+
// Copyright (C) 2009 - 2020 Dirk Eddelbuettel and Romain Francois
65
//
76
// This file is part of Rcpp.
87
//
@@ -27,7 +26,7 @@
2726
namespace Rcpp {
2827

2928
template <typename T>
30-
void standard_delete_finalizer(T* obj) {
29+
void standard_delete_finalizer(T* obj) { // #nocov start
3130
delete obj;
3231
}
3332

@@ -46,7 +45,7 @@ void finalizer_wrapper(SEXP p) {
4645
R_ClearExternalPtr(p);
4746

4847
Finalizer(ptr);
49-
}
48+
} // #nocov end
5049

5150
template <
5251
typename T,
@@ -102,7 +101,7 @@ class XPtr :
102101
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"))
103102
Storage::set__(R_MakeExternalPtr((void*)p , tag, prot));
104103
if (set_delete_finalizer) {
105-
setDeleteFinalizer();
104+
setDeleteFinalizer(); // #nocov
106105
}
107106
}
108107

@@ -142,7 +141,7 @@ class XPtr :
142141
inline T* checked_get() const {
143142
T* ptr = get();
144143
if (ptr == NULL)
145-
throw ::Rcpp::exception("external pointer is not valid");
144+
throw ::Rcpp::exception("external pointer is not valid"); // #nocov
146145
return ptr;
147146
}
148147

@@ -162,10 +161,10 @@ class XPtr :
162161
return checked_get();
163162
}
164163

165-
void setDeleteFinalizer() {
164+
void setDeleteFinalizer() { // #nocov start
166165
R_RegisterCFinalizerEx(Storage::get__(), finalizer_wrapper<T,Finalizer>,
167166
(Rboolean) finalizeOnExit);
168-
}
167+
} // #nocov end
169168

170169
/**
171170
* Release the external pointer (if any) immediately. This will cause
@@ -197,8 +196,8 @@ class XPtr :
197196
private:
198197
inline void checked_set(SEXP x) {
199198
if (TYPEOF(x) != EXTPTRSXP) {
200-
const char* fmt = "Expecting an external pointer: [type=%s].";
201-
throw ::Rcpp::not_compatible(fmt, Rf_type2char(TYPEOF(x)));
199+
const char* fmt = "Expecting an external pointer: [type=%s]."; // #nocov
200+
throw ::Rcpp::not_compatible(fmt, Rf_type2char(TYPEOF(x))); // #nocov
202201
}
203202
Storage::set__(x);
204203
}

inst/include/Rcpp/module/Module.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
21
//
32
// Module.h: Rcpp R/C++ interface class library -- Rcpp modules
43
//
5-
// Copyright (C) 2012 - 2013 Dirk Eddelbuettel and Romain Francois
4+
// Copyright (C) 2012 - 2020 Dirk Eddelbuettel and Romain Francois
65
//
76
// This file is part of Rcpp.
87
//
@@ -51,7 +50,7 @@ namespace Rcpp {
5150
* @param args an array of R objects to use as arguments for the function
5251
* @param nargs number of arguments
5352
*/
54-
inline SEXP invoke( const std::string& name_, SEXP* args, int nargs){
53+
inline SEXP invoke( const std::string& name_, SEXP* args, int nargs){ // #nocov start
5554
MAP::iterator it = functions.find( name_ );
5655
if( it == functions.end() ){
5756
throw std::range_error( "no such function" ) ;
@@ -81,7 +80,7 @@ namespace Rcpp {
8180
}
8281
x.names() = names ;
8382
return x ;
84-
}
83+
} // #nocov end
8584

8685
/**
8786
* vector of names of the functions
@@ -117,7 +116,7 @@ namespace Rcpp {
117116
/**
118117
* completion information
119118
*/
120-
CharacterVector complete(){
119+
CharacterVector complete(){ // #nocov start
121120
size_t nf = functions.size() ;
122121
size_t nc = classes.size() ;
123122
size_t n = nf + nc ;
@@ -139,7 +138,7 @@ namespace Rcpp {
139138
res[i] = cit->first ;
140139
}
141140
return res ;
142-
}
141+
} // #nocov end
143142

144143
/**
145144
* Returns a list that contains:
@@ -199,13 +198,13 @@ namespace Rcpp {
199198
classes.insert( CLASS_PAIR( name_ , cptr ) ) ;
200199
}
201200

202-
inline bool has_function( const std::string& m){
201+
inline bool has_function( const std::string& m){ // #nocov start
203202
return functions.find(m) != functions.end() ;
204203
}
205204

206205
inline bool has_class( const std::string& m){
207206
return classes.find(m) != classes.end() ;
208-
}
207+
} // #nocov end
209208

210209
CppClass get_class( const std::string& cl ) ;
211210

inst/include/Rcpp/vector/Vector.h

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
21
//
32
// Vector.h: Rcpp R/C++ interface class library -- vectors
43
//
5-
// Copyright (C) 2010 - 2018 Dirk Eddelbuettel and Romain Francois
4+
// Copyright (C) 2010 - 2020 Dirk Eddelbuettel and Romain Francois
65
//
76
// This file is part of Rcpp.
87
//
@@ -301,12 +300,12 @@ class Vector :
301300
* one dimensional offset doing bounds checking to ensure
302301
* it is valid
303302
*/
304-
R_xlen_t offset(const R_xlen_t& i) const {
303+
R_xlen_t offset(const R_xlen_t& i) const { // #nocov start
305304
if(i < 0 || i >= ::Rf_xlength(Storage::get__()) ) {
306305
const char* fmt = "Index out of bounds: [index=%i; extent=%i].";
307306
throw index_out_of_bounds(fmt, i, ::Rf_xlength(Storage::get__()) ) ;
308307
}
309-
return i ;
308+
return i ; // #nocov end
310309
}
311310

312311
R_xlen_t offset(const std::string& name) const {
@@ -352,9 +351,9 @@ class Vector :
352351
inline Proxy at( const size_t& i) {
353352
return cache.ref( offset(i) ) ;
354353
}
355-
inline const_Proxy at( const size_t& i) const {
354+
inline const_Proxy at( const size_t& i) const { // #nocov start
356355
return cache.ref( offset(i) ) ;
357-
}
356+
} // #nocov end
358357

359358
inline Proxy operator()( const size_t& i, const size_t& j) {
360359
return cache.ref( offset(i,j) ) ;
@@ -632,7 +631,7 @@ class Vector :
632631
iterator this_end(end());
633632
if( Rf_isNull(names) ){
634633
for( ; it < this_end; ++it, ++target_it ){
635-
*target_it = *it ;
634+
*target_it = *it ; // #nocov start
636635
}
637636
} else {
638637
Shield<SEXP> newnames( ::Rf_allocVector( STRSXP, n + 1) ) ;
@@ -642,7 +641,7 @@ class Vector :
642641
SET_STRING_ELT( newnames, i, STRING_ELT(names, i ) ) ;
643642
}
644643
SET_STRING_ELT( newnames, i, Rf_mkChar("") ) ;
645-
target.attr("names") = newnames ;
644+
target.attr("names") = newnames ; // #nocov end
646645
}
647646
*target_it = object_sexp;
648647
Storage::set__( target.get__() ) ;
@@ -685,8 +684,8 @@ class Vector :
685684
int i=0;
686685
if( Rf_isNull(names) ){
687686
for( ; it < this_end; ++it, ++target_it,i++ ){
688-
*target_it = *it ;
689-
SET_STRING_ELT( newnames, i , R_BlankString );
687+
*target_it = *it ; // #nocov
688+
SET_STRING_ELT( newnames, i , R_BlankString ); // #nocov
690689
}
691690
} else {
692691
for( ; it < this_end; ++it, ++target_it, i++ ){

0 commit comments

Comments
 (0)