This is an archive of the discontinued LLVM Phabricator instance.

do not emit -Wunused-macros warnings in -frewrite-includes mode (PR15614)
ClosedPublic

Authored by llunak on Jul 27 2019, 12:44 PM.

Diff Detail

Event Timeline

llunak created this revision.Jul 27 2019, 12:44 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 27 2019, 12:44 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript

A test case would be good (in the clang/test directory - probably near/in the other tests for -frewrite-includes)

And does the same bug occur for other preprocessor-related warnings? Maybe it's not practical to disable them all this way & there should be a different solution? (or maybe we shouldn't fix these and users can pass -w to disable warnings when using -frewrite-includes?)

llunak updated this revision to Diff 219370.Sep 9 2019, 9:25 AM

Added a test.

llunak added a comment.Sep 9 2019, 9:31 AM

A test case would be good (in the clang/test directory - probably near/in the other tests for -frewrite-includes)

Done.

And does the same bug occur for other preprocessor-related warnings? Maybe it's not practical to disable them all this way & there should be a different solution? (or maybe we shouldn't fix these and users can pass -w to disable warnings when using -frewrite-includes?)

I've never seen any other warning from -frewrite-includes besides -Wunused-macros. Given that I use and more or less maintain Icecream, which uses -frewrite-includes for distributed builds, I'd say any other warnings there either don't exist or are very rare (which rather makes sense, given that -frewrite-includes only does limited macro expansion when analysing the input and that's about it). Given that, I'd prefer not to disable warnings globally - they are unlikely to show up, if they do, they can hopefully be handled individually, but on the other hand maybe Clang one day gets warnings about #include or similar that would be a pity to miss when using -rewrite-includes.

dblaikie accepted this revision.Sep 9 2019, 3:09 PM

Fair enough - thanks!

This revision is now accepted and ready to land.Sep 9 2019, 3:09 PM
This revision was automatically updated to reflect the committed changes.