aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2020-05-06 10:45:48 -0400
committerNick Mathewson <nickm@torproject.org>2020-05-06 16:53:40 -0400
commit28ac17f433d954355494989983005498c7fe9292 (patch)
tree67d3313f95eaa7630cfd055b5f5f0b2933cf6d99 /src/test
parentf954514b376e6edbe8b1faba0726bdb46acf7729 (diff)
downloadtor-28ac17f433d954355494989983005498c7fe9292.tar.gz
tor-28ac17f433d954355494989983005498c7fe9292.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.2 version.)
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test_socks.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/test/test_socks.c b/src/test/test_socks.c
index a4a768ce84..6d3ebd2320 100644
--- a/src/test/test_socks.c
+++ b/src/test/test_socks.c
@@ -778,7 +778,7 @@ test_socks_truncated(void *ptr)
for (i = 0; i < ARRAY_LENGTH(commands); ++i) {
for (j = 0; j < commands[i].len; ++j) {
switch (commands[i].setup) {
- default: /* Falls through */
+ default: FALLTHROUGH;
case NONE:
/* This test calls for no setup on the socks state. */
break;