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

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 24 13:48:50 PST 2019


rsmith accepted this revision.
rsmith marked an inline comment as done.
rsmith added inline comments.
This revision is now accepted and ready to land.


================
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)
----------------
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


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


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

https://reviews.llvm.org/D53199





More information about the cfe-commits mailing list