aboutsummaryrefslogtreecommitdiff
path: root/src/core/or
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/core/or
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/core/or')
-rw-r--r--src/core/or/channeltls.c2
-rw-r--r--src/core/or/circuitbuild.c2
-rw-r--r--src/core/or/circuitlist.c4
-rw-r--r--src/core/or/circuituse.c2
-rw-r--r--src/core/or/connection_edge.c2
-rw-r--r--src/core/or/onion.c2
-rw-r--r--src/core/or/reasons.c2
-rw-r--r--src/core/or/relay.c2
-rw-r--r--src/core/or/scheduler.c4
9 files changed, 11 insertions, 11 deletions
diff --git a/src/core/or/channeltls.c b/src/core/or/channeltls.c
index 4db283d20e..f874e39946 100644
--- a/src/core/or/channeltls.c
+++ b/src/core/or/channeltls.c
@@ -1238,7 +1238,7 @@ channel_tls_handle_var_cell(var_cell_t *var_cell, or_connection_t *conn)
/* But that should be happening any longer've disabled bufferevents. */
tor_assert_nonfatal_unreached_once();
- /* fall through */
+ FALLTHROUGH;
case OR_CONN_STATE_TLS_SERVER_RENEGOTIATING:
if (!(command_allowed_before_handshake(var_cell->command))) {
log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
diff --git a/src/core/or/circuitbuild.c b/src/core/or/circuitbuild.c
index 21369fb538..f3a5791d6c 100644
--- a/src/core/or/circuitbuild.c
+++ b/src/core/or/circuitbuild.c
@@ -2106,7 +2106,7 @@ choose_good_exit_server(origin_circuit_t *circ,
/* For these three, we want to pick the exit like a middle hop,
* since it should be random. */
tor_assert_nonfatal(is_internal);
- /* Falls through */
+ FALLTHROUGH;
case CIRCUIT_PURPOSE_C_GENERAL:
if (is_internal) /* pick it like a middle hop */
return router_choose_random_node(NULL, options->ExcludeNodes, flags);
diff --git a/src/core/or/circuitlist.c b/src/core/or/circuitlist.c
index 145004c71d..be5ac3b7f6 100644
--- a/src/core/or/circuitlist.c
+++ b/src/core/or/circuitlist.c
@@ -787,7 +787,7 @@ circuit_purpose_to_controller_hs_state_string(uint8_t purpose)
"Unrecognized circuit purpose: %d",
(int)purpose);
tor_fragile_assert();
- /* fall through */
+ FALLTHROUGH;
case CIRCUIT_PURPOSE_OR:
case CIRCUIT_PURPOSE_C_GENERAL:
@@ -2738,7 +2738,7 @@ assert_cpath_layer_ok(const crypt_path_t *cp)
{
case CPATH_STATE_OPEN:
relay_crypto_assert_ok(&cp->crypto);
- /* fall through */
+ FALLTHROUGH;
case CPATH_STATE_CLOSED:
/*XXXX Assert that there's no handshake_state either. */
tor_assert(!cp->rend_dh_handshake_state);
diff --git a/src/core/or/circuituse.c b/src/core/or/circuituse.c
index 000a7c36da..7273be3510 100644
--- a/src/core/or/circuituse.c
+++ b/src/core/or/circuituse.c
@@ -780,7 +780,7 @@ circuit_expire_building(void)
TO_ORIGIN_CIRCUIT(victim)->build_state->pending_final_cpath ==
NULL)
break;
- /* fallthrough! */
+ FALLTHROUGH;
case CIRCUIT_PURPOSE_C_INTRODUCE_ACK_WAIT:
case CIRCUIT_PURPOSE_C_REND_READY_INTRO_ACKED:
/* If we have reached this line, we want to spare the circ for now. */
diff --git a/src/core/or/connection_edge.c b/src/core/or/connection_edge.c
index 90991107dc..67a772be08 100644
--- a/src/core/or/connection_edge.c
+++ b/src/core/or/connection_edge.c
@@ -324,7 +324,7 @@ connection_edge_process_inbuf(edge_connection_t *conn, int package_partial)
}
/* Fall through if the connection is on a circuit without optimistic
* data support. */
- /* Falls through. */
+ FALLTHROUGH;
case EXIT_CONN_STATE_CONNECTING:
case AP_CONN_STATE_RENDDESC_WAIT:
case AP_CONN_STATE_CIRCUIT_WAIT:
diff --git a/src/core/or/onion.c b/src/core/or/onion.c
index aa77465b96..aeddedd807 100644
--- a/src/core/or/onion.c
+++ b/src/core/or/onion.c
@@ -509,7 +509,7 @@ create_cell_format_impl(cell_t *cell_out, const create_cell_t *cell_in,
p += 16;
space -= 16;
}
- /* Fall through */
+ FALLTHROUGH;
case CELL_CREATE_FAST:
tor_assert(cell_in->handshake_len <= space);
memcpy(p, cell_in->onionskin, cell_in->handshake_len);
diff --git a/src/core/or/reasons.c b/src/core/or/reasons.c
index a7952279ba..e21bfa670a 100644
--- a/src/core/or/reasons.c
+++ b/src/core/or/reasons.c
@@ -489,7 +489,7 @@ end_reason_to_http_connect_response_line(int endreason)
return "HTTP/1.0 502 Bad Gateway (tor protocol violation)\r\n\r\n";
case END_STREAM_REASON_ENTRYPOLICY:
return "HTTP/1.0 403 Forbidden (entry policy violation)\r\n\r\n";
- case END_STREAM_REASON_NOTDIRECTORY: /* Fall Through */
+ case END_STREAM_REASON_NOTDIRECTORY: FALLTHROUGH;
default:
tor_assert_nonfatal_unreached();
return "HTTP/1.0 500 Internal Server Error (weird end reason)\r\n\r\n";
diff --git a/src/core/or/relay.c b/src/core/or/relay.c
index dc88a6f649..f5fc1cfbb3 100644
--- a/src/core/or/relay.c
+++ b/src/core/or/relay.c
@@ -866,7 +866,7 @@ connection_ap_process_end_not_open(
break; /* break means it'll close, below */
/* Else fall through: expire this circuit, clear the
* chosen_exit_name field, and try again. */
- /* Falls through. */
+ FALLTHROUGH;
case END_STREAM_REASON_RESOLVEFAILED:
case END_STREAM_REASON_TIMEOUT:
case END_STREAM_REASON_MISC:
diff --git a/src/core/or/scheduler.c b/src/core/or/scheduler.c
index f85201b7d5..9f1a27d501 100644
--- a/src/core/or/scheduler.c
+++ b/src/core/or/scheduler.c
@@ -192,7 +192,7 @@ get_scheduler_type_string(scheduler_types_t type)
case SCHEDULER_KIST_LITE:
return "KISTLite";
case SCHEDULER_NONE:
- /* fallthrough */
+ FALLTHROUGH;
default:
tor_assert_unreached();
return "(N/A)";
@@ -288,7 +288,7 @@ select_scheduler(void)
scheduler_kist_set_lite_mode();
goto end;
case SCHEDULER_NONE:
- /* fallthrough */
+ FALLTHROUGH;
default:
/* Our option validation should have caught this. */
tor_assert_unreached();