diff options
author | Nick Mathewson <nickm@torproject.org> | 2020-05-06 10:45:48 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2020-05-06 16:55:25 -0400 |
commit | c116728209e4ece3249564208e9387f67192a7f6 (patch) | |
tree | 709e04b04039446a6e050c0b14934e48e256177c /src/ext/csiphash.c | |
parent | a1365b91ff43e6e520b9a881f720767418daccf6 (diff) | |
download | tor-c116728209e4ece3249564208e9387f67192a7f6.tar.gz tor-c116728209e4ece3249564208e9387f67192a7f6.zip |
Use __attribute__((fallthrough)) rather than magic GCC comments.
GCC added an implicit-fallthrough warning a while back, where it
would complain if you had a nontrivial "case:" block that didn't end
with break, return, or something like that. Clang recently added
the same thing.
GCC, however, would let you annotate a fall-through as intended by
any of various magic "/* fall through */" comments. Clang, however,
only seems to like "__attribute__((fallthrough))". Fortunately, GCC
accepts that too.
A previous commit in this branch defined a FALLTHROUGH macro to do
the right thing if GNUC is defined; here we replace all of our "fall
through" comments with uses of that macro.
This is an automated commit, made with the following perl one-liner:
#!/usr/bin/perl -i -p
s#/\* *falls? ?thr.*?\*/#FALLTHROUGH;#i;
(In order to avoid conflicts, I'm applying this script separately to
each maint branch. This is the 0.4.3 version.)
Diffstat (limited to 'src/ext/csiphash.c')
-rw-r--r-- | src/ext/csiphash.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/ext/csiphash.c b/src/ext/csiphash.c index faa52ae4e1..e0f5b2e5c9 100644 --- a/src/ext/csiphash.c +++ b/src/ext/csiphash.c @@ -95,13 +95,13 @@ uint64_t siphash24(const void *src, unsigned long src_sz, const struct sipkey *k } #else switch (src_sz - blocks) { - case 7: last7 |= (uint64_t)m[i + 6] << 48; /* Falls through. */ - case 6: last7 |= (uint64_t)m[i + 5] << 40; /* Falls through. */ - case 5: last7 |= (uint64_t)m[i + 4] << 32; /* Falls through. */ - case 4: last7 |= (uint64_t)m[i + 3] << 24; /* Falls through. */ - case 3: last7 |= (uint64_t)m[i + 2] << 16; /* Falls through. */ - case 2: last7 |= (uint64_t)m[i + 1] << 8; /* Falls through. */ - case 1: last7 |= (uint64_t)m[i + 0] ; /* Falls through. */ + case 7: last7 |= (uint64_t)m[i + 6] << 48; FALLTHROUGH; + case 6: last7 |= (uint64_t)m[i + 5] << 40; FALLTHROUGH; + case 5: last7 |= (uint64_t)m[i + 4] << 32; FALLTHROUGH; + case 4: last7 |= (uint64_t)m[i + 3] << 24; FALLTHROUGH; + case 3: last7 |= (uint64_t)m[i + 2] << 16; FALLTHROUGH; + case 2: last7 |= (uint64_t)m[i + 1] << 8; FALLTHROUGH; + case 1: last7 |= (uint64_t)m[i + 0] ; FALLTHROUGH; case 0: default:; } |