Opened 9 years ago

Closed 9 years ago

#9115 closed Bugs (fixed)

Warnings in mersenne twister and lagged fibonacci with -Wshadow on clang

Reported by: Mathias Gaunard Owned by: No-Maintainer
Milestone: To Be Determined Component: random
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description (last modified by Mathias Gaunard)

/home/nt2/dev/boost/trunk/boost/random/mersenne_twister.hpp:237:59: warning: declaration shadows a field of 'mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>' [-Wshadow]
    friend bool operator==(const mersenne_twister_engine& x,
                                                          ^
/home/nt2/dev/boost/trunk/boost/random/mersenne_twister.hpp:376:14: note: previous declaration is here
    UIntType x[n]; 
             ^
/home/nt2/dev/boost/trunk/boost/random/mersenne_twister.hpp:247:59: warning: declaration shadows a field of 'mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>' [-Wshadow]
    friend bool operator!=(const mersenne_twister_engine& x,
                                                          ^
/home/nt2/dev/boost/trunk/boost/random/mersenne_twister.hpp:376:14: note: previous declaration is here
    UIntType x[n]; 
             ^
In file included from /home/nt2/dev/nt2/modules/core/random/src/rand/randstream.cpp:10:
In file included from /home/nt2/dev/nt2/modules/core/random/include/nt2/core/utility/randstream.hpp:14:
/home/nt2/dev/boost/trunk/boost/random/lagged_fibonacci.hpp:146:26: warning: declaration shadows a field of 'lagged_fibonacci_engine<UIntType, w, p, q>' [-Wshadow]
        for(unsigned int i = 0; i < f.long_lag; ++i)
                         ^
/home/nt2/dev/boost/trunk/boost/random/lagged_fibonacci.hpp:180:18: note: previous declaration is here
    unsigned int i;
                 ^
/home/nt2/dev/boost/trunk/boost/random/lagged_fibonacci.hpp:157:26: warning: declaration shadows a field of 'lagged_fibonacci_engine<UIntType, w, p, q>' [-Wshadow]
        for(unsigned int i = 0; i < f.long_lag; ++i)
                         ^
/home/nt2/dev/boost/trunk/boost/random/lagged_fibonacci.hpp:180:18: note: previous declaration is here
    unsigned int i;
                 ^
/home/nt2/dev/boost/trunk/boost/random/lagged_fibonacci.hpp:166:68: warning: declaration shadows a field of 'lagged_fibonacci_engine<UIntType, w, p, q>' [-Wshadow]
    BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR(lagged_fibonacci_engine, x, y)
                                                                   ^
/home/nt2/dev/boost/trunk/boost/random/detail/operators.hpp:75:37: note: expanded from macro 'BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR'
    friend bool operator==(const T& lhs, const T& rhs)
                                    ^
/home/nt2/dev/boost/trunk/boost/random/lagged_fibonacci.hpp:181:14: note: previous declaration is here
    UIntType x[long_lag];
             ^
/home/nt2/dev/boost/trunk/boost/random/lagged_fibonacci.hpp:357:26: warning: declaration shadows a field of 'lagged_fibonacci_01_engine<RealType, w, p, q>' [-Wshadow]
        for(unsigned int i = 0; i < f.long_lag; ++i)
                         ^
/home/nt2/dev/boost/trunk/boost/random/lagged_fibonacci.hpp:399:18: note: previous declaration is here
    unsigned int i;
                 ^
/home/nt2/dev/boost/trunk/boost/random/lagged_fibonacci.hpp:369:26: warning: declaration shadows a field of 'lagged_fibonacci_01_engine<RealType, w, p, q>' [-Wshadow]
        for(unsigned int i = 0; i < f.long_lag; ++i) {
                         ^
/home/nt2/dev/boost/trunk/boost/random/lagged_fibonacci.hpp:399:18: note: previous declaration is here
    unsigned int i;
                 ^
/home/nt2/dev/boost/trunk/boost/random/lagged_fibonacci.hpp:381:71: warning: declaration shadows a field of 'lagged_fibonacci_01_engine<RealType, w, p, q>' [-Wshadow]
    BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR(lagged_fibonacci_01_engine, x, y)
                                                                      ^
/home/nt2/dev/boost/trunk/boost/random/detail/operators.hpp:75:37: note: expanded from macro 'BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR'
    friend bool operator==(const T& lhs, const T& rhs)
                                    ^
/home/nt2/dev/boost/trunk/boost/random/lagged_fibonacci.hpp:400:14: note: previous declaration is here
    RealType x[long_lag];
             ^
8 warnings generated.

Attachments (1)

boost_random_shadow_warning_fix.diff (3.9 KB ) - added by Mathias Gaunard 9 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 by Mathias Gaunard, 9 years ago

Description: modified (diff)

by Mathias Gaunard, 9 years ago

comment:2 by Mathias Gaunard, 9 years ago

Resolution: fixed
Status: newclosed

(In [86321]) random: avoid generating warnings with -Wshadow, fix #9115

comment:3 by Mathias Gaunard, 9 years ago

Checked in trunk revision 86321

leaving open until merged to release

Last edited 9 years ago by Mathias Gaunard (previous) (diff)

comment:4 by Mathias Gaunard, 9 years ago

Resolution: fixed
Status: closedreopened

comment:5 by Steven Watanabe, 9 years ago

Resolution: fixed
Status: reopenedclosed

I merged this to master.

Note: See TracTickets for help on using tickets.