This is an archive of the discontinued LLVM Phabricator instance.

[Sema] Suppress a warning about a forward-declared fixed enum in C mode
ClosedPublic

Authored by erik.pilkington on Jan 17 2019, 2:35 PM.

Details

Summary

As of r343360, we support fixed-enums in C. This lead to some warnings in project headers where a fixed enum is forward declared then later defined. In C++, this is fine, the forward declaration is treated as a complete type even though the definition isn't present. We use this rule in C too, but still warn about the forward declaration anyways. This patch suppresses the warning.

rdar://problem/47356469

Thanks for taking a look!
Erik

Diff Detail

Event Timeline

aaron.ballman added inline comments.Jan 18 2019, 6:05 AM
clang/test/Sema/fixed-enum.c
4–5

Can you add a RUN line with -pedantic to ensure that we still warn on the forward declare of the enum even when it's fixed?

erik.pilkington marked an inline comment as done.

Add a -pedantic RUN line.

aaron.ballman accepted this revision.Jan 18 2019, 11:07 AM

LGTM!

clang/test/Sema/fixed-enum.c
4–5

This was meant to say "don't warn" but I see you figured that out. :-)

This revision is now accepted and ready to land.Jan 18 2019, 11:07 AM
This revision was automatically updated to reflect the committed changes.