summaryrefslogtreecommitdiff
path: root/src/feature
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:51:11 -0400
commitcc397449fca8fb1559db3a790dffcd1e8046e86b (patch)
tree9ed93910dcd172f71d3b369a62b5e25ce370e962 /src/feature
parent78a72f8196505e28a5a823f24fdb74f36dc26845 (diff)
downloadtor-cc397449fca8fb1559db3a790dffcd1e8046e86b.tar.gz
tor-cc397449fca8fb1559db3a790dffcd1e8046e86b.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;
Diffstat (limited to 'src/feature')
-rw-r--r--src/feature/client/entrynodes.c2
-rw-r--r--src/feature/control/control.c2
-rw-r--r--src/feature/dirclient/dirclient.c2
-rw-r--r--src/feature/dirparse/parsecommon.c2
-rw-r--r--src/feature/relay/dns.c2
-rw-r--r--src/feature/rend/rendclient.c2
6 files changed, 6 insertions, 6 deletions
diff --git a/src/feature/client/entrynodes.c b/src/feature/client/entrynodes.c
index 1bfb62538e..7c2159ce84 100644
--- a/src/feature/client/entrynodes.c
+++ b/src/feature/client/entrynodes.c
@@ -2263,7 +2263,7 @@ entry_guards_note_guard_success(guard_selection_t *gs,
break;
default:
tor_assert_nonfatal_unreached();
- /* Fall through. */
+ FALLTHROUGH;
case GUARD_CIRC_STATE_USABLE_IF_NO_BETTER_GUARD:
if (guard->is_primary) {
/* XXXX #20832 -- I don't actually like this logic. It seems to make
diff --git a/src/feature/control/control.c b/src/feature/control/control.c
index cc7ecff2ff..26ac12d307 100644
--- a/src/feature/control/control.c
+++ b/src/feature/control/control.c
@@ -4934,7 +4934,7 @@ handle_control_add_onion(control_connection_t *conn,
case RSAE_BADAUTH:
connection_printf_to_buf(conn, "512 Invalid client authorization\r\n");
break;
- case RSAE_INTERNAL: /* FALLSTHROUGH */
+ case RSAE_INTERNAL: FALLTHROUGH;
default:
connection_printf_to_buf(conn, "551 Failed to add Onion Service\r\n");
}
diff --git a/src/feature/dirclient/dirclient.c b/src/feature/dirclient/dirclient.c
index 0fd1a47017..6725fc3369 100644
--- a/src/feature/dirclient/dirclient.c
+++ b/src/feature/dirclient/dirclient.c
@@ -1369,7 +1369,7 @@ directory_initiate_request,(directory_request_t *request))
case 1:
/* start flushing conn */
conn->base_.state = DIR_CONN_STATE_CLIENT_SENDING;
- /* fall through */
+ FALLTHROUGH;
case 0:
/* queue the command on the outbuf */
directory_send_command(conn, 1, request);
diff --git a/src/feature/dirparse/parsecommon.c b/src/feature/dirparse/parsecommon.c
index e8269f7ec7..1664a77bbe 100644
--- a/src/feature/dirparse/parsecommon.c
+++ b/src/feature/dirparse/parsecommon.c
@@ -222,7 +222,7 @@ token_check_object(memarea_t *area, const char *kwd,
kwd, crypto_pk_num_bits(tok->key));
RET_ERR(ebuf);
}
- /* fall through */
+ FALLTHROUGH;
case NEED_KEY: /* There must be some kind of key. */
if (!tok->key) {
tor_snprintf(ebuf, sizeof(ebuf), "Missing public key for %s", kwd);
diff --git a/src/feature/relay/dns.c b/src/feature/relay/dns.c
index 38395862c3..e20a39482f 100644
--- a/src/feature/relay/dns.c
+++ b/src/feature/relay/dns.c
@@ -548,7 +548,7 @@ send_resolved_cell,(edge_connection_t *conn, uint8_t answer_type,
answer_type = RESOLVED_TYPE_ERROR;
/* We let this fall through and treat it as an error. */
}
- /* Falls through. */
+ FALLTHROUGH;
case RESOLVED_TYPE_ERROR_TRANSIENT:
case RESOLVED_TYPE_ERROR:
{
diff --git a/src/feature/rend/rendclient.c b/src/feature/rend/rendclient.c
index 4ca783c7c3..cde954da95 100644
--- a/src/feature/rend/rendclient.c
+++ b/src/feature/rend/rendclient.c
@@ -819,7 +819,7 @@ rend_client_report_intro_point_failure(extend_info_t *failed_intro,
log_warn(LD_BUG, "Unknown failure type %u. Removing intro point.",
failure_type);
tor_fragile_assert();
- /* fall through */
+ FALLTHROUGH;
case INTRO_POINT_FAILURE_GENERIC:
rend_cache_intro_failure_note(failure_type,
(uint8_t *)failed_intro->identity_digest,