[PATCH] D12359: New warning -Wnonconst-parameter when a pointer parameter can be const

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 18 08:02:19 PST 2015


On Wed, Nov 18, 2015 at 7:41 AM, Daniel Marjamäki <
cfe-commits at lists.llvm.org> wrote:

> danielmarjamaki marked an inline comment as done.
> danielmarjamaki added a comment.
>
> Does anybody else think that this should be moved to clang-tidy?
>

Yep


>
> I believe that the noise level is very low when I scan various open source
> projects.


depends how you define noise, though - and the Clang project has
historically (& Richard's comments indicate that philosophy is ongoing)
treated anything that didn't indicate a bug or bug-like issue (where bug is
"this program behaves differently from the way the programmer intended it
to") as noise, so every instance of this diagnostic is noise by that
definition, I believe (the suggested changes, by design, never change the
behavior of the program)


> My script tries to run clang on all projects in the debian archive. I have
> shown triaged results before, but if you are not convinced I can upload the
> complete results so you can look at that. For comparison, I get more noise
> from existing compiler warnings.
>
>
> ================
> Comment at: include/clang/AST/Decl.h:791
> @@ +790,3 @@
> +
> +    /// \brief Whether this variable has non-const use so it can't be
> const.
> +    unsigned NonConstUse:1;
> ----------------
> hmm.. I'll change "variable" to "parameter" in the next diff.
>
> ================
> Comment at: include/clang/AST/Decl.h:857
> @@ -853,3 +856,3 @@
>  public:
>    typedef redeclarable_base::redecl_range redecl_range;
>    typedef redeclarable_base::redecl_iterator redecl_iterator;
> ----------------
> Thanks! I have moved NonConstUse to ParmVarDeclBits.
>
>
> http://reviews.llvm.org/D12359
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151118/19561af6/attachment.html>


More information about the cfe-commits mailing list