diff options
author | Nick Mathewson <nickm@torproject.org> | 2021-01-13 09:48:00 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2021-01-13 09:54:43 -0500 |
commit | fa8ecf88202dfe3af9e02331ca9dee6768870911 (patch) | |
tree | 082628fb7330439775abefeec004e2a1eb21bb05 /src/core | |
parent | 6c0f15500b3aa027c90d1c397d4504bb2f4dd41b (diff) | |
download | tor-fa8ecf88202dfe3af9e02331ca9dee6768870911.tar.gz tor-fa8ecf88202dfe3af9e02331ca9dee6768870911.zip |
Better fix for #40241 (--enable-all-bugs-are-fatal and fallthrough)
This one should work on GCC _and_ on Clang. The previous version
made Clang happier by not having unreachable "fallthrough"
statements, but made GCC sad because GCC didn't think that the
unconditional failures were really unconditional, and therefore
_wanted_ a FALLTHROUGH.
This patch adds a FALLTHROUGH_UNLESS_ALL_BUGS_ARE_FATAL macro that
seems to please both GCC and Clang in this case: ordinarily it is a
FALLTHROUGH, but when ALL_BUGS_ARE_FATAL is defined, it's an
abort().
Fixes bug 40241 again. Bugfix on earlier fix for 40241, which was
merged into maint-0.3.5 and forward, and released in 0.4.5.3-rc.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/or/channeltls.c | 4 | ||||
-rw-r--r-- | src/core/or/circuitlist.c | 4 |
2 files changed, 2 insertions, 6 deletions
diff --git a/src/core/or/channeltls.c b/src/core/or/channeltls.c index bdd82f3138..18025ff73a 100644 --- a/src/core/or/channeltls.c +++ b/src/core/or/channeltls.c @@ -1225,9 +1225,7 @@ channel_tls_handle_var_cell(var_cell_t *var_cell, or_connection_t *conn) * the v2 and v3 handshakes. */ /* But that should be happening any longer've disabled bufferevents. */ tor_assert_nonfatal_unreached_once(); -#ifndef ALL_BUGS_ARE_FATAL - FALLTHROUGH; -#endif + FALLTHROUGH_UNLESS_ALL_BUGS_ARE_FATAL; 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/circuitlist.c b/src/core/or/circuitlist.c index 83e2124498..ccf3041bb4 100644 --- a/src/core/or/circuitlist.c +++ b/src/core/or/circuitlist.c @@ -787,9 +787,7 @@ circuit_purpose_to_controller_hs_state_string(uint8_t purpose) "Unrecognized circuit purpose: %d", (int)purpose); tor_fragile_assert(); -#ifndef ALL_BUGS_ARE_FATAL - FALLTHROUGH; -#endif + FALLTHROUGH_UNLESS_ALL_BUGS_ARE_FATAL; case CIRCUIT_PURPOSE_OR: case CIRCUIT_PURPOSE_C_GENERAL: |