[Rcpp-devel] Warnings in build of RcppArmadillo project

Simon Zehnder szehnder at uni-bonn.de
Wed Jun 5 16:23:38 CEST 2013


Hi Rcpp-Users and Rcpp-Devels,

I just build an RcppArmadillo project on my computer using gcc-4.8.1 and the newest Version of RcppArmadillo. I got some warnings I cannot explain to myself. It builds the library and installs it. Nevertheless I would like to know more about my warnings: 

In file included from /Library/Frameworks/R.framework/Versions/3.0/Resources/library/RcppArmadillo/include/armadillo:397:0,
                 from /Library/Frameworks/R.framework/Versions/3.0/Resources/library/RcppArmadillo/include/RcppArmadilloForward.h:36,
                 from /Library/Frameworks/R.framework/Versions/3.0/Resources/library/RcppArmadillo/include/RcppArmadillo.h:29,
                 from FinmixModel.cc:14:
/Library/Frameworks/R.framework/Versions/3.0/Resources/library/RcppArmadillo/include/armadillo_bits/fn_as_scalar.hpp: In static member function ‘static typename T1::elem_type arma::as_scalar_redirect<N>::apply(const T1&)’:
/Library/Frameworks/R.framework/Versions/3.0/Resources/library/RcppArmadillo/include/armadillo_bits/fn_as_scalar.hpp:48:34: warning: typedef ‘eT’ locally defined but not used [-Wunused-local-typedefs]
   typedef typename T1::elem_type eT;
                                  ^
/Library/Frameworks/R.framework/Versions/3.0/Resources/library/RcppArmadillo/include/armadillo_bits/fn_as_scalar.hpp: In function ‘typename T1::elem_type arma::as_scalar(const arma::Base<typename T1::elem_type, T1>&)’:
/Library/Frameworks/R.framework/Versions/3.0/Resources/library/RcppArmadillo/include/armadillo_bits/fn_as_scalar.hpp:320:34: warning: typedef ‘eT’ locally defined but not used [-Wunused-local-typedefs]
   typedef typename T1::elem_type eT;
                                  ^
In file included from /Library/Frameworks/R.framework/Versions/3.0/Resources/library/RcppArmadillo/include/armadillo:397:0,
                 from /Library/Frameworks/R.framework/Versions/3.0/Resources/library/RcppArmadillo/include/RcppArmadilloForward.h:36,
                 from /Library/Frameworks/R.framework/Versions/3.0/Resources/library/RcppArmadillo/include/RcppArmadillo.h:29,
                 from FinmixModel.cc:14:
/Library/Frameworks/R.framework/Versions/3.0/Resources/library/RcppArmadillo/include/armadillo_bits/fn_as_scalar.hpp: In function ‘typename T1::elem_type arma::as_scalar(const arma::BaseCube<typename T1::elem_type, T1>&)’:
/Library/Frameworks/R.framework/Versions/3.0/Resources/library/RcppArmadillo/include/armadillo_bits/fn_as_scalar.hpp:384:34: warning: typedef ‘eT’ locally defined but not used [-Wunused-local-typedefs]
   typedef typename T1::elem_type eT;
                                  ^
In file included from /Library/Frameworks/R.framework/Versions/3.0/Resources/library/Rcpp/include/Rcpp/Module.h:352:0,
                 from /Library/Frameworks/R.framework/Versions/3.0/Resources/library/Rcpp/include/Rcpp.h:63,
                 from /Library/Frameworks/R.framework/Versions/3.0/Resources/library/RcppArmadillo/include/RcppArmadillo.h:30,
                 from FinmixModel.cc:14:
/Library/Frameworks/R.framework/Versions/3.0/Resources/library/Rcpp/include/Rcpp/module/class.h: In member function ‘Rcpp::class_<Class>::self& Rcpp::class_<Class>::derives(const char*)’:
/Library/Frameworks/R.framework/Versions/3.0/Resources/library/Rcpp/include/Rcpp/module/class.h:495:56: warning: typedef ‘parent_prop_class’ locally defined but not used [-Wunused-local-typedefs]
             typedef typename parent_class_::prop_class parent_prop_class ;

The FinmixModel class looks like:

HEADER:
#include <RcppArmadillo.h>
// [[Rcpp::depends(RcppArmadillo)]]

#include <string>

class FinmixModel {

        public:
                Rcpp::List parList;
                arma::rowvec weightV;
                arma::uvec tV;

                bool indicFix;
                unsigned int K;
                unsigned int r;

                /* ctor */
                FinmixModel(const Rcpp::S4& classS4);
                /* dtor */
                ~FinmixModel();
};

CC:
#include <RcppArmadillo.h>
#include "FinmixModel.h"

FinmixModel::FinmixModel(const Rcpp::S4& classS4) {

        /**
         * As the parameters 'par' can have very differing implementations
         * they are kept in a general Rcpp::List object which is then
         * decomposed in main code.
         *
         */
        parList  = classS4.slot("par");
        weightV  = Rcpp::as<arma::mat>(classS4.slot("weight"));

        /**
         * 'T' can be 'NA' if the model has no repetitions (Binomial)
         * in this case this attribute is set to an 1 x 1 vector
         *
         */
        tV       = Rcpp::as<arma::uvec>(classS4.slot("T"));
        indicFix = Rcpp::as<bool>(classS4.slot("indicfix"));
        K        = Rcpp::as<unsigned int>(classS4.slot("K"));
        r        = Rcpp::as<unsigned int>(classS4.slot("r"));
}

FinmixModel::~FinmixModel(){}

From looking into the files RcppArmadilloForward.h, fn_as_scalar.hpp and class.h it seems that there is something about typedefs, but I am not sure. It seems to me just not right, that all these warnings occur in my build output. 


Best

Simon


More information about the Rcpp-devel mailing list