define: Add macro to annotate intended switch fallthroughs
Follow-up to 814953b331
It turns out [[gcc::fallthrough]] and -Wimplicit-fallthrough were only implemented in GCC 7 and throws a warning on older GCCs.
Add the FALLTHROUGH macro to handle GCC < 7 as found on Xenial.
Warning from GCC 5.5:
/home/runner/work/zoneminder/zoneminder/src/zm_remote_camera_http.cpp:624:13: warning: attributes at the beginning of statement are ignored [-Wattributes]
[[gnu::fallthrough]];
This commit is contained in:
parent
e8565b0704
commit
7e1c580130
|
@ -41,4 +41,14 @@ typedef std::uint8_t uint8;
|
|||
|
||||
#define SZFMTD "%" PRIuPTR
|
||||
|
||||
#ifndef FALLTHROUGH
|
||||
#if defined(__clang__)
|
||||
#define FALLTHROUGH [[clang::fallthrough]]
|
||||
#elif defined(__GNUC__) && __GNUC__ >= 7
|
||||
#define FALLTHROUGH [[gnu::fallthrough]]
|
||||
#else
|
||||
#define FALLTHROUGH
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // ZONEMINDER_SRC_ZM_DEFINE_H_
|
||||
|
|
|
@ -621,7 +621,7 @@ int RemoteCameraHttp::GetResponse() {
|
|||
content_type[0] = '\0';
|
||||
content_boundary[0] = '\0';
|
||||
content_boundary_len = 0;
|
||||
[[gnu::fallthrough]];
|
||||
FALLTHROUGH;
|
||||
}
|
||||
case HEADERCONT :
|
||||
{
|
||||
|
@ -838,7 +838,7 @@ int RemoteCameraHttp::GetResponse() {
|
|||
subcontent_type_header[0] = '\0';
|
||||
content_length = 0;
|
||||
content_type[0] = '\0';
|
||||
[[gnu::fallthrough]];
|
||||
FALLTHROUGH;
|
||||
}
|
||||
case SUBHEADERCONT :
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue