Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings regarding int-type variables #3026

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions models/correlomatrix_detector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,11 @@
count_covariance_.clear();
count_covariance_.resize( p.N_channels_ );

for ( long i = 0; i < p.N_channels_; ++i )
for ( decltype( p.N_channels_ ) i = 0; i < p.N_channels_; ++i )
{
covariance_[ i ].resize( p.N_channels_ );
count_covariance_[ i ].resize( p.N_channels_ );
for ( long j = 0; j < p.N_channels_; ++j )
for ( decltype( p.N_channels_ ) j = 0; j < p.N_channels_; ++j )
{
covariance_[ i ][ j ].resize( 1 + p.tau_max_.get_steps() / p.delta_tau_.get_steps(), 0 );
count_covariance_[ i ][ j ].resize( 1 + p.tau_max_.get_steps() / p.delta_tau_.get_steps(), 0 );
Expand Down Expand Up @@ -349,18 +349,19 @@
for ( SpikelistType::const_iterator spike_j = otherSpikes.begin(); spike_j != otherSpikes.end(); ++spike_j )
{
size_t bin;
long other = spike_j->receptor_channel_;
long sender_ind, other_ind;
decltype( sender ) other = spike_j->receptor_channel_;
decltype( sender ) sender_ind = 0;
decltype( sender ) other_ind = 0;

if ( spike_i < spike_j->timestep_ )
{
sender_ind = other;

Check failure on line 358 in models/correlomatrix_detector.cpp

View workflow job for this annotation

GitHub Actions / build_macos (macos-latest, clang, openmp, mpi, python, gsl, ltdl, boost, hdf5, optimize, warning)

cannot assign to variable 'sender_ind' with const-qualified type 'decltype(sender)' (aka 'const unsigned long')

Check failure on line 358 in models/correlomatrix_detector.cpp

View workflow job for this annotation

GitHub Actions / build_linux (ubuntu-22.04, gcc, boost, optimize, warning)

assignment of read-only variable ‘sender_ind’

Check failure on line 358 in models/correlomatrix_detector.cpp

View workflow job for this annotation

GitHub Actions / build_linux (ubuntu-22.04, gcc, openmp, python, gsl, ltdl, boost, optimize, warning)

assignment of read-only variable ‘sender_ind’

Check failure on line 358 in models/correlomatrix_detector.cpp

View workflow job for this annotation

GitHub Actions / build_linux (ubuntu-22.04, gcc, mpi, python, gsl, ltdl, boost, optimize, warning)

assignment of read-only variable ‘sender_ind’

Check failure on line 358 in models/correlomatrix_detector.cpp

View workflow job for this annotation

GitHub Actions / build_linux (ubuntu-22.04, gcc, openmp, mpi, python, gsl, ltdl, boost, hdf5, sionlib, libneurosim...

assignment of read-only variable ‘sender_ind’
other_ind = sender;

Check failure on line 359 in models/correlomatrix_detector.cpp

View workflow job for this annotation

GitHub Actions / build_macos (macos-latest, clang, openmp, mpi, python, gsl, ltdl, boost, hdf5, optimize, warning)

cannot assign to variable 'other_ind' with const-qualified type 'decltype(sender)' (aka 'const unsigned long')

Check failure on line 359 in models/correlomatrix_detector.cpp

View workflow job for this annotation

GitHub Actions / build_linux (ubuntu-22.04, gcc, boost, optimize, warning)

assignment of read-only variable ‘other_ind’

Check failure on line 359 in models/correlomatrix_detector.cpp

View workflow job for this annotation

GitHub Actions / build_linux (ubuntu-22.04, gcc, openmp, python, gsl, ltdl, boost, optimize, warning)

assignment of read-only variable ‘other_ind’

Check failure on line 359 in models/correlomatrix_detector.cpp

View workflow job for this annotation

GitHub Actions / build_linux (ubuntu-22.04, gcc, mpi, python, gsl, ltdl, boost, optimize, warning)

assignment of read-only variable ‘other_ind’

Check failure on line 359 in models/correlomatrix_detector.cpp

View workflow job for this annotation

GitHub Actions / build_linux (ubuntu-22.04, gcc, openmp, mpi, python, gsl, ltdl, boost, hdf5, sionlib, libneurosim...

assignment of read-only variable ‘other_ind’
}
else
{
sender_ind = sender;

Check failure on line 363 in models/correlomatrix_detector.cpp

View workflow job for this annotation

GitHub Actions / build_macos (macos-latest, clang, openmp, mpi, python, gsl, ltdl, boost, hdf5, optimize, warning)

cannot assign to variable 'sender_ind' with const-qualified type 'decltype(sender)' (aka 'const unsigned long')

Check failure on line 363 in models/correlomatrix_detector.cpp

View workflow job for this annotation

GitHub Actions / build_linux (ubuntu-22.04, gcc, boost, optimize, warning)

assignment of read-only variable ‘sender_ind’

Check failure on line 363 in models/correlomatrix_detector.cpp

View workflow job for this annotation

GitHub Actions / build_linux (ubuntu-22.04, gcc, openmp, python, gsl, ltdl, boost, optimize, warning)

assignment of read-only variable ‘sender_ind’

Check failure on line 363 in models/correlomatrix_detector.cpp

View workflow job for this annotation

GitHub Actions / build_linux (ubuntu-22.04, gcc, mpi, python, gsl, ltdl, boost, optimize, warning)

assignment of read-only variable ‘sender_ind’

Check failure on line 363 in models/correlomatrix_detector.cpp

View workflow job for this annotation

GitHub Actions / build_linux (ubuntu-22.04, gcc, openmp, mpi, python, gsl, ltdl, boost, hdf5, sionlib, libneurosim...

assignment of read-only variable ‘sender_ind’
other_ind = other;

Check failure on line 364 in models/correlomatrix_detector.cpp

View workflow job for this annotation

GitHub Actions / build_macos (macos-latest, clang, openmp, mpi, python, gsl, ltdl, boost, hdf5, optimize, warning)

cannot assign to variable 'other_ind' with const-qualified type 'decltype(sender)' (aka 'const unsigned long')

Check failure on line 364 in models/correlomatrix_detector.cpp

View workflow job for this annotation

GitHub Actions / build_linux (ubuntu-22.04, gcc, boost, optimize, warning)

assignment of read-only variable ‘other_ind’

Check failure on line 364 in models/correlomatrix_detector.cpp

View workflow job for this annotation

GitHub Actions / build_linux (ubuntu-22.04, gcc, openmp, python, gsl, ltdl, boost, optimize, warning)

assignment of read-only variable ‘other_ind’

Check failure on line 364 in models/correlomatrix_detector.cpp

View workflow job for this annotation

GitHub Actions / build_linux (ubuntu-22.04, gcc, mpi, python, gsl, ltdl, boost, optimize, warning)

assignment of read-only variable ‘other_ind’

Check failure on line 364 in models/correlomatrix_detector.cpp

View workflow job for this annotation

GitHub Actions / build_linux (ubuntu-22.04, gcc, openmp, mpi, python, gsl, ltdl, boost, hdf5, sionlib, libneurosim...

assignment of read-only variable ‘other_ind’
}

if ( sender_ind <= other_ind )
Expand Down
2 changes: 1 addition & 1 deletion models/correlospinmatrix_detector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ nest::correlospinmatrix_detector::handle( SpikeEvent& e )
// yet every impulse in the queue that is further in the past than
// this minimum - tau_max cannot contribute to the count covariance
long t_min_on = t_i_on;
for ( int n = 0; n < P_.N_channels_; n++ )
for ( decltype( P_.N_channels_ ) n = 0; n < P_.N_channels_; n++ )
{
if ( S_.curr_state_[ n ] )
{
Expand Down
Loading