This is an archive of the discontinued LLVM Phabricator instance.

Fix warning in MSVC
ClosedPublic

Authored by giulianobelinassi on Sep 8 2023, 3:58 PM.

Details

Summary

Currently there is no PrintOnLeft attribute set, which results in an
empty switch-case. When compiling this, MSVC issues a warning saying
that the switch-case is empty. Fix this by using a macro and checking
if this macro is defined or not.

Links to D157394

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptSep 8 2023, 3:58 PM
giulianobelinassi requested review of this revision.Sep 8 2023, 3:58 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 8 2023, 3:58 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
erichkeane accepted this revision.Sep 11 2023, 6:49 AM

This seems good enough to me. I'll commit it for you as before.

This revision is now accepted and ready to land.Sep 11 2023, 6:49 AM
erichkeane closed this revision.Sep 11 2023, 6:52 AM

Forgot to close the phab review automatically, but: 0323938d3c7a1a48b60a7dea8ec7300e98b4a931

I think this may have broken builds:

worktrees/src1/clang/lib/AST/DeclPrinter.cpp:293:48: error: function definition is not allowed here
static bool mustPrintOnLeftSide(const Attr *A) {

Probably missing a }?

I think this may have broken builds:

worktrees/src1/clang/lib/AST/DeclPrinter.cpp:293:48: error: function definition is not allowed here
static bool mustPrintOnLeftSide(const Attr *A) {

Probably missing a }?

No, there is just an extra switch statement that somehow got into the patch. I will fix this in a second.

I think this may have broken builds:

worktrees/src1/clang/lib/AST/DeclPrinter.cpp:293:48: error: function definition is not allowed here
static bool mustPrintOnLeftSide(const Attr *A) {

Probably missing a }?

No, there is just an extra switch statement that somehow got into the patch. I will fix this in a second.

Yikes, what I get for committing and not building first :) I believe @giulianobelinassi still doesn't have commit access, so I'll just fix it as review-after-commit.

Fixed in 6c0b9e357617. I didn't verify ahead of time, but hopefully the bots will yell at ME this time and I'll recognize it right away.

Fixed in 6c0b9e357617. I didn't verify ahead of time, but hopefully the bots will yell at ME this time and I'll recognize it right away.

It builds for me, thanks for the quick fix!

Fixed in 6c0b9e357617. I didn't verify ahead of time, but hopefully the bots will yell at ME this time and I'll recognize it right away.

Thanks for fixing that. This is on me, I should have built it before sending the patch. Sorry about this.