Reply to topic

Howto get rid of all warnings when using libeigen with clang

brubelsabs
Registered Member
Posts
3
Karma
0
Hi,

our project uses libeigen for some linear algebra stuff. Generally we use g++ for compilation but clang++ would be fine too. When we compile with clang++ we get tons of compiler warnings inside of libeigen code. I will give some examples here:

Code: Select all
In file included from /usr/include/eigen3/Eigen/Core:334:
/usr/include/eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h:105:5: warning: explicitly assigning a variable of type 'std::ptrdiff_t' (aka 'long') to
      itself [-Wself-assign]
  n = n;
  ~ ^ ~

In file included from /usr/include/eigen3/Eigen/Core:346:
/usr/include/eigen3/Eigen/src/Core/BandMatrix.h:283:86: warning: unused parameter 'cols' [-Wunused-parameter]
    inline BandMatrixWrapper(const CoefficientsType& coeffs, Index rows=_Rows, Index cols=_Cols, Index supers=_Supers, Index subs=_Subs)


So is there a way to silence those warnings related to libeigen code while beeing verbose at our code? How do you handle such situations? Thanks for any suggestions and recommendations.
manuels
Registered Member
Posts
47
Karma
0
n=n is probably to avoid 'unused' warnings.
Qt for example avoids these warnings by using this macro:
Code: Select all
    #define Q_UNUSED(arg) (void)arg;

so you can use
Code: Select all
Q_UNUSED(n);


Maybe this is a good approach also for Eigen?
brubelsabs
Registered Member
Posts
3
Karma
0
As there are many diffrent warnings, not only related to self assignments, I thought there would be a better way to disable all warnings related to a certain lib...
dhlin
Registered Member
Posts
18
Karma
0
I also used clang++. My way of processing this is:

clang++ -isystem <the_eigen_path> .....

instead of

clang++ -I<the_eigen_path>

By using -isystem, the compiler will suppress all warnings arising from inside the files in the eigen directory. (The same trick also applies to g++)
brubelsabs
Registered Member
Posts
3
Karma
0
Great with CMake and this http://stackoverflow.com/questions/3371 ... with-cmake I got it running and now can focus only our code. Thanks for this hint.
jitseniesen
Registered Member
Posts
204
Karma
2
It would also be a good idea to upgrade Eigen. I think that the issues you are referring to were fixed in Eigen 3.0.2, released in August last year. The latest (stable) release is Eigen 3.0.5.

 
Reply to topic

Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], Clancularius, gfielding, Google [Bot], Sogou [Bot], Wolf Icefang, Yahoo [Bot]