This is an archive of the discontinued LLVM Phabricator instance.

[clang] LLVM_FALLTHROUGH => [[fallthrough]]. NFC
ClosedPublic

Authored by MaskRay on Aug 6 2022, 5:07 PM.

Details

Summary

With C++17 there is no Clang pedantic warning or MSVC C5051.

Diff Detail

Event Timeline

MaskRay created this revision.Aug 6 2022, 5:07 PM
Herald added a reviewer: NoQ. · View Herald Transcript
Herald added a reviewer: ributzka. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
MaskRay requested review of this revision.Aug 6 2022, 5:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 6 2022, 5:07 PM
aaron.ballman accepted this revision.Aug 8 2022, 4:09 AM

LGTM!

I assume you'll be removing the macro definition from Compiler.h once all the projects have been updated?

This revision is now accepted and ready to land.Aug 8 2022, 4:09 AM

Why? There are many years of precedent for using LLVM_FALLTHROUGH and it is very clear and obvious. What do we gain by getting rid of it?
Don't get me wrong, I am not super opposed to using a standard string instead of an LLVM-specific macro. However, it seems that this leaves us with a mixture of the macro and the standard attribute. If we are ready to replace all occurrences in all projects and get rid of the macro altogether (with some warning to downstream users), that seems reasonable. Replacing only some of them seems worse than what we now have.

Why? There are many years of precedent for using LLVM_FALLTHROUGH and it is very clear and obvious. What do we gain by getting rid of it?

Less novel macro usage helps readability, but it's a very minor gain IMO.

Don't get me wrong, I am not super opposed to using a standard string instead of an LLVM-specific macro. However, it seems that this leaves us with a mixture of the macro and the standard attribute. If we are ready to replace all occurrences in all projects and get rid of the macro altogether (with some warning to downstream users), that seems reasonable. Replacing only some of them seems worse than what we now have.

FWIW, I was presuming that @MaskRay was removing *all* uses of the macro with the intent to remove it from Compiler.h when the last in-tree use is removed. I agree that only doing this for part of the project would have rather limited benefits. As for a downstream warning; we don't typically give much notice for other API changes, so I don't see it as being *super* critical, but it would certainly be a kindness to give folks a heads up before removing the macro. One thing we could consider doing is using #pragma clang deprecated(LLVM_FALLTHROUGH, "use [[fallthrough]] instead") in Compiler.h while the macro still exists to alert people doing self-builds that the change is coming. It won't help everyone, but it might help some folks?

martong removed a subscriber: martong.Aug 8 2022, 6:38 AM

Why? There are many years of precedent for using LLVM_FALLTHROUGH and it is very clear and obvious. What do we gain by getting rid of it?
Don't get me wrong, I am not super opposed to using a standard string instead of an LLVM-specific macro. However, it seems that this leaves us with a mixture of the macro and the standard attribute. If we are ready to replace all occurrences in all projects and get rid of the macro altogether (with some warning to downstream users), that seems reasonable. Replacing only some of them seems worse than what we now have.

I will try removing all LLVM_FALLTHROUGH. The per-project approach just finds what may be missing from various bots.

This revision was landed with ongoing or failed builds.Aug 8 2022, 9:13 AM
This revision was automatically updated to reflect the committed changes.