[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
Wed Aug 26 04:21:33 PDT 2015
danielmarjamaki created this revision.
danielmarjamaki added a subscriber: cfe-commits.
This is a new warning for Clang. It will warn when a pointer parameter can be const.
The design is inspired by the Wunused-parameter warning.
I have tested this on many debian packages. In 2151 projects there were 60834 warnings. So in average there were ~30 warnings / project. Most of my "dontwarn" testcases are inspired by false positives I have seen and fixed. The false positive ratio is imho not bad right now but I will continue to look in the log to see if there are more false positives.
http://reviews.llvm.org/D12359
Files:
include/clang/AST/DeclBase.h
include/clang/Basic/DiagnosticGroups.td
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Sema/Sema.h
lib/Parse/ParseExpr.cpp
lib/Parse/ParseStmt.cpp
lib/Sema/SemaDecl.cpp
lib/Sema/SemaExpr.cpp
lib/Sema/SemaLambda.cpp
lib/Sema/SemaOpenMP.cpp
lib/Sema/SemaTemplateInstantiateDecl.cpp
lib/Serialization/ASTReaderDecl.cpp
test/Sema/warn-nonconst-parameter.c
test/SemaCXX/warn-nonconst-parameter.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12359.33192.patch
Type: text/x-patch
Size: 17357 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150826/3b2229fe/attachment-0001.bin>
More information about the cfe-commits
mailing list