JonasToth added a comment. > #include <string.h> > void dostuff(const char *P) { > > if (strncmp(P+2,"xyz",3)==0) {} > > } > >
Iam not super familiar with C, but the intend of the function is to check the following: P = "foxyz", P2 = "abxyz", P3 = "opxyz", ... And if P matches this kind of string pattern. > /home/danielm/strlen.c:3:16: warning: strlen() argument has pointer addition, > it is recommended to subtract the result instead. > [readability-strlen-argument] > > if (strncmp(P+2,"xyz",3)==0) {} > ^ > > Why is it matched? This is the code transformation from -O2? I dont know a way to surround that, and i think you should not call clang-tidy with optimization. > I should probably avoid these, I guess skipping all warnings in macro code > sounds ok to me. You can check if the code is a result of macro expansion, i think that would be enough. Repository: rL LLVM https://reviews.llvm.org/D32346 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits