<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Fallthrough attr should support GNU spelling __attribute__((fallthrough)) to match GCC 7"
   href="https://bugs.llvm.org/show_bug.cgi?id=37135">37135</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Fallthrough attr should support GNU spelling __attribute__((fallthrough)) to match GCC 7
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>comexk@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>From
<a href="https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/">https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/</a>,
GCC supports this syntax:

switch (cond)
 {
 case 1:
   bar (1);
   __attribute__ ((fallthrough)); // C and C++03
 case 2:
   bar (2);
   [[gnu::fallthrough]]; // C++11 and C++14
 case 3:
   bar (3);
   [[fallthrough]]; // C++17 and above
 /* ... */
 }

Clang's current definition in Attr.td:

def FallThrough : StmtAttr {
  let Spellings = [CXX11<"", "fallthrough", 201603>, C2x<"", "fallthrough">,
                   CXX11<"clang", "fallthrough">];
  [..]
}

I think GCC<"fallthrough"> needs to be added.

This check in lib/Sema/AnalysisBasedWarnings.cpp should then be removed:

  // Only perform this analysis when using [[]] attributes. There is no good
  // workflow for this warning when not using C++11. There is no good way to
  // silence the warning (no attribute is available) unless we are using 
  // [[]] attributes. One could use pragmas to silence the warning, but as a
  // general solution that is gross and not in the spirit of this warning.
  //
  // NOTE: This an intermediate solution. There are on-going discussions on
  // how to properly support this warning outside of C++11 with an annotation.
  if (!AC.getASTContext().getLangOpts().DoubleSquareBracketAttributes)
    return;</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>