[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 Oct 21 01:21:12 PDT 2015


danielmarjamaki updated this revision to Diff 37969.
danielmarjamaki added a comment.

Fixed a FP.

Triaged warnings (random selection of warnings):

ftp://ftp.se.debian.org/debian/pool/main/a/aespipe/aespipe_2.4c.orig.tar.bz2
./aespipe.c:467:43: warning: parameter 'keyStr' can be const [-Wnonconst-parameter]
 => TP
./rmd160.c:188:38: warning: parameter 'data' can be const [-Wnonconst-parameter]
 => TP

ftp://ftp.se.debian.org/debian/pool/main/b/barcode/barcode_0.98+debian.orig.tar.gz
library.c:37:43: warning: parameter 'text' can be const [-Wnonconst-parameter]
 => TP
ean.c:101:36: warning: parameter 'text' can be const [-Wnonconst-parameter]
 => TP
ean.c:134:39: warning: parameter 'text' can be const [-Wnonconst-parameter]
 => TP
ean.c:178:41: warning: parameter 'text' can be const [-Wnonconst-parameter]
 => TP
ean.c:332:39: warning: parameter 'text' can be const [-Wnonconst-parameter]
 => TP
ean.c:379:40: warning: parameter 'text' can be const [-Wnonconst-parameter]
 => TP
code39.c:64:38: warning: parameter 'text' can be const [-Wnonconst-parameter]
 => TP
code93.c:68:38: warning: parameter 'text' can be const [-Wnonconst-parameter]
 => TP
msi.c:41:39: warning: parameter 'text' can be const [-Wnonconst-parameter]
 => TP
plessey.c:44:39: warning: parameter 'text' can be const [-Wnonconst-parameter]
 => TP
codabar.c:53:39: warning: parameter 'text' can be const [-Wnonconst-parameter]
 => TP

ftp://ftp.se.debian.org/debian/pool/main/c/c-ares/c-ares_1.9.1.orig.tar.gz
ares_gethostbyaddr.c:144:42: warning: parameter 'abuf' can be const [-Wnonconst-parameter]
 => TP
ares_gethostbyname.c:180:42: warning: parameter 'abuf' can be const [-Wnonconst-parameter]
 => TP

ftp://ftp.se.debian.org/debian/pool/main/c/ccache/ccache_3.2.4.orig.tar.bz2
mdfour.c:41:20: warning: parameter 'M' can be const [-Wnonconst-parameter]
 => TP

ftp://ftp.se.debian.org/debian/pool/main/d/dmalloc/dmalloc_5.5.2.orig.tar.gz
dmalloc_tab.c:297:64: warning: parameter 'last_p' can be const [-Wnonconst-parameter]
 => TP

ncpfs:
./nwcrypt.c:306:33: warning: parameter 'new' can be const [-Wnonconst-parameter]
 => TP
ncplib.c:313:38: warning: parameter 'node' can be const [-Wnonconst-parameter]
 => TP
ncplib.c:431:41: warning: parameter 'addrlen' can be const [-Wnonconst-parameter]
 => FP (fail to reproduce in smaller example, there is compiler error that maybe cause wrong warnings)
ncplib.c:2412:23: warning: parameter 'argc' can be const [-Wnonconst-parameter]
 => FP (fail to reproduce in smaller example, there is compiler error that maybe cause wrong warnings)

ftp://ftp.se.debian.org/debian/pool/main/r/readline5/readline5_5.2.orig.tar.gz
vi_mode.c:1429:12: warning: parameter 'mb' can be const [-Wnonconst-parameter]
 => TP
parens.c:150:12: warning: parameter 'string' can be const [-Wnonconst-parameter]
 => TP
search.c:115:12: warning: parameter 'string' can be const [-Wnonconst-parameter]
 => TP
complete.c:479:12: warning: parameter 'filename' can be const [-Wnonconst-parameter]
 => TP
complete.c:784:12: warning: parameter 's' can be const [-Wnonconst-parameter]
 => TP
complete.c:1514:12: warning: parameter 'text' can be const [-Wnonconst-parameter]
 => TP
bind.c:1076:12: warning: parameter 'args' can be const [-Wnonconst-parameter]
 => Technically TP (char *e = strchr(args, '\n'))
bind.c:1725:12: warning: parameter 'name' can be const [-Wnonconst-parameter]
 => TP
bind.c:2301:12: warning: parameter 'string' can be const [-Wnonconst-parameter]
 => TP
isearch.c:156:12: warning: parameter 'search_string' can be const [-Wnonconst-parameter]
 => TP
display.c:2139:12: warning: parameter 'string' can be const [-Wnonconst-parameter]
 => TP
histexpand.c:310:12: warning: parameter 'string' can be const [-Wnonconst-parameter]
 => TP
histexpand.c:365:13: warning: parameter 's' can be const [-Wnonconst-parameter]
 => TP
histexpand.c:1239:12: warning: parameter 'spec' can be const [-Wnonconst-parameter]
 => TP
histexpand.c:1239:19: warning: parameter 'from' can be const [-Wnonconst-parameter]
 => TP
histexpand.c:1577:12: warning: parameter 'line' can be const [-Wnonconst-parameter]
 => TP
mbutil.c:145:12: warning: parameter 'string' can be const [-Wnonconst-parameter]
 => TP
mbutil.c:205:12: warning: parameter 'src' can be const [-Wnonconst-parameter]
 => TP
mbutil.c:265:12: warning: parameter 'string' can be const [-Wnonconst-parameter]
 => TP
mbutil.c:304:12: warning: parameter 'string' can be const [-Wnonconst-parameter]
 => TP
mbutil.c:306:12: warning: parameter 'mbchar' can be const [-Wnonconst-parameter]
 => TP
mbutil.c:322:12: warning: parameter 'buf' can be const [-Wnonconst-parameter]
 => TP
 ../tilde.c:323:12: warning: parameter 'prefix' can be const [-Wnonconst-parameter]
 => TP

ftp://ftp.se.debian.org/debian/pool/main/t/tig/tig_2.0.3.orig.tar.gz
src/tig.c:414:24: warning: parameter 'name' can be const [-Wnonconst-parameter]
 => TP
src/io.c:415:37: warning: parameter 'data' can be const [-Wnonconst-parameter]
 => TP
src/graph.c:132:38: warning: parameter 'new_id' can be const [-Wnonconst-parameter]
 => TP
src/refdb.c:211:16: warning: parameter 'id' can be const [-Wnonconst-parameter]
 => TP
src/options.c:319:27: warning: parameter 'remapped' can be const [-Wnonconst-parameter]
 => FP (fixed in latest patch)

ftp://ftp.se.debian.org/debian/pool/main/w/wxwidgets2.6/wxwidgets2.6_2.6.3.2.2.orig.tar.gz
./src/tiff/tif_color.c:121:36: warning: parameter 'refWhite' can be const [-Wnonconst-parameter]
 => TP
./src/tiff/tif_color.c:206:50: warning: parameter 'luma' can be const [-Wnonconst-parameter]
 => TP
./src/tiff/tif_color.c:206:63: warning: parameter 'refBlackWhite' can be const [-Wnonconst-parameter]
 => TP
./src/tiff/tif_luv.c:714:18: warning: parameter 'xyz' can be const [-Wnonconst-parameter]
 => TP
./src/tiff/tif_luv.c:896:23: warning: parameter 'XYZ' can be const [-Wnonconst-parameter]
 => TP
./src/tiff/tif_luv.c:1034:23: warning: parameter 'XYZ' can be const [-Wnonconst-parameter]
 => TP

ftp://ftp.se.debian.org/debian/pool/main/x/xplot-xplot.org/xplot-xplot.org_0.90.7.1.orig.tar.gz
xplot.c:455:63: warning: parameter 's2' can be const [-Wnonconst-parameter]
 => TP
xplot.c:2741:20: warning: parameter 's1' can be const [-Wnonconst-parameter]
 => TP
xplot.c:2741:30: warning: parameter 's2' can be const [-Wnonconst-parameter]
 => TP
xplot.c:3145:30: warning: parameter 's' can be const [-Wnonconst-parameter]
 => TP
coord.c:52:35: warning: parameter 's' can be const [-Wnonconst-parameter]
 => TP
signed.c:48:26: warning: parameter 's' can be const [-Wnonconst-parameter]
 => TP
double.c:62:20: warning: parameter 's' can be const [-Wnonconst-parameter]
 => TP
dtime.c:71:19: warning: parameter 's' can be const [-Wnonconst-parameter]
 => TP

ftp://ftp.se.debian.org/debian/pool/main/z/zsync/zsync_0.6.2.orig.tar.bz2
inflate.c:1154:20: warning: parameter 'buf' can be const [-Wnonconst-parameter]
 => TP
trees.c:580:11: warning: parameter 'bl_count' can be const [-Wnonconst-parameter]
 => TP
trees.c:1195:15: warning: parameter 'buf' can be const [-Wnonconst-parameter]
 => TP
zmap.c:261:65: warning: parameter 'byterange' can be const [-Wnonconst-parameter]
 => TP
client.c:426:28: warning: parameter 'filename' can be const [-Wnonconst-parameter]
 => TP
http.c:701:60: warning: parameter 'ranges' can be const [-Wnonconst-parameter]
 => TP


http://reviews.llvm.org/D12359

Files:
  include/clang/AST/Decl.h
  include/clang/Basic/DiagnosticGroups.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/Sema.h
  lib/AST/Decl.cpp
  lib/Parse/ParseDecl.cpp
  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/Analysis/NoReturn.m
  test/Analysis/bstring.c
  test/Analysis/casts.c
  test/Analysis/coverage.c
  test/Analysis/inlining/false-positive-suppression.c
  test/Analysis/inlining/inline-defensive-checks.c
  test/Analysis/inlining/path-notes.m
  test/Analysis/logical-ops.c
  test/Analysis/malloc.c
  test/Analysis/misc-ps-region-store.m
  test/Analysis/misc-ps.c
  test/Analysis/misc-ps.m
  test/Analysis/null-deref-ps.c
  test/Analysis/objc-boxing.m
  test/Analysis/pr22954.c
  test/Analysis/ptr-arith.c
  test/Analysis/retain-release-inline.m
  test/Analysis/retain-release.m
  test/Analysis/simple-stream-checks.c
  test/Analysis/stack-addr-ps.c
  test/Analysis/string.c
  test/Analysis/svalbuilder-logic.c
  test/Analysis/unix-fns.c
  test/CodeGen/builtins-arm-exclusive.c
  test/CodeGen/builtins-systemz.c
  test/FixIt/dereference-addressof.c
  test/Parser/MicrosoftExtensionsInlineAsm.c
  test/Parser/attributes.c
  test/Parser/declarators.c
  test/Parser/pointer-arithmetic.c
  test/Sema/annotate.c
  test/Sema/arm-neon-types.c
  test/Sema/atomic-ops.c
  test/Sema/builtin-assume-aligned.c
  test/Sema/builtin-assume.c
  test/Sema/builtins-arm-exclusive.c
  test/Sema/builtins-arm64-exclusive.c
  test/Sema/builtins.c
  test/Sema/builtins.cl
  test/Sema/c89.c
  test/Sema/compare.c
  test/Sema/crash-invalid-array.c
  test/Sema/empty1.c
  test/Sema/exprs.c
  test/Sema/function.c
  test/Sema/merge-decls.c
  test/Sema/ms-inline-asm.c
  test/Sema/pointer-subtract-compat.c
  test/Sema/transparent-union.c
  test/Sema/typecheck-binop.c
  test/Sema/typo-correction.c
  test/Sema/uninit-variables.c
  test/Sema/unused-expr.c
  test/Sema/varargs-x86-64.c
  test/Sema/warn-logical-not-compare.c
  test/Sema/warn-nonconst-parameter.c
  test/Sema/warn-sizeof-arrayarg.c
  test/Sema/warn-strncat-size.c
  test/Sema/warn-thread-safety-analysis.c
  test/Sema/warn-type-safety-mpi-hdf5.c
  test/SemaObjC/nullability.m
  test/SemaObjC/uninit-variables.m
  test/SemaOpenCL/address-spaces.cl
  test/SemaOpenCL/cond.cl
  test/SemaOpenCL/event_t_overload.cl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12359.37969.patch
Type: text/x-patch
Size: 81409 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151021/17f951cf/attachment-0001.bin>


More information about the cfe-commits mailing list