Skip to content

compiler warning from DataFrame.h when including Rcpp #1137

@kevinushey

Description

@kevinushey

I saw this while compiling reticulate with latest Rcpp on macOS:

In file included from python.cpp:4:
In file included from /Users/kevinushey/Library/R/4.0/library/Rcpp/include/Rcpp.h:57:
/Users/kevinushey/Library/R/4.0/library/Rcpp/include/Rcpp/DataFrame.h:136:18: warning: unused variable 'data' [-Wunused-variable]
            SEXP data = Parent::get__();
                 ^

And indeed, data is read but never used here:

void set_type_after_push(){
int max_rows = 0;
bool invalid_column_size = false;
SEXP data = Parent::get__();
List::iterator it;
// Get the maximum number of rows
for (it = Parent::begin(); it != Parent::end(); ++it) {
if (Rf_xlength(*it) > max_rows) {
max_rows = Rf_xlength(*it);
}
}
for (it = Parent::begin(); it != Parent::end(); ++it) {
if (Rf_xlength(*it) == 0 || ( Rf_xlength(*it) > 1 && max_rows % Rf_xlength(*it) != 0 )) {
// We have a column that is not an integer fraction of the largest
invalid_column_size = true;
}
}
if (invalid_column_size) {
warning("Column sizes are not equal in DataFrame::push_back, object degrading to List\n");
} else {
set__(Parent::get__());
}
}

Looks like it was introduced with d800e2a. I think we can just remove the offending line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions