Skip to content

Commit 2440034

Browse files
committed
more #nocov
1 parent 33132dc commit 2440034

File tree

3 files changed

+56
-42
lines changed

3 files changed

+56
-42
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2017-01-13 Dirk Eddelbuettel <[email protected]>
2+
3+
* inst/include/Rcpp/exceptions.h: Added more #nocov tags
4+
* inst/include/Rcpp/api/bones/wrap_extra_steps.h: Idem
5+
16
2017-01-12 Dirk Eddelbuettel <[email protected]>
27

38
* inst/bib/Rcpp.bib: Moved from vignettes/ directory

inst/include/Rcpp/api/bones/wrap_extra_steps.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
1+
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
22
/* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */
33
//
44
// wrap_extra_steps.h: Rcpp R/C++ interface class library -- wrap forward decl
55
//
6-
// Copyright (C) 2010 - 2012 Dirk Eddelbuettel and Romain Francois
6+
// Copyright (C) 2010 - 2017 Dirk Eddelbuettel and Romain Francois
77
//
88
// This file is part of Rcpp.
99
//
@@ -23,11 +23,11 @@
2323
#ifndef Rcpp__api__bones__wrap_extra_steps_h
2424
#define Rcpp__api__bones__wrap_extra_steps_h
2525

26-
namespace Rcpp{
26+
namespace Rcpp {
2727

28-
template<typename T> SEXP wrap_extra_steps( SEXP x ){
29-
return x ;
30-
}
28+
template<typename T> SEXP wrap_extra_steps(SEXP x) { // #nocov start
29+
return x;
30+
} // #nocov end
3131

3232
} // Rcpp
3333

inst/include/Rcpp/exceptions.h

Lines changed: 45 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
1+
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
22
//
33
// exceptions.h: Rcpp R/C++ interface class library -- exceptions
44
//
5-
// Copyright (C) 2010 - 2013 Dirk Eddelbuettel and Romain Francois
5+
// Copyright (C) 2010 - 2017 Dirk Eddelbuettel and Romain Francois
66
//
77
// This file is part of Rcpp.
88
//
@@ -24,60 +24,69 @@
2424

2525
#define GET_STACKTRACE() stack_trace( __FILE__, __LINE__ )
2626

27-
namespace Rcpp{
27+
namespace Rcpp {
2828

2929
class exception : public std::exception {
3030
public:
31-
explicit exception(const char* message_) : message(message_){ rcpp_set_stack_trace(stack_trace()); }
32-
exception(const char* message_, const char* file, int line ) : message(message_){
33-
rcpp_set_stack_trace( stack_trace(file,line) ) ;
31+
explicit exception(const char* message_) : message(message_) { // #nocov start
32+
rcpp_set_stack_trace(stack_trace());
33+
}
34+
exception(const char* message_, const char* file, int line) : message(message_) {
35+
rcpp_set_stack_trace(stack_trace(file,line));
3436
}
35-
virtual ~exception() throw(){}
37+
virtual ~exception() throw() {}
3638
virtual const char* what() const throw() {
37-
return message.c_str() ;
39+
return message.c_str(); // #nocov end
3840
}
3941
private:
40-
std::string message ;
41-
} ;
42+
std::string message;
43+
};
4244

4345
// simple helper
44-
static std::string toString(const int i) {
46+
static std::string toString(const int i) { // #nocov start
4547
std::ostringstream ostr;
4648
ostr << i;
47-
return ostr.str();
49+
return ostr.str(); // #nocov end
4850
}
4951

50-
class no_such_env : public std::exception{
52+
class no_such_env : public std::exception {
5153
public:
52-
no_such_env( const std::string& name ) throw() : message( std::string("no such environment: '") + name + "'" ){} ;
53-
no_such_env( int pos ) throw() : message( "no environment in given position '" + toString(pos) + "'") {} ;
54-
virtual ~no_such_env() throw(){} ;
55-
virtual const char* what() const throw(){ return message.c_str() ; } ;
54+
no_such_env(const std::string& name) throw() :
55+
message(std::string("no such environment: '") + name + "'") {};
56+
no_such_env(int pos) throw() :
57+
message("no environment in given position '" + toString(pos) + "'") {};
58+
virtual ~no_such_env() throw() {};
59+
virtual const char* what() const throw() { return message.c_str(); };
5660
private:
57-
std::string message ;
58-
} ;
61+
std::string message;
62+
};
5963

6064
class file_io_error : public std::exception {
6165
public:
62-
file_io_error(const std::string& file) throw() : message( std::string("file io error: '") + file + "'" ), file(file) {} ;
63-
file_io_error(int code, const std::string& file) throw() : message( "file io error " + toString(code) + ": '" + file + "'"), file(file) {} ;
64-
file_io_error(const std::string& msg, const std::string& file) throw() : message( msg + ": '" + file + "'"), file(file) {} ;
65-
virtual ~file_io_error() throw(){} ;
66-
virtual const char* what() const throw(){ return message.c_str() ; } ;
67-
std::string filePath() const throw(){ return file ; } ;
66+
file_io_error(const std::string& file) throw() : // #nocov start
67+
message(std::string("file io error: '") + file + "'"), file(file) {};
68+
file_io_error(int code, const std::string& file) throw() :
69+
message("file io error " + toString(code) + ": '" + file + "'"), file(file) {};
70+
file_io_error(const std::string& msg, const std::string& file) throw() :
71+
message(msg + ": '" + file + "'"), file(file) {};
72+
virtual ~file_io_error() throw() {};
73+
virtual const char* what() const throw() { return message.c_str(); };
74+
std::string filePath() const throw() { return file; }; // #nocov end
6875
private:
69-
std::string message ;
76+
std::string message;
7077
std::string file;
7178
} ;
7279

73-
class file_not_found : public file_io_error {
80+
class file_not_found : public file_io_error { // #nocov start
7481
public:
75-
file_not_found(const std::string& file) throw() : file_io_error("file not found", file) {}
82+
file_not_found(const std::string& file) throw() :
83+
file_io_error("file not found", file) {} // #nocov end
7684
};
7785

78-
class file_exists : public file_io_error {
86+
class file_exists : public file_io_error { // #nocov start
7987
public:
80-
file_exists(const std::string& file) throw() : file_io_error("file already exists", file) {}
88+
file_exists(const std::string& file) throw() :
89+
file_io_error("file already exists", file) {} // #nocov end
8190
};
8291

8392
#define RCPP_EXCEPTION_CLASS(__CLASS__,__WHAT__) \
@@ -101,7 +110,7 @@ namespace Rcpp{
101110
RCPP_SIMPLE_EXCEPTION_CLASS(not_a_matrix, "not a matrix")
102111
RCPP_SIMPLE_EXCEPTION_CLASS(index_out_of_bounds, "index out of bounds")
103112
RCPP_SIMPLE_EXCEPTION_CLASS(parse_error, "parse error")
104-
RCPP_SIMPLE_EXCEPTION_CLASS(not_s4, "not an S4 object")
113+
RCPP_SIMPLE_EXCEPTION_CLASS(not_s4, "not an S4 object") // #nocov start
105114
RCPP_SIMPLE_EXCEPTION_CLASS(not_reference, "not an S4 object of a reference class")
106115
RCPP_SIMPLE_EXCEPTION_CLASS(not_initialized, "C++ object not initialized (missing default constructor?)")
107116
RCPP_SIMPLE_EXCEPTION_CLASS(no_such_slot, "no such slot")
@@ -118,15 +127,15 @@ namespace Rcpp{
118127
RCPP_EXCEPTION_CLASS(binding_is_locked, std::string("binding is locked: '") + message + "'" )
119128
RCPP_EXCEPTION_CLASS(no_such_namespace, std::string("no such namespace: '") + message + "'" )
120129
RCPP_EXCEPTION_CLASS(function_not_exported, std::string("function not exported: ") + message)
121-
RCPP_EXCEPTION_CLASS(eval_error, message )
130+
RCPP_EXCEPTION_CLASS(eval_error, message ) // #nocov end
122131

123132
#undef RCPP_EXCEPTION_CLASS
124133
#undef RCPP_SIMPLE_EXCEPTION_CLASS
125134

126135

127136
namespace internal {
128137

129-
inline SEXP nth(SEXP s, int n) {
138+
inline SEXP nth(SEXP s, int n) { // #nocov start
130139
return Rf_length(s) > n ? (n == 0 ? CAR(s) : CAR(Rf_nthcdr(s, n))) : R_NilValue;
131140
}
132141

@@ -236,7 +245,7 @@ inline SEXP string_to_try_error( const std::string& str){
236245
Rf_setAttrib( tryError, R_ClassSymbol, Rf_mkString("try-error") ) ;
237246
Rf_setAttrib( tryError, Rf_install( "condition") , simpleError ) ;
238247

239-
return tryError;
248+
return tryError; // #nocov end
240249
}
241250

242251
inline SEXP exception_to_try_error( const std::exception& ex){
@@ -302,9 +311,9 @@ namespace Rcpp{
302311
Rf_warning( tfm::format(fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10).c_str() );
303312
}
304313

305-
inline void NORET stop(const std::string& message) {
314+
inline void NORET stop(const std::string& message) { // #nocov start
306315
throw Rcpp::exception(message.c_str());
307-
}
316+
} // #nocov end
308317

309318
template <typename T1>
310319
inline void NORET stop(const char* fmt, const T1& arg1) {

0 commit comments

Comments
 (0)