Steffen Möller
unread,Sep 4, 2019, 8:19:05 AM9/4/19Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to last-...@googlegroups.com
Dear developers of LAST,
Thank you very much for your excellent work. With the very strict
compiler settings for Debian packaging, there is a warning raised that
you may decide to address:
g++ -Wdate-time -D_FORTIFY_SOURCE=2 -DHAS_CXX_THREADS -g -O2
-fdebug-prefix-map=/home/moeller/git/med-team/last-align/last-align=.
-fstack-protector-strong -Wformat -Werror=format-security -Wall -Wextra
-Wcast-qual -Wswitch-enum -Wundef -Wcast-align -Wno-long-long -ansi
-pedantic -std=c++11 -c -o alp/njn_localmaxstatutil.o
alp/njn_localmaxstatutil.cpp
In file included from alp/njn_matrix.hpp:43,
from alp/njn_localmaxstatutil.hpp:39,
from alp/njn_localmaxstatutil.cpp:37:
alp/njn_vector.hpp: In member function ‘virtual void
Njn::Vector<T>::free2()’:
alp/njn_vector.hpp:333:7: warning: this ‘if’ clause does not guard...
[-Wmisleading-indentation]
333 | if (getM () > 0) delete [] d_vector_p; d_vector_p = 0;
| ^~
alp/njn_vector.hpp:333:46: note: ...this statement, but the latter is
misleadingly indented as if it were guarded by the ‘if’
333 | if (getM () > 0) delete [] d_vector_p; d_vector_p = 0;
| ^~~~~~~~~~
In file included from alp/njn_localmaxstatutil.hpp:39,
from alp/njn_localmaxstatutil.cpp:37:
alp/njn_matrix.hpp: In member function ‘virtual void
Njn::Matrix<T>::free2()’:
alp/njn_matrix.hpp:600:9: warning: this ‘if’ clause does not guard...
[-Wmisleading-indentation]
600 | if (this->getM () > 0) delete [] d_matrix_p; d_matrix_p
= 0;
| ^~
alp/njn_matrix.hpp:600:54: note: ...this statement, but the latter is
misleadingly indented as if it were guarded by the ‘if’
600 | if (this->getM () > 0) delete [] d_matrix_p; d_matrix_p
= 0;
| ^~~~~~~~~~
These header files are included from many source files, so the warnings
are also appearing multiple times. The indentiation suggests that the
assignment of 0 is only intended when the value is not 0 and the memory
was just deallocated, when for real the assignment of 0 is also
performed when the value is 0 already - if not optimized away by the
compiler.
So, while not a functional change, it would nonetheless just look nice
to avoid that warning - it is the only warnings in the whole code base,
nice work, indeed.
With kind regards,
Steffen Möller