OpenModelica / OMTLMSimulator

5 stars 14 forks source link

Deprecation warnings #132

Open AnHeuermann opened 2 years ago

AnHeuermann commented 2 years ago

While compiling OMTLMSimulator from OMSimulator I get a bunch of warnings. Some of them are errors under C++17.

clang++ -fPIC    -I../include   -c g2c_w32.c -o LINUX64/g2c_w32.o 
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
In file included from ../3rdParty/misc/include/coordTransform.h:599:
../3rdParty/misc/include/coordTransform.icc:149:5: warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register]
    register double tmp;
    ^~~~~~~~~
1 warning generated.
make[3]: Entering directory '/home/aheuermann1/workspace/OMSimulator/OMTLMSimulator/FMIWrapper'
clang++  -std=c++11 -fPIC -pipe -O2 -frtti -Wall -Wextra -fexceptions -DUNICODE -DINTERFACE_TYPES -I. -I"../FMIWrapper" -I"../../3rdParty/FMIL/install/linux/include" -I"../../3rdParty/RegEx" -I"../common" -I"../3rdParty/misc/include" -I"cvode-2.9.0/include" -I"ida-2.9.0/include" -c ../3rdParty/misc/src/double33s.cc -o LINUX64/double33s.o
In file included from ../3rdParty/misc/src/double33s.cc:10:
In file included from ../3rdParty/misc/include/double33s.h:292:
../3rdParty/misc/include/float33s.h:68:22: warning: definition of implicit copy constructor for 'float33s' is deprecated because it has a user-declared copy assignment operator [-Wdeprecated-copy]
    inline float33s& operator=(const float33s& m) ;
                     ^
../3rdParty/misc/include/float33s.inc:28:12: note: in implicit copy constructor for 'float33s' first required here
    return float33s(a.x11+b.x11,a.x22+b.x22,a.x33+b.x33,a.x12+b.x12,a.x23+b.x23,a.x13+b.x13);
           ^
../3rdParty/misc/src/double33s.cc:15:22: warning: unused function 'sqr' [-Wunused-function]
static inline double sqr(const double x) { return x * x; }
                     ^
2 warnings generated.

I have CC=clang, CXX=clang++ defined.


OS: Ubuntu 20.04 OMTLMSimulator: cceb7be

perost commented 2 years ago

The solution for the second error is to just remove the assignment operator in float33s.inc, because the class doesn't need it and it it breaks the rule of three. It's a third party library though, so it might be that it should be updated to a never version instead of fixing it on our side.

AnHeuermann commented 2 years ago

I think I found the error for the first warning: https://github.com/OpenModelica/OMSimulator/blob/master/Makefile#L131

AnHeuermann commented 2 years ago

@perost Do you know where the 3rdParty stuff is coming from? misc doesn't tell me much and I don't find anything for double33.

perost commented 2 years ago

@perost Do you know where the 3rdParty stuff is coming from? misc doesn't tell me much and I don't find anything for double33.

double33s.cc contains the comment:

// The eigenvalue/eigensystem solvers are rewritten in C++/lightmat interface by I.Nakhimovski from:
// Joachim Kopp
// Numerical diagonalization of hermitian 3x3 matrices
// arXiv.org preprint: physics/0610206
// http://www.mpi-hd.mpg.de/~jkopp/3x3/

But the link is dead, and it seems the actual C++ code was written by someone else anyway.

AnHeuermann commented 2 years ago

Do you think this could be the cause for segmentation faults described in https://github.com/OpenModelica/OMSimulator/issues/1099#issue-1060261911?

perost commented 2 years ago

Do you think this could be the cause for segmentation faults described in OpenModelica/OMSimulator#1099 (comment)?

No, it's just a warning that relying on the compiler to generate a copy constructor in that situation is deprecated, but the compiler will still do it.