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

Daniel Marjamäki via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 8 05:18:37 PST 2015


danielmarjamaki added a comment.

In http://reviews.llvm.org/D12359#304772, @danielmarjamaki wrote:

> Moved warning to clang-tidy.
>
> In this patch I am more careful about function calls. Sometimes when it is technically possible to use const it's still not a good idea.
>
> For instance when using the standard strstr C function:
>
>   char * strstr ( const char *, const char * ); 
>   
>   void f(char *p) {  // <- p should not be const
>         char *a = strstr(p, "a");
>         *a = 0;
>   }


I intend to fix this also later. But I would prefer to commit this checker first.

Right now there are not FP.


http://reviews.llvm.org/D12359





More information about the cfe-commits mailing list