Skip to content

Commit c684452

Browse files
committed
more nocov
1 parent 1e6bf21 commit c684452

File tree

4 files changed

+34
-29
lines changed

4 files changed

+34
-29
lines changed

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2019-12-13 Dirk Eddelbuettel <[email protected]>
2+
3+
* src/api.cpp: A few more nocov tags
4+
* src/attributes.cpp: Idem
5+
* src/barrier.cpp: Idem
6+
17
2019-12-08 Dirk Eddelbuettel <[email protected]>
28

39
* tests/tinytest.R: Turn verbose tests on in dev and on Travis

src/api.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// api.cpp: Rcpp R/C++ interface class library -- Rcpp api
44
//
5-
// Copyright (C) 2012 - 2016 Dirk Eddelbuettel and Romain Francois
5+
// Copyright (C) 2012 - 2019 Dirk Eddelbuettel and Romain Francois
66
//
77
// This file is part of Rcpp.
88
//
@@ -82,7 +82,7 @@ namespace Rcpp {
8282
}
8383

8484
// [[Rcpp::register]]
85-
unsigned long beginSuspendRNGSynchronization() {
85+
unsigned long beginSuspendRNGSynchronization() {// #nocov start
8686
++rngSynchronizationSuspended;
8787
return rngSynchronizationSuspended;
8888
}
@@ -91,7 +91,7 @@ namespace Rcpp {
9191
unsigned long endSuspendRNGSynchronization() {
9292
--rngSynchronizationSuspended;
9393
return rngSynchronizationSuspended;
94-
}
94+
} // #nocov end
9595

9696
// [[Rcpp::register]]
9797
char* get_string_buffer() {

src/attributes.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,7 @@ namespace attributes {
957957
parseSourceDependencies(sourceFile, &dependencies);
958958

959959
// remove main source file
960-
dependencies.erase(std::remove(dependencies.begin(),
960+
dependencies.erase(std::remove(dependencies.begin(), // #nocov
961961
dependencies.end(),
962962
FileInfo(sourceFile)),
963963
dependencies.end());
@@ -1263,9 +1263,9 @@ namespace attributes {
12631263
// check for a match
12641264
Rcpp::CharacterVector match = initMatches[i];
12651265
if (match.size() > 0) {
1266-
hasPackageInit_ = true;
1266+
hasPackageInit_ = true; // #nocov start
12671267
break;
1268-
}
1268+
} // #nocov end
12691269
}
12701270

12711271
// Parse embedded R
@@ -1285,9 +1285,9 @@ namespace attributes {
12851285
SourceFileAttributesParser parser(dependency, packageName, false);
12861286

12871287
// copy to base attributes (if it's a new attribute)
1288-
for (SourceFileAttributesParser::const_iterator
1288+
for (SourceFileAttributesParser::const_iterator // #nocov start
12891289
it = parser.begin(); it != parser.end(); ++it) {
1290-
if (std::find(attributes_.begin(), // #nocov start
1290+
if (std::find(attributes_.begin(),
12911291
attributes_.end(),
12921292
*it) == attributes_.end()) {
12931293
attributes_.push_back(*it); // #nocov end
@@ -1454,8 +1454,8 @@ namespace attributes {
14541454
beginParenLoc == std::string::npos ||
14551455
endParenLoc < beginParenLoc) {
14561456

1457-
rcppExportNoFunctionFoundWarning(lineNumber);
1458-
return Function();
1457+
rcppExportNoFunctionFoundWarning(lineNumber); // #nocov
1458+
return Function(); // #nocov
14591459
}
14601460

14611461
// Find the type and name by scanning backwards for the whitespace that
@@ -1510,7 +1510,7 @@ namespace attributes {
15101510
trimWhitespace(&arg);
15111511
if (arg.empty()) {
15121512
// we don't warn here because the compilation will fail anyway
1513-
continue;
1513+
continue; // #nocov
15141514
}
15151515

15161516
// If the argument has an = within it then it has a default value
@@ -1656,12 +1656,12 @@ namespace attributes {
16561656
case '>':
16571657
templateCount--;
16581658
break;
1659-
case '(':
1660-
parenCount++; // #nocov
1661-
break; // #nocov
1659+
case '(': // #nocov start
1660+
parenCount++;
1661+
break;
16621662
case ')':
1663-
parenCount--; // #nocov
1664-
break; // #nocov
1663+
parenCount--;
1664+
break; // #nocov end
16651665
}
16661666
}
16671667
}
@@ -2445,12 +2445,12 @@ namespace attributes {
24452445
ostr() << "invisible("; // #nocov
24462446
ostr() << ".Call(";
24472447
if (!registration_)
2448-
ostr() << "'";
2448+
ostr() << "'"; // #nocov
24492449
else
24502450
ostr() << "`";
24512451
ostr() << packageCppPrefix() << "_" << function.name();
24522452
if (!registration_)
2453-
ostr() << "', " << "PACKAGE = '" << package() << "'";
2453+
ostr() << "', " << "PACKAGE = '" << package() << "'"; // #nocov
24542454
else
24552455
ostr() << "`";
24562456

@@ -2972,7 +2972,7 @@ namespace attributes {
29722972

29732973
// skip empty case
29742974
if (pStr->empty())
2975-
return;
2975+
return; // #nocov
29762976

29772977
// trim right
29782978
std::string::size_type pos = pStr->find_last_not_of(kWhitespaceChars);
@@ -3572,14 +3572,14 @@ BEGIN_RCPP
35723572
// don't process RcppExports.cpp
35733573
std::string cppFile = cppFiles[i];
35743574
if (endsWith(cppFile, "RcppExports.cpp"))
3575-
continue;
3575+
continue; // #nocov
35763576

35773577
// parse file
35783578
SourceFileAttributesParser attributes(cppFile, packageName, false);
35793579

35803580
// note if we found a package init function
35813581
if (!hasPackageInit && attributes.hasPackageInit())
3582-
hasPackageInit = true;
3582+
hasPackageInit = true; // #nocov
35833583

35843584
// continue if no generator output
35853585
if (!attributes.hasGeneratorOutput())
@@ -3618,7 +3618,7 @@ BEGIN_RCPP
36183618
depends.begin(), depends.end(),
36193619
std::back_inserter(diff));
36203620
if (!diff.empty()) {
3621-
std::string msg =
3621+
std::string msg = // #nocov start
36223622
"The following packages are referenced using Rcpp::depends "
36233623
"attributes however are not listed in the Depends, Imports or "
36243624
"LinkingTo fields of the package DESCRIPTION file: ";
@@ -3627,7 +3627,7 @@ BEGIN_RCPP
36273627
if (i != (diff.size()-1))
36283628
msg += ", ";
36293629
}
3630-
showWarning(msg);
3630+
showWarning(msg); // #nocov end
36313631
}
36323632

36333633
// verbose output

src/barrier.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// barrier.cpp: Rcpp R/C++ interface class library -- write barrier
44
//
5-
// Copyright (C) 2010 - 2015 Dirk Eddelbuettel and Romain Francois
5+
// Copyright (C) 2010 - 2019 Dirk Eddelbuettel and Romain Francois
66
//
77
// This file is part of Rcpp.
88
//
@@ -29,7 +29,7 @@
2929
#include <Rcpp/protection/Shield.h>
3030

3131
// [[Rcpp::register]]
32-
SEXP get_string_elt(SEXP x, R_xlen_t i) {
32+
SEXP get_string_elt(SEXP x, R_xlen_t i) { // #nocov start
3333
return STRING_ELT(x, i);
3434
}
3535

@@ -65,7 +65,7 @@ void set_vector_elt(SEXP x, R_xlen_t i, SEXP value) {
6565

6666
// [[Rcpp::register]]
6767
SEXP* get_vector_ptr(SEXP x) {
68-
return VECTOR_PTR(x);
68+
return VECTOR_PTR(x); // #nocov end
6969
}
7070

7171
// [[Rcpp::register]]
@@ -153,7 +153,7 @@ SEXP init_Rcpp_cache() {
153153
}
154154

155155
// [[Rcpp::register]]
156-
SEXP reset_current_error() {
156+
SEXP reset_current_error() { // #nocov start
157157
SEXP cache = get_rcpp_cache();
158158

159159
// error occured
@@ -189,7 +189,7 @@ SEXP rcpp_error_recorder(SEXP e) {
189189

190190
// [[Rcpp::register]]
191191
SEXP rcpp_get_current_error() {
192-
return VECTOR_ELT(get_rcpp_cache(), 2);
192+
return VECTOR_ELT(get_rcpp_cache(), 2); // #nocov end
193193
}
194194

195195
// [[Rcpp::register]]
@@ -206,4 +206,3 @@ int* get_cache(int m) {
206206
std::fill(res, res+m, 0);
207207
return res;
208208
}
209-

0 commit comments

Comments
 (0)