[PATCH] D44826: Add -Wunused-using, a warning that finds unused using declarations.

Nico Weber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 31 07:41:13 PDT 2018


thakis accepted this revision.
thakis added a comment.
This revision is now accepted and ready to land.

Looks great.



================
Comment at: docs/ReleaseNotes.rst:126
+    namespace n { class C; }
+    using n::C;  // Never actually used.
+
----------------
Maybe include an example with a using directive and a namespace alias as well.


================
Comment at: docs/ReleaseNotes.rst:139
+  used in conjunction with ``-Werror`` and as a result, the new warnings
+  are turned into new errors.
+
----------------
nit: I'd omit this paragraph -- this is true for all warnings and not special for this warning.


================
Comment at: include/clang/Basic/DiagnosticGroups.td:828-829
                 // -Wunused-local-typedefs = -Wunused-local-typedef
+def : DiagGroup<"unused-usings", [UnusedUsing]>;
+                // -Wunused-usings = -Wunused-using
 
----------------
CarlosAlbertoEnciso wrote:
> lebedev.ri wrote:
> > Why? gcc compatibility?
> No particular reason. I just follow the 'unused-local-typedefs' model.
> If there is not objection from others reviewers, I will drop the gcc compatibility.
Does gcc have a `-Wunused-usings`? As far as I can tell it doesn't, so I agree not having the alias makes sense. -Wunused-local-typedefs is here because gcc has that flag.


https://reviews.llvm.org/D44826





More information about the cfe-commits mailing list