From: Charlie Somerville Date: 2013-10-10T11:43:27-04:00 Subject: [ruby-core:57815] Re: ruby-2.0.0-p247siphash.c:443: bug report --5256cb1f_74b0dc51_14e38 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline It looks like the case fallthrough here is intended. On Thursday, 10 October 2013 at 10:43 AM, David Binderman wrote: > Hello there, > > I just ran the static analysis tool cppcheck over the source code > of ruby-2.0.0-p247 > > It said > > [siphash.c:443] -> [siphash.c:445]: (warning) Variable 'last' is reassigned a value before the old one has been used. 'break;' missing? > [siphash.c:445] -> [siphash.c:447]: (warning) Variable 'last' is reassigned a value before the old one has been used. 'break;' missing? > [siphash.c:447] -> [siphash.c:460]: (warning) Variable 'last' is reassigned a value before the old one has been used. 'break;' missing? > [siphash.c:460] -> [siphash.c:462]: (warning) Variable 'last' is reassigned a value before the old one has been used. 'break;' missing? > [siphash.c:462] -> [siphash.c:464]: (warning) Variable 'last' is reassigned a value before the old one has been used. 'break;' missing? > > Source code is > > switch (len % sizeof(uint64_t)) { > case 7: > OR_BYTE(6); > case 6: > OR_BYTE(5); > case 5: > OR_BYTE(4); > > Suggest add some break statements. > > Regards > > David Binderman --5256cb1f_74b0dc51_14e38 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
It looks like the case fallthrough here is intended.
=20

On Thursday, 10 Octobe= r 2013 at 10:43 AM, David Binderman wrote:

Hello there,

I just ran the static analysis tool cppcheck over the source code
of ruby-2.0.0-p247

It said
=5Bsiphash.c:443=5D -> =5Bsiphash.c:445=5D: (warning) Var= iable 'last' is reassigned a value before the old one has been used. 'bre= ak;' missing=3F
=5Bsiphash.c:445=5D -> =5Bsiphash.c:447=5D: = (warning) Variable 'last' is reassigned a value before the old one has be= en used. 'break;' missing=3F
=5Bsiphash.c:447=5D -> =5Bsipha= sh.c:460=5D: (warning) Variable 'last' is reassigned a value before the o= ld one has been used. 'break;' missing=3F
=5Bsiphash.c:460=5D -= > =5Bsiphash.c:462=5D: (warning) Variable 'last' is reassigned a value= before the old one has been used. 'break;' missing=3F
=5Bsipha= sh.c:462=5D -> =5Bsiphash.c:464=5D: (warning) Variable 'last' is reass= igned a value before the old one has been used. 'break;' missing=3F
=

Source code is

  &= nbsp; switch (len % sizeof(uint64=5Ft)) =7B
    = case 7:
        OR=5FBYTE(6)= ;
    case 6:
    =     OR=5FBYTE(5);
    case 5:
        OR=5FBYTE(4);

Suggest add some break statements.

Regards

David Binderman
=20 =20 =20 =20
=20

--5256cb1f_74b0dc51_14e38--