GCC 7, -Wimplicit-fallthrough warnings, and portable way to clear them? : <p>We are catching warnings from GCC 7 for implicit fall through in a switch statement. Previously, we cleared them under Clang (that's the reason for the comment seen below):</p>

<pre><code>g++ -DNDEBUG -g2 -O3 -std=c++17 -Wall -Wextra -fPIC -c authenc.cpp
asn.cpp: In member function ‘void EncodedObjectFilter::Put(const byte*, size_t)’:
asn.cpp:359:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
    m_state = BODY;  // fall through
                  ^
asn.cpp:361:3: note: here
   case BODY:
   ^~~~
</code></pre>

<p>The <a href="https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html" rel="noreferrer">GCC manual</a> states to use <code>__attribute__ ((fallthrough))</code>, but its not portable. The manual also states <em>"... it is also possible to add a fallthrough comment to silence the warning"</em>, but it only offer <code>FALLTHRU</code> (is this really the only choice?):</p>

<pre><code>switch (cond)
  {
  case 1:
    bar (0);
    /* FALLTHRU */
  default:
    …
  }
</code></pre>

<p>Is there a portable way to clear the fall through warning for both Clang and GCC? If so, then what is it?</p>
