Skip to content

Commit 554c9f8

Browse files
committed
Misc places : Add [[fallthrough]] where appropriate
1 parent aebe1de commit 554c9f8

File tree

3 files changed

+26
-9
lines changed

3 files changed

+26
-9
lines changed

include/IECore/MurmurHash.inl

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,23 +125,37 @@ inline void MurmurHash::appendRaw( const void *data, size_t bytes, int elementSi
125125
switch( bytes & 15)
126126
{
127127
case 15: k2 ^= uint64_t(tail[14]) << 48;
128+
[[fallthrough]];
128129
case 14: k2 ^= uint64_t(tail[13]) << 40;
130+
[[fallthrough]];
129131
case 13: k2 ^= uint64_t(tail[12]) << 32;
132+
[[fallthrough]];
130133
case 12: k2 ^= uint64_t(tail[11]) << 24;
134+
[[fallthrough]];
131135
case 11: k2 ^= uint64_t(tail[10]) << 16;
136+
[[fallthrough]];
132137
case 10: k2 ^= uint64_t(tail[ 9]) << 8;
138+
[[fallthrough]];
133139
case 9: k2 ^= uint64_t(tail[ 8]) << 0;
134-
k2 *= c2; k2 = rotl64(k2,33); k2 *= c1; h2 ^= k2;
140+
k2 *= c2; k2 = rotl64(k2,33); k2 *= c1; h2 ^= k2;
141+
[[fallthrough]];
135142

136143
case 8: k1 ^= uint64_t(tail[ 7]) << 56;
144+
[[fallthrough]];
137145
case 7: k1 ^= uint64_t(tail[ 6]) << 48;
146+
[[fallthrough]];
138147
case 6: k1 ^= uint64_t(tail[ 5]) << 40;
148+
[[fallthrough]];
139149
case 5: k1 ^= uint64_t(tail[ 4]) << 32;
150+
[[fallthrough]];
140151
case 4: k1 ^= uint64_t(tail[ 3]) << 24;
152+
[[fallthrough]];
141153
case 3: k1 ^= uint64_t(tail[ 2]) << 16;
154+
[[fallthrough]];
142155
case 2: k1 ^= uint64_t(tail[ 1]) << 8;
156+
[[fallthrough]];
143157
case 1: k1 ^= uint64_t(tail[ 0]) << 0;
144-
k1 *= c1; k1 = rotl64(k1,31); k1 *= c2; h1 ^= k1;
158+
k1 *= c1; k1 = rotl64(k1,31); k1 *= c2; h1 ^= k1;
145159
};
146160

147161
// finalisation

include/IECore/StringAlgo.inl

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,11 @@ inline bool matchCharacterClass( char c, const char *&pattern )
7676
}
7777
continue;
7878
}
79-
else
80-
{
81-
// The '-' was at the start or end of the
82-
// pattern, fall through to treat it
83-
// as a regular character below.
84-
}
79+
80+
// The '-' was at the start or end of the
81+
// pattern, fall through to treat it
82+
// as a regular character below.
83+
[[fallthrough]];
8584
default :
8685
if( d == c )
8786
{
@@ -160,7 +159,7 @@ inline bool matchInternal( const char *s, const char *&pattern, bool spaceTermin
160159
return *s == '\0';
161160
}
162161
// Fall through to default
163-
162+
[[fallthrough]];
164163
default :
165164

166165
if( c != *s++ )

src/IECoreScene/PDCParticleWriter.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ void PDCParticleWriter::doWrite( const CompoundObject *operands )
188188
castOp.targetTypeParameter()->setNumericValue( DoubleVectorDataTypeId );
189189
attr = boost::static_pointer_cast<DoubleVectorData>( castOp.operate() );
190190
} // intentionally falling through
191+
[[fallthrough]];
191192
case DoubleVectorDataTypeId :
192193
{
193194
int type = 3; type = asBigEndian( type );
@@ -204,6 +205,7 @@ void PDCParticleWriter::doWrite( const CompoundObject *operands )
204205
castOp.targetTypeParameter()->setNumericValue( V3dVectorDataTypeId );
205206
attr = boost::static_pointer_cast<V3dVectorData>( castOp.operate() );
206207
} // intentionally falling through
208+
[[fallthrough]];
207209
case V3dVectorDataTypeId :
208210
{
209211
int type = 5; type = asBigEndian( type );
@@ -227,6 +229,7 @@ void PDCParticleWriter::doWrite( const CompoundObject *operands )
227229
castOp.targetTypeParameter()->setNumericValue( DoubleDataTypeId );
228230
attr = boost::static_pointer_cast<DoubleData>( castOp.operate() );
229231
} // intentionally falling through
232+
[[fallthrough]];
230233
case DoubleDataTypeId :
231234
{
232235
int type = 2; type = asBigEndian( type );
@@ -243,6 +246,7 @@ void PDCParticleWriter::doWrite( const CompoundObject *operands )
243246
castOp.targetTypeParameter()->setNumericValue( V3dDataTypeId );
244247
attr = boost::static_pointer_cast<V3dData>( castOp.operate() );
245248
} // intentionally falling through
249+
[[fallthrough]];
246250
case V3dDataTypeId :
247251
{
248252
int type = 4; type = asBigEndian( type );

0 commit comments

Comments
 (0)