This is an archive of the discontinued LLVM Phabricator instance.

Use C++11 fallthrough attribute syntax when available and add a break
ClosedPublic

Authored by rnk on Nov 1 2018, 10:40 AM.

Details

Summary

This silences the two -Wimplicit-fallthrough warnings clang finds in
ItaniumDemangle.h in libc++abi.

Clang does not have a GNU attribute spelling for this attribute, so this
is necessary.

I will commit the same change to the LLVM demangler soon.

Diff Detail

Repository
rL LLVM

Event Timeline

rnk created this revision.Nov 1 2018, 10:40 AM
ldionne accepted this revision.Nov 1 2018, 10:51 AM

Would it make sense to add the GNU spelling to the attribute in Clang?

This revision is now accepted and ready to land.Nov 1 2018, 10:51 AM

Would it make sense to add the GNU spelling to the attribute in Clang?

I'll redirect that question to @rsmith and @aaron.ballman. I have a vague recollection that it was considered and rejected, but that decision may have predated GCC 7.

In any case, libc++ needs the [[clang::fallthrough]] spelling to support old versions of clang in C++11 mode.

Thanks!

This revision was automatically updated to reflect the committed changes.
In D53985#1284246, @rnk wrote:

Would it make sense to add the GNU spelling to the attribute in Clang?

I'll redirect that question to @rsmith and @aaron.ballman. I have a vague recollection that it was considered and rejected, but that decision may have predated GCC 7.

I'm not opposed to it given that it's an attribute supported by GCC.

In D53985#1284246, @rnk wrote:

Would it make sense to add the GNU spelling to the attribute in Clang?

I'll redirect that question to @rsmith and @aaron.ballman. I have a vague recollection that it was considered and rejected, but that decision may have predated GCC 7.

I'm not opposed to it given that it's an attribute supported by GCC.

Likewise; I think we decided not to do this before because (a) GCC didn't have such an attribute, and (b) it wasn't clear that we wanted to support "attribute statements" for GNU attributes at all, or whether this should be an attribute appertaining to the label.