[PATCH] D52695: [clang][Parse] Diagnose useless null statements (PR39111)

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 3 17:39:31 PDT 2018


rsmith added a comment.

I feel indifferent about this warning, but clearly you care about it enough to work on it, and it's a pretty low-cost feature from a maintenance perspective, so I suppose it's fine.



================
Comment at: include/clang/Basic/DiagnosticParseKinds.td:56-58
+def warn_null_statement : Warning<
+  "';' with no preceding expression is a null statement">,
+  InGroup<ExtraSemiStmt>, DefaultIgnore;
----------------
The warning should explain why we're warning: what the problem is, and why it warrants action from the user. I would expect people seeing this warning to think "yes, but so what?". Something like "statement has no effect" might be better, maybe? (A customized warning for `;;` might be nice too.)


Repository:
  rC Clang

https://reviews.llvm.org/D52695





More information about the cfe-commits mailing list