Fix and/or annotate all switch fall-throughs. In some configurations, Clang will warn about all unannotated fall-throughs in C++. This change adds the needed annotation for Clang in the single place where we appear to have this. Change-Id: I25a9069e659ce278d3cd24bf46f667324b3d5146 Reviewed-on: https://boringssl-review.googlesource.com/18024 Commit-Queue: Adam Langley <agl@google.com> Commit-Queue: David Benjamin <davidben@google.com> Reviewed-by: David Benjamin <davidben@google.com>
diff --git a/ssl/internal.h b/ssl/internal.h index 6b88070..ba98783 100644 --- a/ssl/internal.h +++ b/ssl/internal.h
@@ -2373,6 +2373,16 @@ void ssl_reset_error_state(SSL *ssl); +/* Utility macros */ + +#if defined(__clang__) +/* SSL_FALLTHROUGH annotates a fallthough case in a switch statement. */ +#define SSL_FALLTHROUGH [[clang::fallthrough]] +#else +#define SSL_FALLTHROUGH +#endif + + #if defined(__cplusplus) } /* extern C */ #endif
diff --git a/ssl/ssl_cert.cc b/ssl/ssl_cert.cc index df4b9c8..a410aef 100644 --- a/ssl/ssl_cert.cc +++ b/ssl/ssl_cert.cc
@@ -593,6 +593,7 @@ break; case -2: OPENSSL_PUT_ERROR(X509, X509_R_UNKNOWN_KEY_TYPE); + break; default: assert(0); break;
diff --git a/ssl/tls13_both.cc b/ssl/tls13_both.cc index 763dc0e..83ff78a 100644 --- a/ssl/tls13_both.cc +++ b/ssl/tls13_both.cc
@@ -53,7 +53,7 @@ } ssl->method->expect_flight(ssl); hs->wait = ssl_hs_read_message; - /* Fall-through. */ + SSL_FALLTHROUGH; } case ssl_hs_read_message: {