@@ -2431,7 +2431,7 @@ namespace attributes {
24312431 return " FALSE" ;
24322432 else if (cppArg == " R_NilValue" )
24332433 return " NULL" ;
2434- else if (cppArg == " NA_STRING" )
2434+ else if (cppArg == " NA_STRING" ) // #nocov start
24352435 return " NA_character_" ;
24362436 else if (cppArg == " NA_INTEGER" )
24372437 return " NA_integer_" ;
@@ -2466,7 +2466,7 @@ namespace attributes {
24662466 }
24672467 }
24682468
2469- return std::string ();
2469+ return std::string (); // #nocov end
24702470
24712471 }
24722472
@@ -2485,7 +2485,7 @@ namespace attributes {
24852485 return rArg;
24862486
24872487 // try for a create arg
2488- rArg = cppCreateArgToRArg (cppArg);
2488+ rArg = cppCreateArgToRArg (cppArg); // #nocov start
24892489 if (!rArg.empty ())
24902490 return rArg;
24912491
@@ -2505,7 +2505,7 @@ namespace attributes {
25052505 return rArg;
25062506
25072507 // couldn't parse the arg
2508- return std::string ();
2508+ return std::string (); // #nocov end
25092509 }
25102510
25112511 } // anonymous namespace
@@ -2523,10 +2523,10 @@ namespace attributes {
25232523 if (!rArg.empty ()) {
25242524 argsOstr << " = " << rArg;
25252525 } else {
2526- showWarning (" Unable to parse C++ default value '" +
2526+ showWarning (" Unable to parse C++ default value '" + // #nocov start
25272527 argument.defaultValue () + " ' for argument " +
25282528 argument.name () + " of function " +
2529- function.name ());
2529+ function.name ()); // #nocov end
25302530 }
25312531 }
25322532
@@ -2569,7 +2569,7 @@ namespace attributes {
25692569 std::string funcName = contextId + " _" + function.name ();
25702570 ostr << funcName;
25712571 if (cppInterface)
2572- ostr << kTrySuffix ;
2572+ ostr << kTrySuffix ; // #nocov
25732573 ostr << " (" ;
25742574 std::ostringstream ostrArgs;
25752575 const std::vector<Argument>& arguments = function.arguments ();
@@ -2622,7 +2622,7 @@ namespace attributes {
26222622
26232623 // Now write an R wrapper that returns error via Rf_error
26242624 if (cppInterface) {
2625- ostr << " RcppExport SEXP " << funcName << " (" << args << " ) {"
2625+ ostr << " RcppExport SEXP " << funcName << " (" << args << " ) {" // #nocov start
26262626 << std::endl;
26272627 ostr << " SEXP rcpp_result_gen;" << std::endl;
26282628 ostr << " {" << std::endl;
@@ -2653,7 +2653,7 @@ namespace attributes {
26532653 << " }" << std::endl
26542654 << " UNPROTECT(1);" << std::endl
26552655 << " return rcpp_result_gen;" << std::endl
2656- << " }" << std::endl;
2656+ << " }" << std::endl; // #nocov end
26572657 }
26582658 }
26592659 }
@@ -2684,7 +2684,7 @@ namespace attributes {
26842684 if (errno == ENOENT)
26852685 exists_ = false ;
26862686 else
2687- throw Rcpp::file_io_error (errno, path);
2687+ throw Rcpp::file_io_error (errno, path); // #nocov
26882688 } else {
26892689 exists_ = true ;
26902690 lastModified_ = static_cast <double >(buffer.st_mtime );
@@ -2694,22 +2694,22 @@ namespace attributes {
26942694 // Remove a file (call back into R for this)
26952695 bool removeFile (const std::string& path) {
26962696 if (FileInfo (path).exists ()) {
2697- Rcpp::Function rm = Rcpp::Environment::base_env ()[" file.remove" ];
2697+ Rcpp::Function rm = Rcpp::Environment::base_env ()[" file.remove" ]; // #nocov start
26982698 rm (path);
2699- return true ;
2699+ return true ; // #nocov end
27002700 }
27012701 else {
27022702 return false ;
27032703 }
27042704 }
27052705
27062706 // Recursively create a directory (call back into R for this)
2707- void createDirectory (const std::string& path) {
2707+ void createDirectory (const std::string& path) { // #nocov start
27082708 if (!FileInfo (path).exists ()) {
27092709 Rcpp::Function mkdir = Rcpp::Environment::base_env ()[" dir.create" ];
27102710 mkdir (path, Rcpp::Named (" recursive" ) = true );
27112711 }
2712- }
2712+ } // #nocov end
27132713
27142714 // Known whitespace chars
27152715 const char * const kWhitespaceChars = " \f\n\r\t\v " ;
@@ -2787,22 +2787,22 @@ namespace attributes {
27872787 return ;
27882788 char quote = *(pStr->begin ());
27892789 if ( (quote == ' \' ' || quote == ' \" ' ) && (*(pStr->rbegin ()) == quote) )
2790- *pStr = pStr->substr (1 , pStr->length ()-2 );
2790+ *pStr = pStr->substr (1 , pStr->length ()-2 ); // #nocov
27912791 }
27922792
27932793 // is the passed string quoted?
27942794 bool isQuoted (const std::string& str) {
27952795 if (str.length () < 2 )
2796- return false ;
2796+ return false ; // #nocov
27972797 char quote = *(str.begin ());
27982798 return (quote == ' \' ' || quote == ' \" ' ) && (*(str.rbegin ()) == quote);
27992799 }
28002800
28012801 // show a warning message
2802- void showWarning (const std::string& msg) {
2802+ void showWarning (const std::string& msg) { // #nocov start
28032803 Rcpp::Function warning = Rcpp::Environment::base_env ()[" warning" ];
28042804 warning (msg, Rcpp::Named (" call." ) = false );
2805- }
2805+ } // #nocov end
28062806
28072807 bool isRoxygenCpp (const std::string& str) {
28082808 size_t len = str.length ();
@@ -2850,7 +2850,7 @@ namespace {
28502850 // get cpp source file info
28512851 FileInfo cppSourceFilenameInfo (cppSourcePath_);
28522852 if (!cppSourceFilenameInfo.exists ())
2853- throw Rcpp::file_not_found (cppSourcePath_);
2853+ throw Rcpp::file_not_found (cppSourcePath_); // #nocov
28542854
28552855 // record the base name of the source file
28562856 Rcpp::Function basename = Rcpp::Environment::base_env ()[" basename" ];
@@ -2895,8 +2895,8 @@ namespace {
28952895 embeddedR_ = as<std::vector<std::string> >(dynlib[" embeddedR" ]);
28962896 List sourceDependencies = as<List>(dynlib[" sourceDependencies" ]);
28972897 for (R_xlen_t i = 0 ; i<sourceDependencies.length (); i++) {
2898- List fileInfo = as<List>(sourceDependencies.at (i));
2899- sourceDependencies_.push_back (FileInfo (fileInfo));
2898+ List fileInfo = as<List>(sourceDependencies.at (i)); // #nocov
2899+ sourceDependencies_.push_back (FileInfo (fileInfo)); // #nocov
29002900 }
29012901 }
29022902
@@ -2936,17 +2936,17 @@ namespace {
29362936 // source file out of date means we're dirty
29372937 if (FileInfo (cppSourcePath_).lastModified () >
29382938 FileInfo (generatedCppSourcePath ()).lastModified ())
2939- return true ;
2939+ return true ; // #nocov
29402940
29412941 // no dynlib means we're dirty
29422942 if (!FileInfo (dynlibPath ()).exists ())
2943- return true ;
2943+ return true ; // #nocov
29442944
29452945 // variation in source dependencies means we're dirty
29462946 std::vector<FileInfo> sourceDependencies = parseSourceDependencies (
29472947 cppSourcePath_);
29482948 if (sourceDependencies != sourceDependencies_)
2949- return true ;
2949+ return true ; // #nocov
29502950
29512951 // not dirty
29522952 return false ;
@@ -2975,15 +2975,15 @@ namespace {
29752975 std::ofstream cppOfs (generatedCppSourcePath ().c_str (),
29762976 std::ofstream::out | std::ofstream::app);
29772977 if (cppOfs.fail ())
2978- throw Rcpp::file_io_error (generatedCppSourcePath ());
2978+ throw Rcpp::file_io_error (generatedCppSourcePath ()); // #nocov
29792979 cppOfs << generatedCpp_;
29802980 cppOfs.close ();
29812981
29822982 // generate R for attributes and write it into the build directory
29832983 std::ofstream rOfs (generatedRSourcePath ().c_str (),
29842984 std::ofstream::out | std::ofstream::trunc);
29852985 if (rOfs.fail ())
2986- throw Rcpp::file_io_error (generatedRSourcePath ());
2986+ throw Rcpp::file_io_error (generatedRSourcePath ()); // #nocov
29872987
29882988 // DLLInfo - hide using . and ensure uniqueness using contextId
29892989 std::string dllInfo = " `." + contextId_ + " _DLLInfo`" ;
@@ -3010,8 +3010,8 @@ namespace {
30103010 exportedFunctions_.push_back (it->exportedName ());
30113011
30123012 else if (it->name () == kDependsAttribute ) {
3013- for (size_t i = 0 ; i<it->params ().size (); ++i)
3014- depends_.push_back (it->params ()[i].name ());
3013+ for (size_t i = 0 ; i<it->params ().size (); ++i) // #nocov
3014+ depends_.push_back (it->params ()[i].name ()); // #nocov
30153015 }
30163016
30173017 else if (it->name () == kPluginsAttribute ) {
@@ -3043,7 +3043,7 @@ namespace {
30433043 for (size_t i = 0 ; i<sourceDependencies_.size (); ++i) {
30443044 FileInfo dep = sourceDependencies_[i];
30453045 if (dep.extension () == " .cc" || dep.extension () == " .cpp" ) {
3046- dependencies.push_back (dep.path ());
3046+ dependencies.push_back (dep.path ()); // #nocov
30473047 }
30483048 }
30493049 return dependencies;
@@ -3075,7 +3075,7 @@ namespace {
30753075
30763076 std::string previousDynlibPath () const {
30773077 if (!previousDynlibFilename_.empty ())
3078- return buildDirectory_ + fileSep_ + previousDynlibFilename_;
3078+ return buildDirectory_ + fileSep_ + previousDynlibFilename_; // #nocov
30793079 else
30803080 return std::string ();
30813081 }
@@ -3250,13 +3250,13 @@ BEGIN_RCPP
32503250
32513251 // if the cached dynlib is dirty then regenerate the source
32523252 else if (rebuild || dynlib.isSourceDirty ()) {
3253- buildRequired = true ;
3254- dynlib.regenerateSource (cacheDir);
3253+ buildRequired = true ; // #nocov
3254+ dynlib.regenerateSource (cacheDir); // #nocov
32553255 }
32563256
32573257 // if the dynlib hasn't yet been built then note that
32583258 else if (!dynlib.isBuilt ()) {
3259- buildRequired = true ;
3259+ buildRequired = true ; // #nocov
32603260 }
32613261
32623262 // save the dynlib to the cache
@@ -3359,7 +3359,7 @@ BEGIN_RCPP
33593359 std::string cppFile = cppFiles[i];
33603360 SourceFileAttributesParser attributes (cppFile, false );
33613361 if (!attributes.hasGeneratorOutput ())
3362- continue ;
3362+ continue ; // #nocov
33633363
33643364 // confirm we have attributes
33653365 haveAttributes = true ;
@@ -3371,8 +3371,8 @@ BEGIN_RCPP
33713371 for (SourceFileAttributesParser::const_iterator
33723372 it = attributes.begin (); it != attributes.end (); ++it) {
33733373 if (it->name () == kDependsAttribute ) {
3374- for (size_t i = 0 ; i<it->params ().size (); ++i)
3375- dependsAttribs.insert (it->params ()[i].name ());
3374+ for (size_t i = 0 ; i<it->params ().size (); ++i) // #nocov
3375+ dependsAttribs.insert (it->params ()[i].name ()); // #nocov
33763376 }
33773377 }
33783378 }
@@ -3385,7 +3385,7 @@ BEGIN_RCPP
33853385 if (haveAttributes)
33863386 updated = generators.commit (includes);
33873387 else
3388- updated = generators.remove ();
3388+ updated = generators.remove (); // #nocov
33893389
33903390 // print warning if there are depends attributes that don't have
33913391 // corresponding entries in the DESCRIPTION file
0 commit comments