[PATCH] D53199: Fix the behavior of clang's -w flag.

James Y Knight via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 28 14:57:10 PST 2019


jyknight added inline comments.


================
Comment at: clang/lib/Basic/DiagnosticIDs.cpp:460-463
+  // Honor -w: this disables all messages mapped to Warning severity, and *also*
+  // any diagnostics which are not Error/Fatal by default (that is, they were
+  // upgraded by any of the mechanisms available: -Werror, -pedantic, or #pragma
+  // diagnostic)
----------------
rsmith wrote:
> 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
Reworded.


================
Comment at: clang/lib/Basic/DiagnosticIDs.cpp:466
+    if (Result == diag::Severity::Warning ||
+        !isDefaultMappingAsError((diag::kind)DiagID))
+      return diag::Severity::Ignored;
----------------
rsmith wrote:
> I think this change will also cause `-w` to disable all remarks. Was that your intent?
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.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D53199/new/

https://reviews.llvm.org/D53199





More information about the cfe-commits mailing list