This is an archive of the discontinued LLVM Phabricator instance.

Fix the behavior of clang's -w flag.
ClosedPublic

Authored by jyknight on Oct 12 2018, 8:41 AM.

Details

Summary

It is intended to disable _all_ warnings, even those upgraded to
errors via -Werror=warningname or `#pragma clang diagnostic error'

Diff Detail

Repository
rL LLVM

Event Timeline

jyknight created this revision.Oct 12 2018, 8:41 AM
rsmith accepted this revision.Jan 24 2019, 1:48 PM
rsmith marked an inline comment as done.
rsmith added inline comments.
clang/lib/Basic/DiagnosticIDs.cpp
460–463 ↗(On Diff #169413)

I think this would be clearer if phrased the other way around:

[...] disables all messages that are not Error/Fatal by default, and also any diagnostics that are Error/Fatal by default but that have been downgraded to Warning severity by any of the mechanisms available: -Wno-error or #pragma diagnostic

466 ↗(On Diff #169413)

I think this change will also cause -w to disable all remarks. Was that your intent?

This revision is now accepted and ready to land.Jan 24 2019, 1:48 PM
jyknight updated this revision to Diff 183966.Jan 28 2019, 2:56 PM
jyknight marked 2 inline comments as done.

Fix to not disable remarks, reword comment, adjust implementation-of-module.m test-case.

clang/lib/Basic/DiagnosticIDs.cpp
460–463 ↗(On Diff #169413)

Reworded.

466 ↗(On Diff #169413)

No, that seems like a bug.

Remarks have their own completely-separate set of command-line options; I don't think -R should interact with -w. I've added a conditional here, and a test case ensuring that.

This revision was automatically updated to reflect the committed changes.